Performance and monitoring
Gzip compression, saving transfer and speeding up access
What is Gzip compression?
To speed up loading and save transfer, browsers support compression systems such as Gzip and Brotli. They are applied mainly to text content such as HTML, CSS, JavaScript, JSON, XML or SVG.
Formats such as JPEG, PNG, WebP, video or ZIP files already include their own compression and do not usually benefit from Gzip or Brotli. For those, you need to optimise dimensions, quality or format.
Enabling compression on the web server
By default, all our services automatically compress compatible content with LiteSpeed. The server negotiates with the browser whether to use Brotli, Gzip or deliver the resource uncompressed, so you do not need to enable anything.
Do not add a second compression from PHP
Do not add ob_gzhandler or manual compression headers to the application when the server already does this. A double configuration can produce corrupt responses, inconsistent headers or unnecessary CPU use.
Checking that everything works
You can check a response from the browser's developer tools. In the network tab, look at the Content-Encoding header, which will normally show br or gzip for compressed resources.
The browser announces the algorithms it supports in Accept-Encoding; the server chooses the right response. Not every response has to be compressed: the type, the size, the configuration and whether the resource already uses another compressed format all play a part.
In the network tab, compare the transferred size with the size of the resource. If a CDN is involved, the visible header describes the response it delivers, which may differ from the origin's.
Compression does not reduce the dimensions of an image or remove unnecessary JavaScript. If a page is still slow, find out which resource or process is taking time before adding another layer of compression. For a one-off test, see how to disable Gzip and Brotli and restore the configuration when you finish.
You may also find useful
- Bulk image optimisation Optimise JPG, JPEG and PNG files by account, domain or directory; check the quality on a sample and...
- Web compression with Brotli and Gzip Clarifies which content LiteSpeed compresses automatically and how the server chooses Brotli or Gzip...
- AccelerateWP: features, availability and configuration Details the free and premium AccelerateWP features for WordPress, including caching, file optimisati...
- Analyse slow PHP requests with X-Ray Trace PHP requests with X-Ray to find slow SQL queries, functions, files or external calls, keeping...
Something wrong or out of date? Tell us and we will review it.