Optimising Apache performance

The Apache HTTP server is a software package used to run and maintain web servers. It was and is hugely popular; from the initial growth of the Internet to the current scenario, Apache is said to serve every two out of three websites.

Apache is frequently used in tandem with the Linux networking environment, making them both invaluable to plenty of web servers. In light of the huge amount of traffic website servers need to handle, it is essential that the Apache software’s performance is optimised to the fullest.

There undoubtedly are physical approaches that can be followed in server optimisation. You can set up dedicated physical servers (computers/machines that specifically serve web pages), distributed servers (computers that redirect you to other dedicated servers to serve page content), etc. But the most logical and economical first step would be to modify the parameters of your Apache software settings to adapt to the kind of load you expect.

Apache’s performance optimisation settings are actually directives in the httpd.conf file.

The Timeout directive handles the amount of time the server is expected to wait before sending a timeout ping (which indicates that the server can’t be reached). The Timeout directive’s actual value is the number of seconds that the server will wait for a response.

The Keepalive directive controls whether to permit continuous connections. These connections entail handling multiple page requests, heavily increasing the traffic your server needs to handle. Putting the Keepalive directive to the ‘on’ setting can increase the speed and ease at which users can access server content. However, it also leads to users staying connected to your server for a much longer time than before, as their connections are, quite literally, ‘kept alive’.

The MaxKeepAliveRequests directive is an extension of the KeepAlive directive. It specifies the number of page requests a single connection can make before dictating that the client needs to connect to the server again. When you set this directive to a high value, clients can stay on the server for a long time, with a lesser chance of the server expelling them.

The KeepAliveTimeout directive deals with continuous connections as well. It determines the amount of time (in seconds) your server will wait for the next page request from a continuous connection before letting it onto the server again. It functions as a sort of temporary ban on continuous connections to reduce server traffic.

Prefork MPM is unlike the directives stated above, as strictly speaking, it isn’t a directive. Instead, it is an Apache module that specifies the number of Apache processes that can be running simultaneously. It also specifies how the processes will manage multiple connections coming into the server. The directives contained inside the MPM module have their unique uses to dictate how the server handles incoming load:

· MinSpareServers: It states the minimum number of idle processes that wait for incoming connections.

· MaxSpareServer: It states the maximum number of idle processes that can run before Apache starts shutting them down.

· MaxClients: The total number of Apache processes that can be running simultaneously at any given time.

Apache is and has always been the most widely used web server software. Moreover, it is free and comes with almost all Linux distros. Being a powerful and versatile software, it can get rather tricky to handle at times, but with the correct tweaks, it can lead to extremely efficient web server performance.

Leave a Reply