Search code examples
apachemod-pagespeedmod-deflate

Benefits of mod_pagespeed over mod_deflate


The SO post here explains what mod_pagespeed does, but I'm wondering if I would notice any significant difference in page load time with this installed on a server that is already using mod_deflate to compress files.

If it is worth installing, are there any special considerations to take into account with regards to configuration when running both modules, or should one replace the other? The server is running EasyApache4.


Solution

  • Yes you will because these modules do different things.

    mod_deflate handles data compression

    The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

    Simply put, its sole purpose is to reduce the amount of bytes sent for your server regardless of what kind of data is sent

    mod_pagespeed performs optimizations that would speed up the resulting webpage performance from end user's perspective by following a bunch of web pages optimization best-practices

    Here's a simple example:

    • imagine we have 1 html page and 1 small external javascript file
    • if we use mod_deflate, both of them will be gzipped BUT the browser would need to make 2 HTTP requests to fetch them
    • mod_pagespeed may decide it's worth inlining the contents of this js file into the .html page
    • if we use mod_deflate together with mod_pagespeed in this case the resulting number of bytes downloaded would be the same BUT the page would render faster as it would need to make only 1 single HTTP request

    Such optimizations of the original .html page and its dependent resources may have a huge difference in terms of execution time especially on slow mobile networks

    So the idea is to always enable mod_deflate and either apply these best-practices manually or use mod_pagespeed which would apply them automatically