Four Quick Tips For Performance Optimizing The Apache Web Server

Apache Web ServerApache has an undeserved reputation for poor performance. While it’s true that Apache isn’t quite as resource efficient as servers like Nginx that implement an event-based rather than process based architecture, with a little bit of tweaking and the right approach, Apache can be as fast as, if not faster than, Nginx.

Let’s have a look at four things webmasters can do to improve the performance of their web server. There’s a lot more to be said about performance optimization than can be fitted into a four item list, but the tips I’ll discuss here are a good start.

Get Rid Of Unwanted Modules

By default Apache comes with many different modules, not all of which are activated by default, but frequently the ones that are activated aren’t needed. The SSL module is often enabled, which obviously isn’t necessary for a site that doesn’t use SSL. The Rewrite module is particularly resource hungry and be done without if it’s not being used (although if you’re using a CMS like WordPress, it probably is being used).

Sometimes you can’t tell which modules are needed, because of dependency relationships between modules, but enabling them is as easy as disabling them, so on a new server I’d suggest making a list of the ones that are active, deactivating them in turn, and seeing if an error results when you restart Apache.

The procedure is different depending on the distribution: you can find instructions for both CentOS and Ubuntu here.

Cache As Cache Can

Caching content, either in memory or on disk, can improve response times, depending on the type of site you have. Apache includes a couple of modules for caching: mod_disk_cache and mod_mem_cache, which do much what you’d imagine.

I’d advise taking care if you choose to use memory caching (in fact, you probably shouldn’t): Apache is a bit of a memory hog itself, and adding memory caching to the mix will cause issues on servers that haven’t much to spare. Both of these modules are helpers for the mod_cache module, on which they depend.

Learn more here for Apache 2.2 and Apache 2.4.

Compress

Compressing files before sending them to browsers reduces the amount of bandwidth used in return for increasing load on the server’s processor. That used to be a problem, but modern servers have more than enough processing heft to spare.

Find out how.

Implement SPDY

We’ve written about SPDY before, so take a look at this post for the details. In short, it’s a reimagined HTTP that adds a number of features to streamline performance. SPDY will be the next version of HTTP, but until then, it’s possible to bring many of the benefits with mod_spdy. Installing mod_spdy can be a bit of pain, and there isn’t yet a stable version for Apache 2.4, but it’s worth taking a look at.

Matthew Davis is a technical writer and Linux geek for Future Hosting.

Dedicated Server Special

Take advantage of our Double RAM offer on the E3-1230v2 4 x 3.30GHz+HT server! Only $134.95 per month. Managed and Unmanaged options available at checkout.

GET STARTED