Compression
In one sentence
Reducing file size in transit using an algorithm both the browser and the server understand.
Analogy Mental model
A vacuum bag for a duvet. Much smaller to move, and it expands again at the other end.
In practice What you actually do
Enable Brotli where both ends support it, with Gzip as the fallback. Compress HTML, CSS, JavaScript and JSON. Do not compress formats that are already compressed, because the second pass costs CPU and saves nothing.
Where people get burned Pitfalls
Brotli over plain HTTP is not available, so the sites that most need compression are often the ones not using the better algorithm. Verify with a response header rather than assuming the setting took effect.
This entry was written in English from the Chinese original, not machine-translated. Read the Chinese version →