Apache MaxClients Saturated
Resolve Apache connection saturation.
When Apache reaches MaxClients (or MaxRequestWorkers in MPM event), new connections are queued then timeout. Your site becomes inaccessible while the server doesn't seem overloaded.
Symptoms
- Connections that timeout without server error
- "MaxRequestWorkers" messages in logs
- Server responding slowly then not at all
- CPU and RAM correct but site inaccessible
Common Causes
- MaxClients too low: Default configuration is often insufficient.
- Slow requests: Slow scripts monopolize workers.
- KeepAlive too long: Connections stay open too long.
Diagnostic Steps
- Check Apache logs for "MaxRequestWorkers"
- Examine Apache process count (ps aux | grep apache)
- Check current MPM configuration
- Analyze slow requests (mod_status)
Automate with MoniTao
MoniTao detects saturation:
- Alerts on connection timeouts
- Response time monitoring
- History to identify spikes
Best Practices
- Calculate MaxRequestWorkers based on available RAM
- Use MPM event rather than prefork if possible
- Reduce KeepAliveTimeout to 2-5 seconds
- Put a reverse proxy (Nginx) in front of Apache
FAQ
How to calculate MaxRequestWorkers?
(Available RAM - OS - DB) / memory per worker. Typically 150-300.
Difference between prefork and event?
Event handles KeepAlive connections better with less resources.
Should I disable KeepAlive?
No, just reduce the timeout. KeepAlive improves performance.
Does MoniTao detect this problem?
Yes, via connection timeouts and degraded response times.
Useful Links
Ready to Sleep Soundly?
Start free, no credit card required.