0

Possible Duplicate:
Apache performance issue, after “1000 total children” Apache no longer responds to HTTP requests. Not MaxClients issue?

The values for MaxClients, ServerLimit etc parameters are quite high (4000). Available RAM on the server is high too (~8G). Load average remains below 1 on a 24 core CPU. But when the number of visitors on the website increase apache just stops serving requests. The apache error log is blank and access log shows no more requests coming in.

Restarting apache makes it work again until the number of requests increases again.

Any ideas where to start looking?

UPDATE Getting the below errors in apache error log on running it with LogLevel Debug [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 32 children, there are 479 idle, and 1027 total children

4
  • 1
    How many concurrent connections at that time?
    – quanta
    Aug 31, 2012 at 10:13
  • ~1000 apache processes (ps -A | grep apache2 | wc -l)
    – Gunjan
    Aug 31, 2012 at 10:37
  • That's rather a lot of Apache processes - are you saying the system has 8GB RAM free when you hit the error condition or 8GB total? >1000 processes is a lot of RAM usage even if you're just serving static files (let alone PHP, CGIs etc) so you could easily be running out of RAM and swapping.
    – James Yale
    Aug 31, 2012 at 10:51
  • The server has 64G ram has has around 8-12G free at peak time. No swapping/thrashing happening
    – Gunjan
    Aug 31, 2012 at 10:52

3 Answers 3

0

The error message gives you the answer - increase StartServers or Min/MaxSpareServers. You may also need to look at MaxClients.

1
  • Tried increasing that by a factor of ~10 - no effect
    – Gunjan
    Aug 31, 2012 at 11:18
0

I'd try to separate serving of PHP scripts and static files.

You can serve static files very efficiently with worker MPM and even better with event MPM available for httpd 2.4+. But you can not use this MPM for serving PHP scripts, as PHP isn't thread-safe.

For PHP you can run a separate httpd instance (I'm running it on my server with Listen 127.0.0.2:488) and configure main server as a reverse proxy:

ProxyPreserveHost On
DocumentRoot /var/www/html
RewriteEngine On
RewriteCond /var/www/html%{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} \.php$
RewriteRule ^/(.*) http://127.0.0.2:488/$1 [P,L]

With mod_remoteip (again - available from httpd 2.4) it would be truly transparent for a PHP script.

Or use for example php-fpm.

This way request for static files, HTTP persistent connections etc. will not use your limited server children pool and will use a fraction of RAM.

0

You might have a bottleneck elsewhere - e.g. a database, a shared disk or something

Not the answer you're looking for? Browse other questions tagged .