edoceo

Tuning Apache Performance

This document covers a few options for tuning the Apache performance, which should also improve your web-site performance.

The first rule of performance for your web-server is to ensure that it only has that job to do, so that it can dedicate itself to the task of serving web-content.

Secondly, remove all modules that are not in use! Many times Apache will come with modules enabled that you do not need such as: mod_dav or mod_unique_id among others. You should know which ones you need and which you do not. If you don't know, remove one at a time and then run a full application test-pass to be sure.

Enable mod_status §

This module is critical for monitoring the performance of your web-server. Enable this and then collect a base-line of the server performance

# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    Order allow,deny
    Deny from all
    Allow from 127.0.0.1
    Allow from 74.207.248.164 # myself, external
    Allow from 23.25.130.99   # carbon.edoceo.com
    Allow from 96.126.112.126 # custos.co

# Or protect with htpasswd (preferred)
    AuthType Basic
    AuthName "Edoceo"
    AuthUserFile /var/www/edoceo.com/etc/htpasswd
    Require valid-user

</Location>

Configuration Data w/mod_info §

One of the super nice things about mod_info is that it will report a considerable amount of details on the servers running configuration. So, using this it's possible to see where extra items are loaded that do not need to be. For example, if not necessary remove mod_unique_id for performance.

<Location /server-info>
    SetHandler server-info
    Order allow,deny
    Deny from all
    Allow from 127.0.0.1
    Allow from 74.207.248.164 # myself, external
    Allow from 23.25.130.99   # carbon.edoceo.com
    Allow from 96.126.112.126 # custos.co
</Location>

Reduce Logging

Too much logging can take a toll on Apache. We recommend to have limited data logging and to also to direct logging to different disk/spindle from the server content.

ErrorLog /var/log/apache2/error.log
LogFormat "%V %t %a \"%r\" %>s %T %D %B %P %X %I %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
CustomLog /var/log/apache2/access.log combined

It is also possible to send ErrorLog to syslog, which could be on a dedicated syslog server.

ErrorLog syslog:local7

See Also

Loading Comments from Disqus...