Skip to content

Troubleshooting guide

Apache "server reached MaxRequestWorkers": how to fix it

Every Apache worker is occupied and new connections must wait. Often the design, using prefork with mod_php, is the real limit.

3 min read10 sectionsUpdated

On this page

Key points

  • The event MPM frees workers during keep-alive.
  • mod_php forces prefork, at a high memory cost.
  • Calculate from real process size.
  • mod_status shows the scoreboard.

What it means

Apache has a limit on simultaneous requests. When reached, new connections wait in the listen backlog and users see slowness or timeouts. The error log notes it once: "server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting".

Common causes

  • Slow scripts or queries that hold workers.
  • prefork with keep-alive, tying up a whole process per idle connection.
  • A traffic spike or a bot crawl.
  • The limit is simply too low for the host.

Diagnose it

The scoreboard shows what workers are doing, and process size shows how many you can afford.

bash
# Active MPM and limits
apachectl -V | grep -i mpm
apachectl -t -D DUMP_RUN_CFG | head

# Enable mod_status, then read the scoreboard
curl -s 'http://127.0.0.1/server-status?auto' | grep -E 'BusyWorkers|IdleWorkers|Scoreboard'

# Average process size (MB)
ps -ylC apache2 --sort=rss | awk 'NR>1 {s+=$8; n++} END {print s/n/1024 " MB"}'

Fixes

Switch to mpm_event with PHP-FPM, so workers are not held by idle connections or by PHP's memory footprint. Set MaxRequestWorkers using the formula (RAM available) / (process size), as exceeding memory causes swapping. Reduce KeepAliveTimeout to a few seconds under prefork. Find slow requests in the scoreboard or the logs, and add caching. After changing MPM, restart Apache fully rather than reloading, and confirm the change with apachectl -V. Check afterwards that your modules are thread-safe under the event MPM.

Reading the scoreboard

Each character is one worker: W writing a reply, R reading a request, K in keep-alive, _ idle, and . an open slot. Many Ws suggest a slow application. Many Rs suggest slow clients or an attack, and mod_reqtimeout will help. Many Ks under prefork mean idle browsers are holding your most expensive resource, and the event MPM eliminates that. Check too that your ServerLimit allows the value, as MaxRequestWorkers cannot exceed the product of ServerLimit and ThreadsPerChild.

Catch it automatically

Export BusyWorkers and alert before saturation. Apache monitoring tracks workers and request rate. Add an uptime check to verify what visitors see.

Frequently asked questions

Which MPM should I use?

Event, unless a non-thread-safe module forces prefork.

What should MaxRequestWorkers be?

As many as memory allows, based on real process size.

Is Apache slower than Nginx?

Tuned with event MPM and PHP-FPM, the difference is often small.

Watch your own site and services with VitalRix

Uptime checks, APM, logs, real-user monitoring, alerts and status pages in one place. Every product has a free tier and no credit card is needed.