Select Page

Configuring Apache for Maximum Performance

Configuring Apache for Maximum Performance

Apache is an open-source HTTP server implementation. It is still the most popular web server on the Internet. The August 2015 Web Server Survey conducted by Netcraft [1] shows that about 37.51% of the web sites on Internet are using Apache.

Through our web server administration services, Bobcares helps several small, mid-size and large online businesses deliver high uptime and performance. In the systems we maintain, the most commonly used web server is Apache. Here’s how we ensure high performance for these servers.

See how we improve Apache performance!

1. Apache server performance

Apache server performance can be improved by adding additional hardware resources such as RAM, faster CPU etc.. But, most of the time, the same result can be achieved by custom configuration of the server. This article looks into getting maximum performance out of Apache with the existing hardware resources, specifically on the Linux systems. Of course, it is assumed that there is enough hardware resources, especially enough RAM that the server isn’t swapping frequently. First two sections look into various Compile-Time and Run-Time configuration options. Run-Time section assumes that Apache is compiled with prefork MPM. HTTP compression and caching is discussed next. Finally, using separate servers for serving static and dynamic contents are being discussed. Basic knowledge of compiling and configuring Apache, and Linux are assumed.

2 Compile-Time Configuration Options

2.1 Load only the required modules:

The Apache HTTP Server is a modular program where the administrator can choose the functionality to include in the server by selecting a set of modules [2]. The modules can be either statically compiled to the httpd binary or else can be compiled as Dynamic Shared Objects (DSOs). DSO modules can be either compiled when the server is built or else can use the apxs utility to compile and add at a later date. The module mod_so must be statically compiled into the Apache core to enable DSO support.

Run apache with only the required modules. This reduces the memory footprint and hence the server performance. Statically compiling modules will save RAM that’s used for supporting dynamically loaded modules, but one has to recompile Apache whenever a module is to be added or dropped. This is where the DSO mechanism comes handy. Once the mod_so module is statically compiled, any other module can be added or dropped using the LoadModule command in httpd.conf file – of course, you will have to compile the modules using apxs if it wasn’t compiled when the server was built.

2.2 Choose appropriate MPM:

Apache server ships with a selection of Multi-Processing Modules (MPMs) which are responsible for binding to network ports on the machine, accepting requests, and dispatching children to handle the requests [3]. Only one MPM can be loaded into the server at any time.

Choosing an MPM depends on various factors such as whether the OS supports threads, how much memory is available, scalability versus stability, whether non-thread-safe third-party modules are used, etc.. Linux systems can choose to use a threaded MPM like worker or a non-threaded MPM like prefork:

Worker MPM uses multiple child processes. It’s multi-threaded within each child and each thread handles a single connection. Worker is fast and highly scalable and the memory footprint is comparatively low. It’s well suited for multiple processors. On the other hand, worker is less tolerant to faulty modules and faulty threads can affect all the threads in a child process.

Prefork MPM uses multiple child processes, each child handles one connection at a time. Prefork is well suited for single or double CPU systems, speed is comparable to that of worker and it’s highly tolerant to faulty modules and crashing children. But the memory usage is high, more traffic leads to more memory usage.

Tired of slow web server?

No more customer loss due to slow servers. We'll fix speed up your servers in no time.

Click Now to speed up your server now


  1. Are you sure you didn’t make a mistake in “3.2 AllowOverride”?

    Isn’t it “AllowOverride none” to prevent consultation of .htaccess files?

  2. Hi David…looks like you missed the “not” in the sentence “If AllowOverride is not set to ‘None’, then Apache will attempt to open .htaccess “

  3. thanks for your good article 🙂


Submit a Comment

Your email address will not be published. Required fields are marked *

Bobcares is a server management company that helps businesses deliver uninterrupted and secure online services. Our engineers manage close to 51,500 servers that include virtualized servers, cloud infrastructure, physical server clusters, and more.