Networking & Protocols (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is HTTP/2 HPACK Header Compression?
senior LevelHTTP & REST APIs
In Simple Words: In HTTP/1.1, user cookies and user-agent headers send 1-2 KB of redundant text with every single asset request:
- HPACK: Uses two tables:
- Static Table: Predefined list of 61 common headers (e.g.
:method: GET= Index 2). - Dynamic Table: Remembers headers sent earlier in the connection. If the
User-Agentwas already sent, subsequent requests send a single 1-byte index reference! - Huffman encoding compresses remaining strings.
- Static Table: Predefined list of 61 common headers (e.g.