HTTP/2 is an extended version of HTTP communication protocol after HTTP/1.1. Targets of the improvement are:
- Faster communication (50% improvement)
- Better utilization of available network capacity
- Keep existing application with the older version (HTTP/1.1) running (no changes required)
How those targets can be achieved? There are several technical aspects:
- Applying header field compression
- Allowing multiple concurrent exchanges on the same connection (allowing interleaving request & response)
- No change in core concepts of HTTP such as method, status codes, URIs, and headers.
HTTP/2 adds a binary framing layer in HTTP protocol that dictates how messages are encapsulated and transferred. There are several terms in HTTP/2 protocol:
- Stream. It is a bidirectional flow of bytes that can contain one or more messages.
- Frame. It is the smallest unit of messages in the stream. It has a header that contains the identity to which the stream belongs. Frame can contain encoded header data or payload data of a request or response message.
- Message. It is a resembled-form of one or more frames. It is mapped to request or response messages.
Because a single connection can have multiple related streams, there is a stream prioritization scheme. If a stream is required by other streams, this stream is prioritized for using available resources first. If two streams have no dependency or have the same dependency, They are prioritized proportionally by their weights.
HTTP/2 also provides building blocks for allowing client/server to implement stream or connection-level flow control. Without flow control, as a sender can send multiple streams continuously, it can flood the receiver. The receiver can advertise information about the flow control window which is exchanged in
SETTINGS
frame. When a DATA
frame is received by a receiver, WINDOW_UPDATE
frame is sent by the receiver. Another good thing about HTTP/2 is its capability for a server to push data to a client. It is initiated by the server by sending
PUSH_PROMISE
frames.
Comments
Post a Comment