WEB What would cause my server to go super slow?

Discussion in 'OT Technology' started by Ricky, Feb 18, 2009.

  1. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i have about 3 sites on here for now.

    ATM there isnt much traffic going. Maybe 10 users, yet it's going super slow on all 3 servers.

    I doubt its the host, since they're pretty reliable.

    [​IMG]

    What should i be looking at in this linux server?
    The processes?
    Code:
     PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND           
    13762 apache    15   0 20288 6604 3132 S    1  0.1   0:01.45 httpd              
    14312 apache    15   0 20288 7212 3740 S    1  0.1   0:00.51 httpd              
    18345 apache    15   0 20928 7220 3108 S    1  0.1   0:00.64 httpd              
    19827 apache    15   0 20328 6436 2964 S    1  0.1   0:00.05 httpd              
    32699 apache    15   0 20700 7620 3736 S    0  0.1   0:00.63 httpd              
    13785 apache    15   0 20320 7204 3732 S    0  0.1   0:00.73 httpd              
    19679 apache    18   0 20216 6296 2972 S    0  0.1   0:00.08 httpd              
    19723 apache    15   0 20844 6996 3096 S    0  0.1   0:00.27 httpd              
    19774 apache    15   0 20096 6276 3068 S    0  0.1   0:00.05 httpd              
        1 root      18   0  1988  652  560 S    0  0.0   0:01.47 init               
     9702 root      15   0  1652  568  472 S    0  0.0   0:00.34 syslogd            
     9705 root      25   0  1600  404  336 S    0  0.0   0:00.00 klogd              
     9760 root      15   0  6972 1060  672 S    0  0.0   0:00.08 sshd               
     9770 root      25   0  2644  856  688 S    0  0.0   0:00.00 xinetd             
     9820 root      15   0  3212 1108  576 S    0  0.0   0:00.23 crond              
    11321 root      18   0  2380 1140  976 S    0  0.0   0:00.00 mysqld_safe        
    11365 mysql     15   0  110m  18m 4804 S    0  0.2   0:12.59 mysqld             
    the httpd config file (which is pretty default except the 3 virtual hosts i added)??

    the memory? (supposed to have 256)
     
    Last edited: Feb 19, 2009
  2. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
    See post below.
     
    Last edited: Feb 19, 2009
  3. crazybenf

    crazybenf Active Member

    Joined:
    Nov 14, 2001
    Messages:
    15,575
    Likes Received:
    2
    install bmon as well to see what you have going in&out.


    post up free, w, top, bmon screen caps.
     
  4. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    okay will do
     
  5. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    damn bmon site is down.

    i just submited a ticket with my vps. i'll have them look into wht you pointed out hank.

    thanks

    it's centos 5

    apache 2.2.3
     
  6. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i was told by their support to use this instead

    [​IMG]
     
  7. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
    Ricky,

    Alright, my first suspicion was that your VPS was setup incorrectly, from this table we can rule that out completely.

    You are guaranteed 268MB ram with no burst. The failcnt column form the privvmpages means you've got processes or daemons running on your VPS that are pushing you above your memory limit and are being forcibly killed off. So we're gonna have to start digging to see what is being killed, if it's even necessary to have running on your system and if it is, to see if we can limit the amount of memory that it uses.

    If this is a constant problem where all your sites are running slow, always, type:

    'ps aux | sort -nk +4 | tail' if for whatever reason the previous command doesn't work for you use 'ps axfuw' instead

    and also

    'top' and press m once top has shown it's goods.

    Copy/paste results in here.

    If your sites are running fine for a while, then slow down, type the above commands when you're running into trouble so we can narrow down what's taking up your resources under load.

    Any web hosting software? cPanel, Plesk, etc. etc.

    EDIT: Of course, you can take the easy way out and just order more ram for your VPS. :wiggle:
     
    Last edited: Feb 19, 2009
  8. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    no cpanel/plesk etc

    it's always slow now. even with little bit of load

    [​IMG]
    [​IMG]
     
  9. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
    Apache is starting too many child servers. Since this is a low traffic site you will be safe with settings such as:

    Maximum spare server processes 5
    Minimum spare server processes 2
    Initial server processes 3

    The above is an extremely safe number, while your sites have low traffic response should be good. But when you gain traffic you will again see a decrease in performance, but this time not because of memory allocation issues but because of Apache request queuing. When this happens, tweak settings again. You will eventually need to upgrade the ram on this VPS though.

    Restart Apache after you've made the correct changes, and keep an eye on top and free -mh
     
  10. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    will i be making these changes for

    <IfModule prefork.c>


    or

    <IfModule worker.c>
     
  11. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i changed both and it seems to fix it :bowdown:

    :love:
     
  12. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
    Woot, congrats!

    To answer this question, it depends on how Apache was compiled on your system, the --with-mpm= directive will show you which settings are actually in use.

    Take this with a grain of salt because I don't know how it affects a VPS but prefork is said to be better with single and dual core systems while worker is better with multi-core systems.
     
  13. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
    Also, you might want to reboot the server and keep an eye on beancounters to see if you're performing withing the limits of the VPS.
     
  14. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    i up'd the ram to 512. didn't really help much.

    i changed those settings which you recommended and it helpd a bit for a little then went back slow.

    now i noticed when i do a TOP it shows like 20 httpd processes, but i only have like 4 users on my site right now. What gives?
     
  15. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
    What are your settings for keep-alive?
     
  16. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    everything is default

    Code:
    # Timeout: The number of seconds before receives and sends time out.
    #
    Timeout 120
    
    #
    # KeepAlive: Whether or not to allow persistent connections (more than
    # one request per connection). Set to "Off" to deactivate.
    #
    KeepAlive Off
    
    #
    # 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 15
     
  17. hank85

    hank85 sudo shred /dev/sda -f -v -z --iterations=6

    Joined:
    Jul 23, 2008
    Messages:
    4,360
    Likes Received:
    0
    Hmm, I'm at a loss man. Unless I get in there and fidget around a bit I don't think I'll be much help to you anymore.

    PM or IM me the creds if you're up to it and I'll take a look.
     
  18. Ricky

    Ricky █▄ █▄█ █▄ ▀█▄

    Joined:
    Jun 17, 2005
    Messages:
    38,767
    Likes Received:
    6
    pm'd

    thanks
     

Share This Page