Compression almost always worth it for text; never for already-compressed binaries; max level static only; BREACH for secrets.
Разбор
- Worth it for text — 90% smaller payload dwarfs CPU, especially mobile.
- Never compress binaries. JPEG/PNG/WebP/MP4/WOFF2 ~0% gain, cost CPU, can inflate.
- Tiny responses not worth it. Below ~1KB overhead > savings;
min_length.
- Max level static only. Brotli-11 on dynamic per-request blows latency budget.
- Compression + secrets = BREACH/CRIME. Don't compress responses mixing secrets with attacker-controlled input.
Итог
Text compress always with right level; scope MIME; static max, dynamic moderate; security caveat for mixed secret/user content.