Results 1 to 6 of 6
  1. #1

    Default excessive usage on my server

    hi all -

    i have been receiving nasty-grams from westhost regarding excessive usage.

    in my processor status i see this line:

    USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
    -
    -
    2033 16620 2.7 0.2 43040 22256 ? SNs Jan19 48:15 /usr/sbin/httpd

    the 2.7 is the total cpu usage (2.7%).

    any ideas where i might look to see why this number is so high? should i look in a log file somewhere?

    thanks!

  2. #2
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,721

    Default

    Well if I am reading things right it is Apache that is using the resources so I would say it is more then likely a PHP or other script that is causing it. I would look at maybe both the error logs and the access logs just to see if activity to a certen page/script has increased. That may let you narrow things down. The other thing is to look at anything "new" you have added to the site.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  3. #3

    Default

    well,i did back out a few of the suspected scripts, but that didnt drop the usage any. its been pretty gradual over the past couple of years, or maybe WH never watched it that closely until recently!

    i have been combing through the log files but since i never really studied them before, so i cant really tell if there is anything out of the ordinary or not.

    i was hoping that maybe there was some easy-2-use apache diagnostics.

    one thing i have been doing is looking at the access_log every morning and scanning for "attacks". i have identified about 100 IP numbers that seem to be hitting me pretty hard, but that has not significantly slowed down the high resource number.
    Last edited by PhonemeAnalysis; 01-20-2012 at 07:08 PM.

  4. #4
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,721

    Default

    I assume this is an older Sitemanager account. Go ahead and install Awstats via Sitemanager and use it to review your accesses. That might make it easier for you to see what is going on.

    Check to see if the IP's that are hitting you hard are from a certain country. For example if they all seem to come from russia and you know that you don't have any users from that country you could block access for that countries entire block of IP's. http://www.countryipblocks.net/

    If you are serving dynamic content on the site then make sure you have your scripts updated. Examine what scripts you are using and research to see if there are maybe some alternatives to them that do not take up as much resources. For example both Drupal and Gallery are resource hogs. Do you really need to use them or are there alternatives. Make sure you are keeping databases optimized. Many programs that use them do have ways of optimizing in their backend Admin areas but not all. phpMyAdmin is an easy web interface to your databases or if you are comfortable use the command line to keep your databases healthy.

    The last thing is you mentioned that this has been a gradual growth. Don't rule out the option that the site may have outgrown normal shared hosting.
    Shawn
    Please remember your charity of choice: http://www.redcross.org

    Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson

  5. #5

    Default

    Hey PhonemeAnalysis,

    Here's a couple of suggestions (I'm also assuming you're on site manager, as these suggestions are most applicable to site manager accounts):

    This page has some good info on reducing resource usage:

    http://members.westhost.com/reducing-resources.html

    Something else you might want to try is a repair/optimize of the databases running on your account. I know that ps aux is showing that it's Apache putting the load on the server, but it never hurts to do a repair/optimize. You can do that in phpMyAdmin if you have it installed, by going to the database, scrolling to the bottom and clicking "Check All" then choose "Repair Table" under the "With selected" dropdown. Then repeat, but do an "Optimize table". Alternatively, if you have SSH access, you could run this (just paste it in exactly like this in your SSH client):

    for database in `mysql -N -B -e "show databases;"`; do \
    if [ "$database" != "information_schema" ]; then \
    for table in `mysql -N -B -e "use $database; show tables;"`; do \
    echo "Repairing Table: $database.$table"; \
    `mysql -N -B -e "use $database; REPAIR TABLE $table;" > /dev/null`; \
    done; fi; done; \
    mysqladmin flush-tables;


    That will do a complete repair/optimize on all of your databases.

    I would also recommend running the domain through http://www.websiteoptimization.com/. I've seen some good results come out of there in the past. There's always lots that can be done to optimize a page, and websiteoptimization.com often gives you a good idea as to what can be done to tighten things down.

    If you're still running several applications/scripts/plugins, checking what happens live if you disable them can help narrow things down as well. I would try disabling them one at a time, and then running a ps aux from SSH. If the CPU usage drops, then you've got your culprit.

    Also, I like Shawn's suggestion about checking the locations of the IP's. You can run IP's through here to check their locations:

    http://www.phpace.com/tools/network-...p-to-location/

    The best thing to do with that is to parse the access logs to see which ones are hitting your site the most. You can run this command in SSH to show the top 15 IP's that have been hitting your site:

    cat /var/log/httpd/access_log | awk '{print $1}' | sort | uniq -c | sort | tail -n 15

    You can then see exactly what they're doing with these commands:

    grep [theipaddress] /var/log/httpd/access_log
    zgrep [theiripaddress] /var/log/httpd/access_log.*

    The first will show you the results from the main log, and the second for the archived logs. If you see the top IPs that have been hitting your site possibly loading the same page or URL over and over again, that may be the culprit. For example, if there's a GET request to one particular script over and over again. That script might be what's putting the load on your VPS.

    Anyway, hope that helps a bit!
    Nathan Collings
    Level 2 Technical Support Rep

    http://www.westhost.com/

  6. #6

    Default

    nathan -

    that bash-shell script to loop through all the mysql databases is very COOL !

    very interesting idea to run a repair on the tables.
    Last edited by PhonemeAnalysis; 01-31-2012 at 07:56 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •