Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Help optimizing Apache


    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
    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
    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?


  2. #2
    Linux User infoshirish's Avatar
    Join Date
    May 2007
    Pune, India
    According to me the apache settings seems ok. Well there might be several reasons for apache server loads other than your Apache settings. For i.e Applications like mysql and php. It's mysql as usually. This one thing you can do:-

    Backup /etc/my.cnf and try another configuracion (there is examples in the normal mysql installacion, some files called mysql-huge or so, i don't remember).

    After that, restart mysql and apache:

    /etc/init.d/mysql restart && /etc/init.d/httpd restart

    Don't worry with the ram usage until swap memory is used, but be carefull with the %cpu load.

    Look the cpu load with the vmstat command during some time, it's the best way to see the server evolution:

    vmstat 5

    Or one basic and simple way to problem is that the use of .htaccess files also slows down the server.
    First, it has to look to see if a .htaccess file exists, then it has to parse and process the elements before finally applying the configuration to the directory in question. Worse still, Apache must determine this information not only for the current directory, but also for any parent directories and it then must make the changes based on the contents of all these files.
    If you want maximum performance however, you should disable the use of .htaccess files altogether. Any directory specific configuration can go in the main configuration file where it can be parsed once by Apache when the server starts.
    To disable .htaccess add the directive AllowOverride None to any <Directory> section.

    If this does not make a diffrence there a link i found check it out.

    who |grep -i blonde |
    date; cd~; unzip; touch;
    strip; finger; mount; gasp;
    yes; uptime; umount;

    Newbie clicks

Posting Permissions

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