Monitoring guide
Apache HTTP Server monitoring
Apache serves until it runs out of workers. mod_status shows busy and idle workers in real time, and the logs explain the slow and failing requests.
4 min read14 sectionsUpdated
On this page
receivers:
apache:
endpoint: http://127.0.0.1/server-status?auto
collection_interval: 60s
exporters:
otlphttp/vitalrix:
encoding: json
metrics_endpoint: ${env:VITALRIX_API}/api/v1/metrics/otlp/v1/metrics
headers: { x-api-key: ${env:VITALRIX_KEY} }
service:
pipelines:
metrics: { receivers: [apache], exporters: [otlphttp/vitalrix] }Apache monitoring with VitalRix
Collector metrics arrive over OTLP and can be charted on dashboards and used in alert rules. A TCP check confirms Apache accepts connections from the network your app uses, and APM traces show which requests wait on Apache and for how long, from the client spans your instrumented services create. Ship access and error logs to log management to search slow and failing requests.
Reading the scoreboard
Each character in the scoreboard is one worker slot: _ waiting for a connection, R reading the request, W sending the reply, K keep-alive, L logging, G gracefully finishing, . an open slot with no process. Many W slots usually mean slow backends or clients; many K slots mean idle keep-alive connections holding workers (consider the event MPM or a shorter KeepAliveTimeout); no _ or . left means you are at capacity.
Choosing the MPM
The event MPM hands idle keep-alive connections to a listener thread, so workers serve active requests only; it suits most modern setups. prefork runs one process per connection and is mainly needed for non-thread-safe modules. Check which one you run with apachectl -V before tuning worker limits.
The Apache metrics that matter
Enable mod_status and read /server-status?auto from localhost only. It reports the worker scoreboard, which is where most Apache incidents show first.
| Metric | Source | Starting alert |
|---|---|---|
| Busy workers vs MaxRequestWorkers | BusyWorkers in server-status | Above 80% for 5 minutes |
| Requests per second | ReqPerSec, or your access log | A drop of more than half against the same hour last week |
| 5xx responses | Access log status field | Above 1% of requests for 5 minutes |
| Response time (p95) | %D (microseconds) in LogFormat | Above your page budget, for example 1 s |
| "server reached MaxRequestWorkers" | Error log | Any occurrence |
<Location "/server-status">
SetHandler server-status
Require local
</Location>
ExtendedStatus On
# time taken per request, in microseconds, at the end of each access log line
LogFormat "%h %l %u %t \"%r\" %>s %b %D" timed
CustomLog logs/access.log timedWhat the incidents look like
- All workers busy. Requests queue, response times climb, then clients time out. Usually slow backends (PHP, a database) holding workers, not more traffic. Raise MaxRequestWorkers only if memory allows; first find what makes requests slow.
- prefork with PHP eating memory. Each prefork child holds a full PHP interpreter. The event MPM with PHP-FPM serves the same traffic with far less memory.
- KeepAlive holding workers. With prefork, a long KeepAliveTimeout ties workers to idle clients; keep it short (2 to 5 seconds) or move to the event MPM.
- Certificates expire on a server nobody touches: add an SSL check next to the uptime check.
Monitor from outside too: an uptime check on a real page catches the case where Apache is up but the application behind it returns errors.
prefork, worker or event MPM?
event is the modern default and handles keep-alive connections efficiently. prefork is needed only for non-thread-safe modules such as mod_php in some setups.
How do I raise MaxRequestWorkers safely?
Check memory per worker under load and make sure the total fits in RAM. Faster backends reduce the workers you need.
Related reading
- Apache "server reached MaxRequestWorkers": how to fix it: Fix Apache server reached MaxRequestWorkers setting: choose the right MPM, calculate workers from memory and move away from mod_php for better concurrency.
- 304 Not Modified: what it means: 304 Not Modified explained: ETag and Last-Modified validation, why it makes pages faster, and fixing stale content or 304s that never refresh.
- Cloudflare error 521: web server is down: Fix Cloudflare error 521 "Web server is down": the origin refused the connection. Check the web server, firewall rules for Cloudflare IPs and DNS.
- Cloudflare error 520: web server returns an unknown error: Fix Cloudflare error 520 "Web server returns an unknown error": empty or reset origin responses, crashes, oversized headers and keep-alive mismatches.
- 500 Internal Server Error: how to find the cause: A 500 error means your code failed. Find the exception behind it fast with logs, traces and error tracking, and learn how to prevent repeats.
- HTTP status codes explained, with fixes for the common errors: HTTP status codes explained by class, with what each common code means and links to step-by-step fixes for 403, 429, 500, 502, 503, 504 and Cloudflare 52x.
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.