Portal Home > Knowledgebase > Articles Database > Server load, and tracing httpd processes


Server load, and tracing httpd processes




Posted by Kadence, 02-28-2008, 06:53 PM
I have a server that has server load showing at 25-40 (once it was even 53!), running like that for hours. The server has 4 cpus - and yet the sites on the server seem to run fine when I check them. What I'm wondering is, what exactly is load in this context; and how can load run so high like that without the server crashing? According to top, the load is caused by httpd processes running under user 'nobody', that often take up double digit CPU percentage. Does Apache always run under 'nobody'?Is there any way to trace an httpd processes - which account it's for, or which physical script or URL is calling it? And for top itself, the TIME field on one server of mine is in the format xx:xx (e.g. 3:25), on another it's TIME+ and in the format xx:xx.xx (e.g. 30:02.77). What exactly does this mean? I would asume it's minutes:seconds and minutes:seconds:hundredths, but while watching top it doesn't seem to correlate with that.

Posted by david510, 02-28-2008, 09:52 PM
Did you try checking apache status page? ps -ylC httpd --sort:rss From the above command you will get an idea of how much memory each thread is using, from the RSS column.

Posted by Kadence, 02-28-2008, 10:54 PM
Thanks for the reply, but I don't really care about the memory, the memory use % doesn't seem to be an issue. Just the cpu. I normally use ps -axuf|more, but that doesn't seem to give any additional details about httpd processes than top. And it looks like apache did eventually end up crashing due to the load, but it took a long while, and a simple restart fixed it.

Posted by joeshacks, 02-29-2008, 12:22 AM
if it comes back, you could try enabling server-status with the ExtendedStatus in your httpd.conf file, then you can use your browser to view the server status.. this will associate the scripts and virtual host associated with the process.

Posted by cywkevin, 02-29-2008, 12:46 AM
Are you using an MPM with apache if you are using the 2x trees? If not consider using MPM Worker it's designed to be threaded which should work well on your 4 core server. That said it's also possible that it's a php script if you're running mod_php .

Posted by Kadence, 02-29-2008, 11:03 AM
I see that "ExtendedStatus On" is already present in httpd.conf, but I found documentation which saidNothing about virtual host association. How does one approach the virtual host association using this directive? I don't believe MPM is enabled, where do I find out more about how to turn that on? And it should definitely be a PHP script, all sites are coded in PHP. I want to know how I can figure out which specific script(s) it is so I can deal with the issue by reprogramming or disabling the script or something.

Posted by HostRefugee-Vince, 02-29-2008, 12:10 PM
If you have a httpd process that is consuming alot of CPU and running for quite a while, first make note of the process ID # and then run this: lsof | grep 20232 > output.txt 20232 would be replaced with the actual process id. Then: nano -w output.txt Pay attention to the first 2 or 3 lines in that file, sometimes your able to see what script, or at least the directory of the script that is consuming the CPU.

Posted by Kadence, 03-01-2008, 09:24 AM
Thanks, that was helpful. Anybody know about: Does Apache always run under 'nobody'?What units the TIME and TIME+ fields for top are in?Anything about ExtendedStatus and virtualhost association?

Posted by serverdoctor, 03-01-2008, 10:30 AM
Typically nobody is used, but Apache will run as whichever user you configure it for. You can explicitly specify a user to run httpd as through the User directive in httpd.conf: httpd.apache.org/docs/2.2/mod/mpm_common.html#user httpd will run as the user specified in the global User definition (outside of any virtualhost containers) Your extendedstatus questions can be answered at: httpd.apache.org/docs/2.2/mod/mod_status.html

Posted by Kadence, 03-01-2008, 06:51 PM
Thank you joeshacks and serverdoctor, server-status with ExtendedStatusOn showed exactly the info I was looking for! The Vhost and Request fields, which show the domain, and request details (e.g. domain.com, GET index.php) associated with a PID. And I found out this can be done from the command line with 'httpd fullstatus'. Though it seems Request details are truncated to 63 characters total. Anyone know if that can be changed? Also is there any way to view this with top's %CPU information? (the CPU column here is seconds)

Posted by Kadence, 03-03-2008, 12:20 AM
Actually I'm not entirely sure what the CPU column in server-status is. It says "CPU usage, number of seconds", but it doesn't change as if it was seconds. What does it really mean?

Posted by Kadence, 03-07-2008, 04:20 PM
Anybody know what the CPU column in server-status, and the TIME/TIME+ fields for 'top' actually mean?



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Port scanning issues (Views: 732)


Language: