HTTP Compression
HTTP compression is a feature used to compress web pages prior to transmission over the network. The compression and decompression is done at the Web server and browser respectively. RFC 2616’s section on Content Codings provides detail on the supported compression methods with gzip being widely used.
Within the Firefox browser if we type “about:config” in the browser website address field it takes us to gzip, deflate if we search for encoding.
We can modify the value here in the browser configuration and remove gzip. Doing so will make Firefox not send gzip as a supported compression format in it’s HTTP GET request. Web servers which use gzip will then send uncompressed data.
I decided to test website load times variation with compression enabled and disabled. I shuffled the browser configuration above (removing/adding gzip) a couple of times and reloaded the same page while clearing the browser history. Simultaneously I took wireshark traces capturing the HTTP GET requests and OK responses to compare the time and byte count variations and see the changed packets.
The difference was obvious. Initially the HTTP GET request sent by Firefox contains Accept-Encoding value of gzip and deflate both. This is shown below.
The corresponding HTTP OK response contains 8 TCP Segments totaling 9821 bytes and is received within a second. This is shown below.
After making the changes to the about:config configurations and removing gzip, the values changed. The HTTP GET request no longer contains gzip under Accept-Encoding. This is shown below.
The difference seen in the HTTP OK message was big. There were 21 reassembled TCP segments totaling to 26751 bytes and the page was received in more time. This can be seen below.
If we compare the Content-Length values seen by HTTP at Layer 7 they are 9534 bytes for gzipped page and 26487 for non gzipped page. A significant difference.
This shows that if there is compression carried out between the web server and the browser there is improvement seen on the network in terms of saved bandwidth, load time and therefore user experience.