HTTP/2 is an efficient protocol that substantially and measurably improves the HTTP/1.1 protocol.
As part of a bigger picture, HTTP/2 has two parts:
- The framing layer: This is the HTTP/2 multiplexing core ability
- The data layer: This contains the data (what we typically refer to as HTTP)
The following diagram depicts the communication in HTTP/1.1 (top) and HTTP/2 (bottom):
HTTP/2 is widely adopted by servers and browsers, and it comes with the following improvements over HTTP/1.1:
- Binary protocol: Less readable by humans but more machine friendly, the HTTP/2 framing layer is a binary framed protocol.
- Multiplexing: This refers to interwoven requests and responses. Multiple requests run at the same time on the same connection.
- Server push: The server can decide to send additional resources to the client.
- Single connection to server: HTTP/2 uses a single communication line (TCP connection) per origin (domain).
- Header compression: HTTP/2 relies on HPACK compression to reduce headers. This has a significant impact on redundant bytes.
- Encrypted: Most of the data that's transferred over the wires is encrypted.