What Is HTTP/2?
HTTP/2 (originally named HTTP/2.0) is the second revision of the HTTP network protocol used by the World Wide Web. HTTP/2 runs mainly based on the SPDY protocol. It compresses data in HTTP header fields, uses multiplexing for data transmissions, and adds the server push mechanism to reduce network latency and increase the web page loading speed on the client. HTTP/2 does not change application semantics of HTTP, and still uses the HTTP request methods, status codes, and header fields. It mainly modifies the way how data is formatted and transmitted, and adopts the binary framing layer to improve performance.
What Problems Does HTTP/2 Solve?
HTTP is the most widely used Internet application protocol. Earlier versions of the HTTP protocol were implemented simply. HTTP/0.9 was a one-line protocol to bootstrap the World Wide Web. HTTP/1.0 documented the popular extensions to HTTP/0.9 in an informational standard. HTTP/1.1 introduced an official IETF standard. Implementation simplicity came at a cost of application performance. For example, the HTTP/1.1 client needs to use multiple connections to achieve concurrency and reduce latency. HTTP/1.1 does not compress header fields of requests and responses, causing unnecessary network traffic. In addition, HTTP/1.1 does not support effective resource prioritization, resulting in poor use of the underlying TCP connection.
As network applications continue to grow in their scope, complexity, and importance in our daily lives, HTTP/2 was designed to overcome shortcomings of earlier HTTP versions. HTTP/2 does not change application semantics of HTTP, and still uses the HTTP request methods, status codes, and header fields. It mainly modifies the way how data is formatted and transmitted, and adopts the server push mechanism to reduce network latency and increase the web page loading speed on the client.
HTTP/2 vs HTTP/1.1
HTTP/1.1 keeps requests and responses in text format. Text is expressed in diversified modes and used in many scenarios, but is not robust enough. HTTP/2 uses the binary format. Only combinations of 0 and 1 are available in HTTP/2 requests and responses. Binary transmission makes protocol parsing easy and robust.
HTTP connections automatically tune themselves over time, which initially limits the maximum connection speed. If data is successfully transmitted, the transmission speed increases over time. This tuning mechanism is called TCP slow start. This mechanism makes bursty and short-term HTTP connections inefficient. HTTP/2 uses multiplexing to allow all data streams to be transmitted over the same TCP connection, effectively utilizing TCP connections and enabling high bandwidth to truly improve HTTP performance.
HTTP/2 adds the binary framing layer between the application layer and the transport layer, which overcomes performance limitations of HTTP/1.1, improves transmission performance, and achieves low latency and high throughput.
Lower Network Overhead
HTTP/2 uses the HPACK algorithm to compress header fields of each request or response, reducing the network overhead. The HPACK algorithm can reduce the size of header fields to be transferred. Two communication parties establish and maintain an indexed list, which uses index values to indicate previously transferred header fields. Then, Huffman coding is used to compress the data. This avoids transmission of repeated header fields and reduces the size of data to be transmitted.
What Key Features Does HTTP/2 Have?
The core of all performance enhancements of HTTP/2 is the new binary framing layer, as shown in the following figure. The binary framing layer is the foundation that enables all other function and performance optimizations provided by HTTP/2, and defines how HTTP messages are encapsulated and transferred between the client and server.
Binary framing layer
HTTP/2 does not change application semantics of HTTP, and still uses the HTTP request methods, status codes, and header fields. It mainly modifies the way how data is formatted and transmitted. Unlike the newline delimited plaintext HTTP/1.1 protocol, HTTP/2 splits information to be transferred into smaller messages and frames, each of which is encoded in binary format. These frames correspond to messages in specific data streams and are multiplexed within a TCP connection.
After an HTTP message is split into many individual frames, frames in multiple data streams can be multiplexed. The order in which the frames are interleaved and sent both by the client and server becomes a critical factor for determining performance. HTTP/2 allows each data stream to have an associated weight and dependency. The combination of data stream dependencies and weights clearly specifies resource prioritization, which is a critical feature for improving browsing performance. HTTP/2 also allows the client to update resource priorities at any time. In this way, we can change dependencies and reallocate weights in response to user interactions and other signals, enabling further optimizations in browsers.
Each HTTP request or response carries headers which describe resource attributes. In HTTP/1.1, message headers are sent as plain text. If HTTP cookies are used in message headers, hundreds to thousands bytes need to be transferred repeatedly each time, which is resource-wasting.
HTTP/2 uses the HPACK algorithm to compress header fields. This algorithm encodes the transferred header fields, thereby reducing the size of the header fields. In addition, it requires that both the client and server maintain an indexed list of previously transferred header fields. Subsequently, when the index values of these header fields are transferred, the peer end can obtain the data in header fields according to the index values.
Multiplexing allows the client and server to send multiple request and response messages through one HTTP/2 connection at the same time. Multiplexing implements transfer of multiple streams in parallel without requiring multiple TCP connections. In HTTP/2, the frame is the smallest unit of communication. Frames correspond to messages in logical streams, and are interleaved bidirectionally over the same TCP connection in parallel.
Based on the binary framing layer, HTTP/2 allows the client and server to send requests and responses at the same time through the shared TCP connection. HTTP/2 allows the client and server to split an HTTP message into independent frames without breaking the semantics of the message, interleave them, and then reassemble them at the other end based on stream identifiers and headers. Multiplexing resolves the head-of-line blocking problem in earlier HTTP versions and improves transmission performance.
Another powerful new feature of HTTP/2 is the ability of the HTTP/2 server to send multiple responses for a single client request. The server can push resources to a client without requiring the client to request each one explicitly. The server returns multiple responses in advance based on the request from the client and pushes additional resources to the client. For example, as shown in the following figure, when the client requests for stream 1, the server pushes stream 2 and stream 4 in addition to stream 1.
HTTP/2 server push
Server push is a mechanism for sending data before a client sends a request. In HTTP/2, the server can send multiple responses for a request from a client. If a request is sent by your home page, the server may push the home page content, logo, and style sheet because the server infers that the client will use them. Server push not only eliminates redundant data transmission steps, but also increases the page response speed and improves user experience.
Application of HTTP/2 in Network Management and Monitoring
HTTP/2 is mainly used for network management and monitoring. Devices can detect performance data of servers in real time using HTTP/2, improving network resource efficiency and reducing the network application latency.
In Huawei SD-WAN Solution, the network controller uses NETCONF and HTTP/2 to manage network devices. The following figure shows the overall architecture of the SD-WAN Solution. The network controller uses NETCONF to collect O&M information such as network device alarms, logs, and events, and uses HTTP/2 to collect network device performance information.
Overall architecture of Huawei SD-WAN Solution
The network controller uses NETCONF to deliver configurations to network devices. The configurations are transmitted over SSH, ensuring data transmission security. Network devices use HTTP/2 to report performance data and use NETCONF to report alarms to the network controller. Bidirectional certificate authentication is required for network devices to register with the network controller and go online. The system software and signature database of network devices are transmitted using HTTPS. Both HTTPS and HTTP/2 protocol packets are encrypted using the Transport Layer Security (TLS) protocol to ensure data transmission security.
- Author： Li Jiaojiao
- Updated on： 2021-09-30
- Views： 3039
- Average rating：