server load shooting up

Discussion in 'Site & Server Administration' started by champ_rock, Dec 7, 2007.

  1. #1
    hi

    recently i am facing this problem, the server load on my VPS shoots up to very high levels without any reason.. this screenshot attached is of that a scenario... i ws moitoring.. the server load was fine at 2-3... then only in a few seconds, it increases to 200 :(

    one thing i can see from this is that, there is high SWAP usage. i dont know how this is being used as i have had greater traffic on my proxy with normal loads but this time i do not know what is happening. any suggestions

    [​IMG]

    thanks
     
    champ_rock, Dec 7, 2007 IP
  2. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Looks to me like you're running out of ram as a result the server is using swap which causes high i/o wait levels thus server load goes sky high.

    The strange thing I can see from your TOP is that you have HTTP processes using 4.7%, 5.6%, 5.5% and 6.1% of your ram. Not knowing your configuration entirely, but going based off of what most people have their apache set to I'd say you have yourself a memory leak.
     
    InFloW, Dec 7, 2007 IP
  3. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i cant really be running off the memory bcause i do not have this sudden burst of visitors.. they are decent enough and i have not had this problem before.. (my vps is getting abt 2500 visitors a day these days.. i have had 4000visitors before without any problem)

    what is a memory leak? how to curb it?

    see this screenshot of my server running fine
    [​IMG]
     
    champ_rock, Dec 7, 2007 IP
  4. jexxie

    jexxie Peon

    Messages:
    71
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The memory percentages on your apache processes look quite high -- I would recommend setting your MaxRequestsPerChild to 1000 or so, that way bloated httpd processes will be recycled after too many requests, which helps reduce the impact of the memory-leak.
     
    jexxie, Dec 7, 2007 IP
  5. hostingonweb

    hostingonweb Peon

    Messages:
    47
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Do a "ps -aufx" and check which are the processes and find which file exactly is using so much of your CPU.
     
    hostingonweb, Dec 7, 2007 IP
  6. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #6
    11.16 load average is actually very high (I doubt you have 8+ cpu's available to you but I may be wrong)

    So it looks to me based on your usage you're using all your ram with your apache processes. You only have 256MB of ram so each 16MB process is actually a good junk of your ram.

    As for your CPU usage that is coming from the one httpd process now it could have just been a temporary burst.
     
    InFloW, Dec 8, 2007 IP
  7. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #7
    that CPU usage was a temporary burst
     
    champ_rock, Dec 8, 2007 IP
  8. agnivo007

    agnivo007 Peon

    Messages:
    4,290
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    0
    #8
    You need more RAM...or switch to a lighttpd based system (lxadmin comes free with many VPSs)
     
    agnivo007, Dec 8, 2007 IP
  9. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #9
    in lxadmin u just need to change an option in the panel to shift from apahe to lighttpd.. but when i tried to do the same i am facing this problem

    screenshot attached
    [​IMG]
     
    champ_rock, Dec 8, 2007 IP
  10. combat

    combat Peon

    Messages:
    378
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Cheers, please post your httpd.conf and tell me wich kind of website you have on your vps.
     
    combat, Dec 8, 2007 IP
  11. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #11
    please answer these two questions:
    1. my server admin "thewird" tells me that lighttpd is good for static pages only and performs worse in case of dynamic pages? please suggest

    2. here is my httpd.conf file http://pastebin.ca/809661

    thanks
     
    champ_rock, Dec 8, 2007 IP
  12. combat

    combat Peon

    Messages:
    378
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Do you run a proxy on your vps ?
     
    combat, Dec 9, 2007 IP
  13. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #13
    yes i run proxies on my VPS
     
    champ_rock, Dec 9, 2007 IP
  14. combat

    combat Peon

    Messages:
    378
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #14
    O.k. try this:

    # Timeout: The number of seconds before receives and sends time out.
    #
    Timeout 10
     
    #
    # KeepAlive: Whether or not to allow persistent connections (more than
    # one request per connection). Set to "Off" to deactivate.
    #
    KeepAlive On
     
    #
    # MaxKeepAliveRequests: The maximum number of requests to allow
    # during a persistent connection. Set to 0 to allow an unlimited amount.
    # We recommend you leave this number high, for maximum performance.
    #
    MaxKeepAliveRequests 100
     
    #
    # KeepAliveTimeout: Number of seconds to wait for the next request from the
    # same client on the same connection.
    #
    KeepAliveTimeout 2
     
    ##
    ## Server-Pool Size Regulation (MPM specific)
    ## 
     
    # prefork MPM
    # StartServers: number of server processes to start
    # MinSpareServers: minimum number of server processes which are kept spare
    # MaxSpareServers: maximum number of server processes which are kept spa
    # ServerLimit: maximum value for MaxClients for the lifetime of the server
    # MaxClients: maximum number of server processes allowed to start
    # MaxRequestsPerChild: maximum number of requests a server process serves
    <IfModule prefork.c>
    StartServers         10
    MinSpareServers    10
    MaxSpareServers   20
    ServerLimit           200
    MaxClients            200
    MaxRequestsPerChild  100
    
    Code (markup):
    After this, restart your apache. If your swap goes high again, please go down with your MaxClients a little bit.
     
    combat, Dec 9, 2007 IP
  15. SSANZ

    SSANZ Peon

    Messages:
    861
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #15
    Verify your traffic, looks like your having a burst or even an attack.

    verify - Analyze the traffic/threads/content which is using the most resources and you will find the issue.
     
    SSANZ, Dec 9, 2007 IP
  16. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #16
    am using @Combat's httpd.conf file for some time let see if its works (the real test will be on a monday because weekends are generally fine)

    also, one thing that i found a bit strange was that in my original httpd.conf file KeepAlive was turned "off". i am not sure what it does but could that have been the problem?

    thanks guys for all ur help
     
    champ_rock, Dec 9, 2007 IP
  17. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Keepalive keeps a visitor a connection for an amount of time so that pages load faster for them. It's great for sites with lots of images on pages or when visitors move around a lot. However it does use more memory and can be a real issue if you receive a lot of traffic.


    I think in your case this issue is not going to get fixed with any modifications. You have 256mb of ram here lets be honest that's not very much. Add in the overhead of running other services and you have absolutely no ram for your web server. Upgrade to 512MB and I imagine this issue will go away
     
    InFloW, Dec 9, 2007 IP
  18. champ_rock

    champ_rock Peon

    Messages:
    3,349
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    0
    #18
    i can shut down other unnecessary services as i hardly use this VPS for anything apart from these proxies. just let me know if there is anything running which is not necessary

    thanks
     
    champ_rock, Dec 9, 2007 IP
  19. InFloW

    InFloW Peon

    Messages:
    1,488
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Well looking at your TOP readings almost all of these services are essential.

    There is also overhead with PHP the more modules you have loaded along with the modules loaded on your web server. The amount of work you need to make this thing work on just 256mb of ram could be better spent simply paying to upgrade the amount of ram for your VPS. At a certain point there is nothing you can really do and in this case with the minimal specs I think this is very well the case.
     
    InFloW, Dec 9, 2007 IP