Weird apache status values with nginx

Hello.

Since I have installed nginx on our dedicated server I’m having some odd
issue. The “cpu usage” and “requests currently being processed” are not
correct on apache-status

A couple of image to see ir clearly. Images from same server at same
time, same accounts and similar traffic:

http://i46.tinypic.com/nbte09.jpg <— good

http://i46.tinypic.com/1jsot5.png <— bad

Please, look at “cpu usage”: u601?? s261?? cu4368?? However, cpu load is
correct

Look at “requests currently being processed”: 4 request only? More than
300 websites at high traffic time and only 4 request? How is it
possible?

Finally, look at cpu load for each vhost (below): 174, 175, 170, etc…

Global cpu load and performance on server is nice. No problem but that
values prevents me know true values.

Any suggestion? Ideas?

Thank you!

Posted at Nginx Forum:

Hello!

On Tue, Jul 17, 2012 at 01:28:22PM -0400, migue76 wrote:

http://i46.tinypic.com/1jsot5.png <— bad

Please, look at “cpu usage”: u601?? s261?? cu4368?? However, cpu load is
correct

Why do you think it isn’t correct? Two days at 3% cpu usage is
something about 5000 cpu seconds.

Keeping in mind that in Apache server status’s “CPU load” is just
(u + s + cu + cs ) / uptime, it’s highly unlikely that cpu usage
stats would be incorrect while cpu load reported is correct.

The fact that Apache’s cpu usage is different from what you have
without nginx might have many reasons. Possible ones are ranging
from incorrect Apache configuration which causes neeedless process
startup/shutdown (which now happens more often due to low worker
process utilization) to just a simple fact that your system
handles more requests now (and consumes more CPU as a result) due
to no longer being limited by some other resource.

Look at “requests currently being processed”: 4 request only? More than
300 websites at high traffic time and only 4 request? How is it
possible?

This is normal, as working with slow clients is offloaded to nginx
now. Apache processes are no longer busy waiting for a client
to sent rest of a request or read another part of a response.

[…]

Maxim Dunin

Thanks for your explanation Maxim.

I think the results are not correct because I switch off nginx and
values come correct again. I swich on nginx and I get weird values. That
is why.

You said:

The fact that Apache’s cpu usage is different from what you have
without nginx might have many reasons. Possible ones are ranging
from incorrect Apache configuration which causes neeedless process
startup/shutdown (which now happens more often due to low worker
process utilization) to just a simple fact that your system
handles more requests now (and consumes more CPU as a result) due
to no longer being limited by some other resource.

Any tip, clue or url to start investigating about this?

This is normal, as working with slow clients is offloaded to nginx
now. Apache processes are no longer busy waiting for a client
to sent rest of a request or read another part of a response.

Thanks! I understand now!

Regards.

Posted at Nginx Forum:

Thank you for your help Maxim.

I’ll try to investigate about your suggestions

Thanks for your support.

Posted at Nginx Forum:

Hello!

On Thu, Jul 19, 2012 at 11:52:00AM -0400, migue76 wrote:

startup/shutdown (which now happens more often due to low worker
process utilization) to just a simple fact that your system
handles more requests now (and consumes more CPU as a result) due
to no longer being limited by some other resource.

Any tip, clue or url to start investigating about this?

I would try to calculate something like “cpu seconds per request”
metric and if it doesn’t match previously seen values - start digging
where additional cpu seconds go. Playing with Apache settings
like MaxClients/MaxSpareServers/MinSpareServers might be helpfull,
as well as monitoring various things like system fork rate and so on.

Note though that some difference is normal, e.g. due to the fact
that nginx doesn’t use keepalive to upstream servers by default.

Maxim D.