Select Page

Think Speed : mod_pagespeed for Apache

World of web is becoming faster day by day. Webmasters have been making conscious efforts to enhance website speeds even more, now that Google has even page rank linked to website speed. Sticking to efficient coding and adopting best practices has always been the steps taken by webmasters to speed up their sites.

But for a web host, there are several server level changes that can contribute to high server speed.

Bobcares helps web hosts deliver high performance web services. Server optimization and high performance server configuration is an important part of our web server management services. Today we’ll go through how we used mod_pagespeed to reduce web page load times.

mod_pagespeed

mod_pagespeed is an open-source Apache module that optimizes web pages and resources by them. It does this by re-writing the resources used, using filters that implement web performance best practices. Webmasters and web developers can use mod_pagespeed to improve the performance of their web pages when serving content with the Apache HTTP Server. The module is, for now compatible with Apache version 2.2 and is now available as a down-loadable binary for i386 and x86-64bit systems. The module has been tested in both CentOS and Ubuntu and the binary form can be used in other Debian/RPM based distros.

An open source code accessible through svn can be found here.

How it works

The module performs several optimizations on the fly, such as optimized caching, minimized client-server round-trips, minimized payload size and optimized browser rendering, and more. The end result is much higher performance for the websites which is usually to the tune of upto 100%, or in other words half the loading time.

mod_pagespeed includes several filters that optimize JavaScript, HTML and CSS style-sheets. It also includes filters for optimizing JPEG and PNG images. The filters are based on a set of best practices known to enhance web page performances.

Getting started

This part is rather easy, and shouldn’t take more than a couple of minutes, if you are familiar with Apache and its modules. Even otherwise, the installation and configuration is pretty straightforward.

The rpm package can be found here, which can be installed in servers that have Apache 2.2 installed with an rpm/deb package. The details are present in the same page.

The following link outlines compiling the module from source. If none of these work, the option of extracting the files from within the package, and loading the extension appropriately would work as well.

Once the module is installed, say with rpm/deb package, the configuration file can be found at :

Ubuntu: /etc/apache2/mods-enabled/pagespeed.conf
CentOS: /etc/httpd/conf.d/pagespeed.conf

The modules are to be loaded within this configuration, and the web-server needs to be restarted for the module to work.

Now, to enable and disable various filters, a fair understanding of each filter is mandatory. The details on filters can be found here. Additional information on configuration can be found here.


About the Author :

Sankar works as a Senior Software Engineer in Bobcares. He joined Bobcares back in April 2006. He loves grooming/mentoring people. During his free time, he listens to music, and enjoys singing..



Bobcares
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.
MORE ABOUT BOBCARES