Despite the proliferation of high-speed Internet, bandwidth usage is still a concern for web services and end users. For large web services, having to deliver hundreds or even thousands of large files can have a big impact on spend and performance.
How Gzip Works
- When a server receives a request for a web page, the server checks the header of the request to determine if the browser supports gzip
- If so, the server generates the markup for the page before applying gzip
- Gzip converts the markup into a compressed data stream which is then delivered to the end user
- When the end user receives the compressed stream, their browser decompress it
How Compression Levels Affect Resource Usage
Gzip compression is a CPU-dependent process that has different compression levels. Higher compression levels result in smaller files but are more CPU-intensive. Developers can choose how much to compress – as well as what to compress – based on the needs of the site or application they are responsible for. At StackPath we give developers the option to compress files on a level from 1 to 6 from the control panel.
Example of Gzip
A 2009 study shows the drastic impact compression can have on some of the world’s top websites. For Facebook, enabling compression reduced page load time by an average of 9.4 seconds, or 414%. A savings of 350 KB may not seem like much in today’s data driven world, but when aggregated across all of Facebook’s users it makes for a substantial improvement.
Over the past 10 years, the average web page has grown in size by almost 1.2 MB. As our demand for information increases, techniques for quickly and efficiently delivering large amounts of data are becoming more relevant. When a 100ms increase in page load time can reduce your sales by 1%, it’s vital to make web services as efficient as possible. Gzip compression can add a profitable speed boost to any web service.