Basic Apache Optimizations

1 minute read

Apache, the most popular web server, is a stable and reliable software for providing web pages to the world. But sometimes, it happens that Apache will struggle under high loaded traffic.

Here is an overview on how you can optimize apache so it can cope with higher loads. Those tips are not meant to be exceptional but should be sufficient to increase your web site performance by handling more traffic.

When a web site gets too many connections at the same time, the web site will start to be slow to respond to the request, either because the host is not configured properly or because the bandwidth is getting insufficient.

There is few simple steps that can be taken in order to handle more traffic.

DNS Look Up

A good way to enhance your server response time is to disable DNS LookUp. When DNS Look Up is activated, Apache will perform a name resolution each time a new client connect to the server in order to record the full host name of the client. Disabling DNS LookUp, Apache will only save the IP of the client.

Web statistics software such as awstats can perform name resolution if you still need to get that information, but keep in mind that this will increase the time required by awstats to process your logs.


On start up, Apache will create a number of processes (Servers), and will handle a maximum of simultaneous requests (MaxClients). Any connection attempts over MaxClients will be queued. The MaxClients maximum value is capped by Here is a default setting for a Debian/Ubuntu box:

<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients          20
MaxRequestsPerChild  0

In order to handle more request at the same time, someone could use settings like:

<IfModule prefork.c>
StartServers       15
MinSpareServers    10
MaxSpareServers   20
ServerLimit      512
MaxClients       512
MaxRequestsPerChild  0

Note that in order to exceed the 256 MaxClients default capped value, we re-defined ServerLimit with a value of 512.

A simple tips to know if your server needs a bigger MaxClients value, is to check for:

[error] server reached MaxClients setting, consider raising the MaxClients setting

in your error log file (usually /var/log/apache2/error.log)

To be continued…