Results 1 to 9 of 9
  1. #1

    High serverload - Help to optimize

    My serverload gets high, and i hope to get some comments here.
    Is it httpd that is the problem ?


    Some information, let me know if i should post any more

    Top output :


    top - 15:59:10 up 2:36, 1 user, load average: 3.52, 3.98, 3.92
    Tasks: 267 total, 7 running, 260 sleeping, 0 stopped, 0 zombie
    Cpu(s): 86.7% us, 9.6% sy, 0.0% ni, 0.0% id, 0.0% wa, 1.2% hi, 2.4% si
    Mem: 1490224k total, 1408208k used, 82016k free, 98472k buffers
    Swap: 1052248k total, 0k used, 1052248k free, 731240k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    7779 apache 16 0 30752 21m 9.9m R 19.6 1.5 0:16.60 httpd
    7762 apache 15 0 30624 21m 9.9m S 13.5 1.5 0:17.97 httpd
    7750 apache 15 0 30544 20m 9.9m S 6.1 1.4 0:17.19 httpd
    7772 apache 15 0 30008 20m 9.9m S 6.1 1.4 0:16.97 httpd
    7776 apache 15 0 29356 20m 10m S 6.1 1.4 0:16.12 httpd
    3925 mysql 15 0 383m 146m 1952 S 3.7 10.1 0:03.12 mysqld
    7753 apache 15 0 31180 21m 9.9m S 3.7 1.5 0:17.88 httpd
    7756 apache 15 0 29812 20m 10m S 3.7 1.4 0:17.77 httpd
    7757 apache 15 0 31788 22m 10m S 3.7 1.5 0:17.96 httpd
    7759 apache 15 0 30420 20m 10m S 3.7 1.4 0:17.30 httpd
    7777 apache 15 0 30628 20m 9.9m S 3.7 1.4 0:16.78 httpd
    7789 apache 15 0 30420 20m 9.9m S 3.7 1.4 0:16.62 httpd
    3792 mysql 16 0 383m 146m 1952 S 2.4 10.1 0:02.09 mysqld
    7758 apache 16 0 29580 19m 9.9m R 2.4 1.4 0:15.24 httpd
    7761 apache 15 0 29664 20m 9.9m S 2.4 1.4 0:16.38 httpd
    7769 apache 15 0 30136 20m 10m S 2.4 1.4 0:17.25 httpd
    7780 apache 15 0 29584 19m 9.9m S 2.4 1.4 0:17.59 httpd
    7907 apache 15 0 28920 19m 10m S 2.4 1.3 0:13.97 httpd
    8496 apache 15 0 25164 15m 9956 S 2.4 1.1 0:00.09 httpd
    3898 mysql 15 0 383m 146m 1952 S 1.2 10.1 0:03.14 mysqld
    7787 apache 15 0 29164 19m 9.9m S 1.2 1.4 0:18.34 httpd
    7790 apache 15 0 28780 19m 10m S 1.2 1.3 0:16.02 httpd
    7793 apache 15 0 29904 20m 9.9m S 1.2 1.4 0:16.97 httpd
    8499 root 16 0 2788 1072 756 R 1.2 0.1 0:00.14 top
    1 root 16 0 3300 552 472 S 0.0 0.0 0:00.30 init
    2 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
    3 root 5 -10 0 0 0 S 0.0 0.0 0:00.00 events/0
    4 root 7 -10 0 0 0 S 0.0 0.0 0:00.00 khelper
    5 root 15 -10 0 0 0 S 0.0 0.0 0:00.00 kacpid
    25 root 5 -10 0 0 0 S 0.0 0.0 0:00.00 kblockd/0
    35 root 20 0 0 0 0 S 0.0 0.0 0:00.00 pdflush
    36 root 15 0 0 0 0 S 0.0 0.0 0:01.12 pdflush
    38 root 14 -10 0 0 0 S 0.0 0.0 0:00.00 aio/0

    httpd.conf
    KeepAlive On
    MaxKeepAliveRequests 120
    KeepAliveTimeout 2
    MinSpareServers 10
    MaxSpareServers 25
    StartServers 10
    MaxClients 180
    MaxRequestsPerChild 4000

  2. #2
    Join Date
    Sep 2006
    Location
    Michigan
    Posts
    64
    Well, the good news is you are not swapping and there is no IO wait time indicated (assuming you kernel supports this).

    What version of apache is being used?

    Have you done any analysis of web server usage? Like, how many hits/visitors and has this increased?

    What about the website itself, is this using php/perl/ruby/python/etc.. and has the code been analysed?

    Anything strange in the logs?

    Nick
    MNX.io - 100% SSD Cloud Hosting - Linux, FreeBSD, & SmartOS.

  3. #3
    Join Date
    Apr 2004
    Location
    San Jose
    Posts
    902
    If you're using PHP, you should be using an accelerator, such as eAcellerator, APC, etc. Zend Optimizer will hurt rather than help when no accelerator is in use. It also conflicts with some accelerators.

    If you're already done this, then you've reached capacity for your current system/code. You could recode more efficiently, or upgrade hardware.
    Specializing in MySQL and website tuning for high traffic sites. cmwsci.com/

  4. #4
    Join Date
    Apr 2004
    Location
    India
    Posts
    211
    You can also change your httpd.conf setting to:

    httpd.conf
    Timeout: 12
    KeepAlive Off
    MaxKeepAliveRequests 120
    KeepAliveTimeout 2
    MinSpareServers 20
    MaxSpareServers 35
    StartServers 10
    MaxClients 256
    MaxRequestsPerChild 10000

    This should help resolve your apache issue; also you should install eAccelerator on your server.

  5. #5
    Thanks for helping out !

    Based on the output from TOP, can you see what is causing the serverload ? mysql og httpd ?

    With my eyes it looks like httpd is causing the serverload, am i right ?

    I'll install eAccelerator, and test the changes to httpd.conf

    Thanks.

  6. #6
    Join Date
    Apr 2004
    Location
    India
    Posts
    211

  7. #7
    Join Date
    Apr 2004
    Location
    San Jose
    Posts
    902
    Why do you tell him to turn KeepAlive off? That will put additional burden on the clients and the server to reestablish the connections necessary to fetch images, javascript, flash etc. from the main pages. His original KeepAlive settings were fine. Turning KeepAlive off only makes sense where someone is DoSing you by make a connection and fetching a page, then leaving the connection open. The symptom for that would be lots of idle time, but no free Apache children to serve requests.

    Setting MinSpareServers to 20 and then StartServers to 10 really doesn't make much sense. At startup, that will ask it to start 10 children, but then it needs 20 spare servers, so it will need another 10.

    Since he is CPU bound in Apache, the most likely problem is his PHP. If he's not running an accelerator, this is likely to make the biggest difference, unless his PHP is very expensive.
    Specializing in MySQL and website tuning for high traffic sites. cmwsci.com/

  8. #8
    Join Date
    Sep 2000
    Location
    Alberta, Canada
    Posts
    3,109
    I'm in the same camp as sailorFred but find many others also think that turning KeepAlive OFF is good thing - which it is not.

    Although most of us learned how to tweak Apache settings through good trial & error methods, many people have not. Not taking the time to learn or spending the money to hire someone who does know, they prefer to ask at a Forum and go by whatever someone tells them. This is not intended as a remark against the original poster, just something I've noticed in general at many Forums.

    Asking is fine but if one is not going to spend the time to trial & error the information given then odds are, the information provided will not help and the person ends up back the Forum asking again.

    Between settings for Apache, mySQL, PHP, eMail, many things can be done to bring down the load. Then you start to add other things to help bring down the load even more. A PHP accelator and eMail blocking would be the first two.


    akvario, do a somewhat, quick test.

    Run your Server using the settings provided by rootsupport. At the end of 12 hrs. copy & paste the settings shown in Apache Status. Then switch to the following settings and compare after 12 hrs.

    Timeout: 30
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 30
    MinSpareServers 5
    MaxSpareServers 10
    StartServers 5
    MaxClients 160
    MaxRequestsPerChild 5000

    If you have the time, do 24 hrs. for each setting to get more accurate results. Server maintainence plays a part in Server load and different updates run at different times of the day.
    PotentProducts.com - for all your Hosting needs
    Helping people Host, Create and Maintain their Web Site
    ServerAdmin Services also available

  9. #9
    Join Date
    Jan 2003
    Posts
    38
    From your top it look like Apache is the culpit. Even more base on my experience I would say is a script (php or perl) because apache itself can take up to 5Megs per second without a seminficative load even on a celeron if it used only for images/html

    About turning keep alive off or on I would say to test it because on some servers it actually help to turn it off while on others it hurts. Everything is based on how many pictures will have an html page. (more pictures works best with keep alive off)

    Install Php eaccelerator, and install cacti on another machine and watch load while you testing.

Posting Permissions

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