High VPS load. Rebooting again and again :(

Discussion in 'Site & Server Administration' started by champ_rock, Sep 28, 2007.

  1. #1
    hi

    my VPS is down for the past few hours and whenever i try to bring it up it automatically goes down again :(

    my server admin says that my scripts are using too much CPU usage (i dont think this is possible because i have not made any changes to anything for the past 3 months and my scripts have never given me any problems in the past). so i doubt today all of a sudden, its the scripts which are causing problems

    here is my top log
    top - 19:07:41 up 31 min,  1 user,  load average: 0.24, 0.39, 0.28
    Mem:    262316k total,   240536k used,    21780k free,    17528k buffers
    Swap:   131064k total,        0k used,   131064k free,   100596k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
     1754 apache    15   0 24364  11m 4724 S  0.3  4.3   0:17.26 httpd
     1750 apache    15   0 23848  10m 4624 S  0.7  4.0   0:17.12 httpd
     1744 apache    15   0 23848  10m 4652 S  0.0  4.0   0:16.88 httpd
     1747 apache    15   0 23852  10m 4648 S  1.7  4.0   0:16.74 httpd                                     1748 apache    15   0 23856  10m 4588 S  0.7  4.0   0:16.36 httpd
     1758 apache    15   0 23848  10m 4652 S  1.0  4.0   0:16.05 httpd                                     1749 apache    15   0 23860  10m 4616 S  4.0  4.0   0:15.58 httpd
     1745 apache    15   0 24360  10m 4652 S  0.0  4.3   0:14.68 httpd                                     1761 apache    15   0 24620  11m 4632 S  7.0  4.4   0:14.41 httpd
     1751 apache    15   0 24368  10m 4640 S  0.0  4.3   0:13.96 httpd                                     1746 apache    15   0 25912  12m 4700 S  0.0  4.9   0:13.21 httpd
     1755 apache    15   0 24360  10m 4664 S  0.0  4.3   0:13.08 httpd                                     1764 apache    15   0 22976 9800 4648 S  1.7  3.7   0:11.30 httpd
     1821 apache    15   0 24344  10m 4156 S  1.7  4.1   0:03.42 httpd                                     1823 apache    15   0 23824 9.9m 4216 S  0.0  3.9   0:03.12 httpd
     1822 apache    15   0 24344  10m 4200 S  0.0  4.1   0:02.67 httpd                                     1824 apache    15   0 22608 8992 4208 S  2.0  3.4   0:02.50 httpd
     1827 apache    15   0 22956 9380 4204 S  0.7  3.6   0:01.44 httpd                                     1830 apache    15   0 22096 8308 4148 S  1.3  3.2   0:00.86 httpd
     1832 apache    15   0 22436 8656 4156 S  0.3  3.3   0:00.76 httpd                                     1831 apache    15   0 22436 8636 4148 S  1.3  3.3   0:00.56 httpd
     1835 apache    15   0 23768 9868 4112 S  8.0  3.8   0:00.27 httpd                                     1735 root      18   0 21404 8552 5196 S  0.0  3.3   0:00.11 httpd
     1801 root      15   0  1948 1000  772 S  0.0  0.4   0:00.10 top                                       1798 root      15   0  1948 1004  772 R  0.0  0.4   0:00.09 top
      996 root      18   0  4004 1100  816 S  0.0  0.4   0:00.08 sshd                                      1668 root      15   0  7004 2176 1760 R  0.0  0.8   0:00.03 sshd
        1 root      15   0  1684  644  564 S  0.0  0.2   0:00.02 init                                        77 root      15   0     0    0    0 S  0.0  0.0   0:00.02 pdflush
    
    Code (markup):
    please tell if u can find anything :)
     
    champ_rock, Sep 28, 2007 IP
  2. tanfwc

    tanfwc Peon

    Messages:
    579
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Your server administrator should able to tell you what's going on. By showing us the output, I can see that you have some memory shortage and nothing else.
     
    tanfwc, Sep 28, 2007 IP
  3. seo_chatbox

    seo_chatbox Peon

    Messages:
    60
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think there is to need to upgrade your hosting plan. You can contact your hosting company if this problem persists again and again.
     
    seo_chatbox, Sep 28, 2007 IP
  4. seo5000

    seo5000 Peon

    Messages:
    2,026
    Likes Received:
    231
    Best Answers:
    0
    Trophy Points:
    0
    #4
    How many sites do you have on the server in total!!

    Do you have any Forum, Proxy, or Social Bookmark sites on it??
     
    seo5000, Sep 28, 2007 IP
  5. chickens

    chickens Peon

    Messages:
    242
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You have load averages of under 0.5, clearly it is not a CPU usage issue. The problem I see is apache not configured properly. Apache is spawning a ton of processes for no reason. These processes take up a ton of memory and do not help all that much. In your httpd.conf file I would set the following settings:
    This tells apache the minimum and max number of processes it can use. if the server is idle it will only have one active process, while if there is a huge spike it will start up 20.

    Right below those settings is StartServers section, this sets the number of processes to start up when the server starts. You will need to tweak with this number for the activity of your server. The ideal number on my VPS is 5.

    The next two settings define how much traffic each child process handles. MacClients defines the maximum number of requests you will allow the server to handle at any point in time. The higher this number the more likly your server will overload, the lower the higher the odds of users receive an error stating that the server can not complete the request. Mine is set to 250

    Then there is MaxRequestsPerChild; this is the setting telling apache how many requests the process can take before ending and starting new. What this does is limits the amount of RAM any process will use. If you allow too many connections to be in the memory it will overload, too few and data might be lost. For static pages this number can be rather low, for ajax style sites the number should be higher. Mine is set to 1000

    You might look for an apache for VPS guide or 10 and find the best settings for yourself. The default apache configuration is far from ideal.
     
    chickens, Sep 28, 2007 IP
  6. Technojoint

    Technojoint Peon

    Messages:
    642
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I think you should fix the apache and .htdocs

    your server restarting because apache, yes... do you have any overloadable site ? It's seems to happend with me when last week I have loaded a news site in my server but everything seems be ok after i thinned my apache.

    Regards,
    Tj
     
    Technojoint, Oct 10, 2007 IP
  7. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #7
    i am looking for a shell script that will restart some basic services at given intervals.

    I am looking to restart mysql service, lighttpd service, ftp service, and any other service that you think is critical to the working of a VPS (i have a proxy network)

    I am looking for this script becasue my proxies sometimes tend to overload the server due to which the server crashes. will this script work in this scenario??

    please post the exact coding because i am a noob to linux command line and will probably get more confused if there are any changes that need to be made

    also, is it possible to send a mail of its results to my email id? if so, how to do it (if it requires relatively simple coding)

    thanks a lot
     
    champ_rock, Oct 14, 2007 IP
  8. tanfwc

    tanfwc Peon

    Messages:
    579
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Well, I can write this scripts if I am been paid :)
     
    tanfwc, Oct 14, 2007 IP
  9. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #9
    thanks a lot for that but i am not in a position to pay u right now

    shortage of funds :(
     
    champ_rock, Oct 14, 2007 IP