Text сжимается ~70–90% — gzip/brotli cheapest big win на wire. Client шлёт Accept-Encoding, server marks Content-Encoding. Brotli static max level, gzip/low brotli dynamic, never compress already-compressed.
Разбор
Compression работает потому что text redundant — HTML, JS, CSS, JSON repeat tokens. Images, video, fonts already compressed — gzip over JPEG wastes CPU и может сделать bigger.
Negotiation — two-line HTTP handshake:
Request: Accept-Encoding: br, gzip ← "I can decode these"
Response: Content-Encoding: br ← "I used Brotli"
Vary: Accept-Encoding ← "cache separately per encoding"
Решения: какой algorithm, какой level, build time или per request?