Skip to content

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

Key points

  • Busy workers near MaxRequestWorkers means requests will queue.
  • The scoreboard shows what workers are doing.
  • Log %D (microseconds) to get response times.
  • PHP and proxied apps behind Apache need their own monitoring.

Enable modstatus

status.confplaintext
<Location "/server-status">
    SetHandler server-status
    Require ip 127.0.0.1
</Location>
ExtendedStatus On
bash
curl -s "http://127.0.0.1/server-status?auto"
# Total Accesses, ReqPerSec, BusyWorkers, IdleWorkers, Scoreboard: ___KW_____...

What to watch

MetricWorry when
BusyWorkers vs MaxRequestWorkersClose to the limit
IdleWorkersNear zero during normal traffic
Requests per secondUnexpected drops or spikes
5xx share in access logsAbove 1 to 2%
Response time (%D)p95 rising
Error log entries"server reached MaxRequestWorkers" messages

Response times in the access log

plaintext
LogFormat "%h %t \"%r\" %>s %b %D \"%{User-Agent}i\"" timed
CustomLog logs/access_log timed

Collecting metrics

otel-collector.yamlyaml
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.

Alerts to start with

  • Busy workers above 90% of MaxRequestWorkers for 5 minutes.
  • "server reached MaxRequestWorkers" in the error log.
  • 5xx share above 1 to 2% in access logs.
  • p95 of %D above target.
  • An uptime check on each virtual host from outside.

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.

MetricSourceStarting alert
Busy workers vs MaxRequestWorkersBusyWorkers in server-statusAbove 80% for 5 minutes
Requests per secondReqPerSec, or your access logA drop of more than half against the same hour last week
5xx responsesAccess log status fieldAbove 1% of requests for 5 minutes
Response time (p95)%D (microseconds) in LogFormatAbove your page budget, for example 1 s
"server reached MaxRequestWorkers"Error logAny occurrence
plaintext
<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 timed

What 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.

Frequently asked questions

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.

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.