#1 (permalink)  
Old 03-25-2007, 09:09 PM
Registered User
 
Join Date: Jan 2007
Posts: 46
babakb is on a distinguished road
httpd processes and server load

Hi,
Occasionally I see some resource intensive httpd processes which spike up the server load for a while. However it's hard to know which web site they belong to because they register under user 'nobody'. Anyone have any tips on finding out which site triggered the httpd process(es)?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-25-2007, 11:37 PM
Registered User
 
Join Date: Mar 2003
Posts: 190
xerophyte
here is a way to find out

Take the process id from top then
Code:
grep $(lsof -p PID | grep cwd | awk '{print $9}' | awk -F '/' '{ print $3 }') /etc/userdomains
on the above code replace the PID with process id, it will give domain name

hope that helps
__________________
http://www.linuxnetworkcare.com/services/cpanel.php
Affordable Linux Server Managament Solution
Order : https://secure.linuxnetworkcare.com
Contact :[ Phone: 647-722-5303 MSN : xerophyte5@hotmail.com AIM : xerophytev]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-26-2007, 03:48 AM
Kailash1's Avatar
Registered User
 
Join Date: Nov 2006
Location: webhostingdiscussion.net
Posts: 225
Kailash1 is on a distinguished road
Thanks,

It worked for me.

Kailash
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-31-2007, 01:19 AM
Registered User
 
Join Date: Jan 2007
Posts: 46
babakb is on a distinguished road
xerophyte,
WOW! That was the single most useful line of script I've ever encountered. Works amazing. I was just getting my feet wet with lsof and taking it from there. Yours takes me from A to Z in one line, genius!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-02-2007, 11:13 AM
Registered User
 
Join Date: Dec 2003
Posts: 18
SpringChicken
Compliments to xerophyte

I would like to post my compliments to xerophyte also. Really amazingly helpful. I've been able to pinpoint and correct a number of faulty scripts on sites.

I am curious about the possibility of creating a log from this info for all processes running above 5 %CPU ? Would someone know how to do this ?

thanks again for sharing xerophyte
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-02-2007, 02:54 PM
Registered User
 
Join Date: Jan 2007
Posts: 46
babakb is on a distinguished road
Quote:
Originally Posted by SpringChicken View Post
I would like to post my compliments to xerophyte also. Really amazingly helpful. I've been able to pinpoint and correct a number of faulty scripts on sites.

I am curious about the possibility of creating a log from this info for all processes running above 5 %CPU ? Would someone know how to do this ?

thanks again for sharing xerophyte
Good idea. You could write a small script (PHP would do) that extracts the output of the CPU & PID columns from a 'ps' and logs the user for those httpd processes which CPU >5%. Then set it up to run as a cron every few minutes. If I find the time I'll try to write up such script, shouldn't be too hard.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-02-2007, 03:04 PM
Registered User
 
Join Date: Jan 2007
Posts: 46
babakb is on a distinguished road
I'm thinking it would be better to show the file being accessed by the httpd process. That way we know which script is eating up the resources. Any ideas on which parameters to modify on xerophytes line of script?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-02-2007, 04:39 PM
Senior Member
 
Join Date: Jun 2005
Location: Area 51
Posts: 1,648
Spiral is on a distinguished road
Cool

Quote:
Originally Posted by babakb View Post
Hi,
Occasionally I see some resource intensive httpd processes which spike up the server load for a while. However it's hard to know which web site they belong to because they register under user 'nobody'. Anyone have any tips on finding out which site triggered the httpd process(es)?

Thanks.
1) I would upgrade to phpSuExec or SuPHP so that scripts no longer run as "nobody"

2) When you note higher loads, it's a good idea to go ahead and login to WHM and
check your "Apache Status" which will show you what files are currently being accessed
on your web server and give you a clue where to look.

3) In SSH, you can follow up and go to /etc/httpd/domlogs and review the access logs
for those sites you noted as the most active in WHM's "Apache Status"

4) If you run "top" in SSH, you can see which processes are the most active and type
"m" to sort by memory usage or "p" to sort by cpu usage. The process ID shown
in "ps" or in "top" can be matched up to the process ID in your apache status too.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-03-2007, 06:25 AM
Registered User
 
Join Date: Jan 2007
Posts: 46
babakb is on a distinguished road
Spiral, thank you, those are great tips
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 05-01-2007, 08:20 AM
Registered User
 
Join Date: Oct 2004
Location: INDIA
Posts: 106
useradmin is on a distinguished road
apache load

HI,


Apache is taking load more then 600 cpu but apache status or proc show like tihs.

rwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /
lrwxrwxrwx 1 root root 0 May 1 06:18 cwd -> /

how to trace such load?
__________________
!! IF YOU DO FOR OTHERS, OTHERS WILL DO FOR YOU !!

Thank you.....

...................
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 08:58 AM.


Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© cPanel Inc