Bandwidth and site speed are of huge concern to webmasters and hosting companies alike. Bandwidth is a finite resource, and as the demand for ever richer media content and interactive experiences increases, so do bandwidth demands. This goes doubly for mobile users and their bandwidth providers — data caps and immature mobile network infrastructure combine to limit the sort of experience that mobile can provide, which also limits revenues.
Extracting the maximum bang for the bandwidth buck and increasing site responsiveness should be at the top of any online service provider’s list of priorities. Apache, the world’s most popular web server, was designed for a simpler time, but there are a few tweaks that can be made to improve resource usage and responsiveness.
We’re going to look at three ways that Apache can be given a boost. We’ll be focusing on improving responsiveness rather than bandwidth limitation, but the two often go hand-in-hand.
There are various compression modules that can be used with Apache to reduce data use. Mod_deflate, which uses the same Deflate algorithm as gzip and other popular decompression tools, will squeeze data down to more manageable sizes, albeit at the cost of a hit to processor overheads. Compression isn’t going to bring much benefit to sites that are predominantly made up of images that are already in compressed formats or that rely on encrypted connections for security, but they can definitely be a boon for textual content, including client-side scripts.
Some sort of caching within Apache can often give significant responsiveness boosts, but there’s a choice to be made between mod_mem_cache and mod_disk_cache. There’s been exhaustive discussion about which is best, but generally, mod_disk_cache, which has the advantage of sharing cached responses between processes, is preferred for the average use case. However, feel free to let us know in the comments if you think otherwise.
Mod_spdy implements the SPDY protocol. SPDY was created by Google to address certain limitations in the way that the HTTP protocol handles data, particularly with regard to multiplexing and prioritizing connections. SPDY is being used as the basis for HTTP/2.
Many of the major desktop and mobile browsers support SPDY in their most recent versions, with notable exceptions being ––unsurprisingly–– Internet Explorer and Safari.
Apache is a complex beast, with a million different tricks and techniques that can be used to coax the best possible performance. We’ve briefly discussed just a few here, and we’d love to hear some of your suggestions in the comments.