Signs Apache Server is Running Out of Connections?
Identifying when an Apache HTTP server is running out of available
connections is crucial for maintaining website uptime and performance.
When Apache reaches its connection limits, typically defined by
directives like MaxRequestWorkers or
MaxClients, it can no longer handle incoming traffic
efficiently. This article provides a quick overview of the key
performance indicators, error logs, and system behaviors that signal
your server has hit its concurrent connection ceiling, helping you
diagnose and resolve the bottleneck before it leads to a total
outage.
1. Distinct HTTP Error Codes and Browser Symptoms
The most immediate sign of a connection shortage is how the server responds to external users. When Apache’s connection queue fills up completely, users will experience noticeable disruptions:
- HTTP 503 Service Unavailable: The server is too busy to handle the request.
- Connection Timeouts (HTTP 504): Browsers will spin indefinitely before failing, as the server drops or ignores new TCP handshake requests.
- Intermittent Dropped Connections: The site may load perfectly for one user but completely fail for another, depending on who claims a free slot first.
2. Specific Error Log Messages
Apache explicitly logs connection capacity issues. Monitoring your
error.log file is the most definitive way to confirm this
problem. Look for the following signature warning strings:
[warn] server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting[error] server reached MaxClients setting, consider raising the MaxClients setting(on older Apache versions)Connection refusedorServer closed the connection unexpectedlyinterspersed throughout the logs.
3. High Number of “Writing” or “KeepAlive” States in Server Status
Enabling the mod_status module allows you to view the
live scoreboard of Apache workers. If you access the
/server-status page during a slowdown, you will typically
observe:
- Zero idle workers available.
- A scoreboard completely filled with letters like
W(Sending Reply),K(Keepalive), orR(Reading Request). - The total number of active requests perfectly matching the maximum limit configured in your MPM (Multi-Processing Module) settings.
4. Spikes in Resource Utilization and Network Queues
When Apache is starved for connections, the underlying operating system will reflect the strain. You can detect this through standard command-line diagnostic tools:
- Memory and CPU Exhaustion: If using the
preforkMPM, a surge in connections creates a massive spike in RAM usage as dozens of new Apache processes spawn simultaneously. - Saturated Netstat Queues: Running
netstat -an | grep :80 | wc -l(or port 443) will show a number equal to or higher than your maximum worker limit, alongside a large volume of connections stuck in theSYN_RECVorTIME_WAITstates.