Confusing CPU load in apache server-status

apache-2.2

apache server-status ( mod_status ) shows very low CPU usage even though I'm seeing more than 90% in top output.

Shown in server-status page:

CPU Usage: u92.17 s14.87 cu0 cs0 - .0178% CPU load

From top output:

1187 apache    20   0  439m 204m 6000 S 23.2  6.8   0:24.52 /usr/sbin/httpd

Why does this happens ? Cant we use the server-status page to check the apache CPU usage ?

( top output shown is not full, as it has lot of http process running and has many CPU … Even though it crosses a cumulative of 300% it still shows 0.224% in server-status page ! )

Kindly note It is not the same as like this confusing result on Apache server status results

Best Answer

Two things which may help you understand what you're seeing:

  1. The 0.0178% load from server-status is the average CPU load since Apache was started. It simply won't pick up spikes in CPU usage like what you seem to be seeing in top. From your numbers I would guess Apache was started roughly 7 days ago ( (92.17+14.87)/0.0178*100/86400=6.96).
  2. There will likely be multiple "http" processes listed in top, at least in prefork mode (unsure about worker mode). One of these will be the "parent" process and the rest are all its children serving requests as needed. Some children may have more CPU/memory usage than others.

The CPU usage from server-status is useful as an average guide to how much CPU Apache is using but mostly useless for recognizing load spikes of which top is much more useful.