Objective
This series is based on the HTTP/2 17th draft document, the address is: HTTPS://TOOLS.IETF.ORG/HTML/DRAFT-IETF-HTTPBIS-HTTP2-17.
HTTP/2 specifications have been approved by the release, the following waiting to allocate a specific RFC number, there will be no significant changes.
This note is not a direct translation, recorded into notes convenient later study.
http/1.1 's Problem
A picture can be a very comprehensive summary of the existence of http/1.* defects:
The front-end is generally used:-CSS spriting, small image merged into a large map, CSS to split into small image display-inlining, using Dataurl way embedded BASE64 encoded format picture-JS concatenation, multiple JS files merged into one, The flaw is that once a file has been modified, it needs to be re-merged-sharding, deploying the resource/service to multiple machines, averaging/sharing the request pressure
Http/1.* does not take full advantage of TCP features, coupled with the opening of multiple connections at the same site, resulting in a low utilization of network resources.
HTTP/2 Improvement Point
The main differences compared to HTTP/1 include:
- HTTP/2 in binary format rather than text format
- Efficient and compact transmission resolution
- Less error prone, no so-called blank lines, caps, line breaks, empty joins, etc.
- HTTP/2 are fully multiplexed, rather than ordered and blocked
- http/1.1 single-Request single connection by default
- http/1.1 pipelined pipelining mode causes larger/slower responses to block successor tasks
- http/1.1 does not solve the problem of thread blocking
- Multiplexing can effectively avoid thread blocking and multiple request-response parallel processing within the same connection
- Parallel with just one connection
- HTTP/1.* Request processing model causes the same site resource client to open if 4-8 connection requests
- http/1.* multiple connections can consume excessive network resources, resulting in TCP congestion and data retransmission
- HTTP/2 the parallel processing between multiple streams (request-response) within a single connection, reducing network resource consumption and avoiding TCP frequent opening and closing
- With header compression, HTTP/2 reduces overhead
- Traditional browser network header typically at 80-1400 byte size
- Compression head allows for more compact headers, faster transmission, and facilitates mobile network environments
- Compression algorithm uses hpack, more efficient, more secure
- HTTP/2 allows the server to proactively "push" the response to the client
- Traditional way: Client request, server response, the client resolves a subsequent request to the picture, style and other resources, again one by one send the resource request
- The HTTP/2 server calculates the resources contained in the response content based on the client request and sends it to the client ahead of time before the client initiates the request.
- Saves round-trip time for clients to initiate unsolicited requests
Here is a picture of the HTTP/2 that can be understood in general:
The interpretation of HTTP/2
All semantics of the http/1.1 are reserved/compatible, but the transfer syntax (or transmission) is changed to make the most of TCP more efficient, multiplexing is the implementation path, and low latency is the direction of improvement.
Notes outline
Above for a simple general introduction of the HTTP/2 protocol, in order to delve into its characteristics, the reader specification is required. Here is an outline of the various aspects surrounding the HTTP/2 specification, which makes it easy to fill back one by one.
- HTTP/2 Connection Establishment
- HTTP/2 multiplexing and streaming properties
- Frame definition for HTTP/2
- HTTP/2 's Message exchange
- HTTP/2 error handling and security matters
noun explanation
The following nouns appear in the current or later notes and are posted for easy comprehension.
- Intermediary (intermediation), which refers to Internet devices including agents, corporate firewalls, reverse proxies, and CDNs
- Alpn,application Layer Protocol Negotiation
- Header, message header, request message header, or response message header
Summary
Compared to http/1.1, HTTP/2 can make full use of TCP connections more efficiently, avoiding the repetitive creation of TCP connections (three handshake) and destroying (four waves).
Reference
- "Http/2 WebRTC all the things!"
- "Implementing HTTP/2 Client in minutes"
Original http://www.blogjava.net/yongboy/archive/2015/03/17/423531.html
The opening of HTTP/2 notes