How to restart apache when it hits maxclients

Discussion in 'Apache' started by greeze, Jul 27, 2009.

  1. #1
    Hi all,

    I'm on a vps and maxclients set to 25 only. I'm not allowed to change this number as warned by my web host admins.

    Lately, my site will come to a halt when the max clients go above 25. I found this out when I SSH into my site and did a ps aux | grep httpd -c and realize the http clients are 27.

    The only way to get my site to start serving pages again is to do an apache restart.

    My question now. Is there a way I can execute a cron / script only when the max client hits 27? It's like in programming if > 26 then restart... something like this.

    Is this even possible?
     
    greeze, Jul 27, 2009 IP
  2. gostats

    gostats Peon

    Messages:
    325
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yeah, you could use a Perl or shell script in cron to restart apache when it hits that limit, however, I don't think that will be the best solution.

    Have you tried turning off keepalive requests?

    The other option is to upgrade to a better hosting plan. (I would say that this is your best option)
     
    gostats, Jul 30, 2009 IP