Help optimizing Apache

Discussion in 'Apache' started by pulsorock, Aug 14, 2007.

  1. #1
    Hello,

    I have this dedicated server with the following specs:

    - HP ProLiant DL380 G4 Dual Xeon 3.6Ghz 6GB RAM Server with 3x 36.4GB Hot Plug SCSI Hard Drive
    - Processor - 2x Intel Xeon 3.6 GHz/800MHz - 1MB L2
    - Memory - 6 GB PC2-3200R 400MHz DDR2 with Advanced ECC and online spare memory capabilities
    - Hard Drive - 3x original COMPAQ HP 36.4GB 10K Hot Pluggable SCSI Hard Drive
    - Storage Controller - Ultra320 Smart Array 6i Controller (integrated on system board) with 128MB Battery Backed Write Cache...

    CentOS Linux 5.0
    Apache/2.2.3 (CentOS)
    PHP Version 5.1.6
    MySQL 5.0.22

    I had mostly the Apache default settings and it worked pretty well. These are the settings I had:

    KeepAlive Off
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    MinSpareServers    5
    MaxSpareServers   20
    StartServers         2
    MaxClients         150
    MaxRequestsPerChild  0
    Code (markup):
    My daily traffic is an average of 4,000-6,000 visits, with an average of 400-600 visits at peak hour (around 4pm-5pm) and the server runs smooth and fast.

    But there are sometimes that something special happens in the news that brings a lot of people to the site. For example today we had a total visitors of nearly 22,000 visits (4,500 of them around 4pm-5pm). Most of them viewing a video clip of around 5MB we posted.

    The problem was that during that time, the server was practically inaccessible. The bandwidth was alright, so that wasn't a problem. The problem was due to the Apache configuration. It wasn't able to deal with all the connections at the same time.

    To fix the problem rapidly, I increased some of the values, and it worked better. These are the settings I changed:

    KeepAlive: On
    MaxKeepAliveRequests: 100
    KeepAliveTimeout: 1
    MinSpareServers    15
    MaxSpareServers   20
    StartServers       15
    ServerLimit      500
    MaxClients      500
    MaxRequestsPerChild  1000
    Code (markup):
    But I still want to know how to optimize best the configuration and avoiding this to happen again.

    Any recommendations of what settings to change or what values to set to improve the server in case something similar happens?

    Thanks
     
    pulsorock, Aug 14, 2007 IP
  2. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    unload any modules that you aren't using

    also if you can, setup a second copy of apache, with only apache and no modules, and use it for a "static" server, this allows you to turn around "standard" file requests very fast, it also has the side benifit of increasing the number of connections to your server (browers make 2 connections at a time per hostname by default).
    the idea of a static serving apache is to turn around your connections faster then a standard apache server (with php mod_this mod_that etc etc).
    also make sure you have keepalive on (which it appears you do)
     
    powerspike, Aug 14, 2007 IP
  3. pulsorock

    pulsorock Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks powerspike...

    For start, I'll try commenting the lines of modules I don't use and see how it works out.

    What about the settings of the values I listed above, any recommendation on how to improve them for situations like this? I would like to know is how to get the most out of the server specs I have and what of these settings setting of Apache should I modify to take the most advantage of my server hardware.

    Thanks
     
    pulsorock, Aug 14, 2007 IP
  4. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4
    the settings look ok =)
     
    powerspike, Aug 14, 2007 IP