Community Forums
Connect with us on LinkedIn
Community Notice
+ Reply to Thread
Results 1 to 10 of 10
  1. #1
    Member
    Join Date
    Jan 2007
    Posts
    46

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

  2. #2
    Member
    Join Date
    Mar 2003
    Location
    Canada
    Posts
    217

    Default

    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
    Affordable Linux Server Managament Solution
    http://www.linuxnetworkcare.com/services/cpanel.php
    [ Phone: 647-722-5303 MSN : sutha@linuxnetworkcare.com AIM : xerophytev skype:ksutha5]

  3. #3
    Member Kailash1's Avatar
    Join Date
    Nov 2006
    Location
    webhostingdiscussion.net
    Posts
    225
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Thanks,

    It worked for me.

    Kailash

  4. #4
    Member
    Join Date
    Jan 2007
    Posts
    46

    Default

    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!

  5. #5
    Member
    Join Date
    Dec 2003
    Posts
    18

    Default 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

  6. #6
    Member
    Join Date
    Jan 2007
    Posts
    46

    Default

    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.

  7. #7
    Member
    Join Date
    Jan 2007
    Posts
    46

    Default

    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?

  8. #8
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    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.

  9. #9
    Member
    Join Date
    Jan 2007
    Posts
    46

    Default

    Spiral, thank you, those are great tips

  10. #10
    Member
    Join Date
    Oct 2004
    Location
    INDIA
    Posts
    107

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

    ...................

Similar Threads & Tags
Similar threads

  1. httpd processes, memory and high server load
    By mehrdad abed in forum New User Questions
    Replies: 1
    Last Post: 06-13-2009, 11:06 AM
  2. Limit httpd processes because of high load averages
    By patriothosting in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 04-07-2007, 09:55 PM
  3. httpd-nobody processes with high load
    By ramil in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 11-28-2006, 12:34 PM
  4. old httpd processes loading the server
    By ZapX.net in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 04-15-2005, 05:23 PM
  5. Server Load and Runaway processes
    By pguy in forum cPanel and WHM Discussions
    Replies: 17
    Last Post: 07-02-2003, 10:49 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube