HTTP1.0 HTTP 1.1 Main differences
Long Connections
HTTP 1.0 needs to use the keep-alive parameter to tell the server to establish a long connection, while HTTP1.1 supports long connections by default.
HTTP is based on the TCP/IP protocol, the creation of a TCP connection requires three handshake, there is a certain overhead, if each communication is to reestablish the connection, the performance has an impact. Therefore, it is best to maintain a long connection and can send multiple requests with a long connection.
Bandwidth Savings
HTTP 1.1 supports sending only header information (without any body information) and returns 100 if the server thinks the client has permission to request the server, otherwise 401. The client will only start sending the request body to the server if it accepts 100.
This way, when the server returns 401, the client can save bandwidth by not sending the request body.
In addition, HTTP also supports the transfer of part of the content. This way, when the client already has a portion of the resources, it is only necessary to request additional resources from the server. This is the basis for supporting file breakpoint continuation .
Host Domain
It is common for Web servers such as Tomat to set up virtual sites, which means that multiple virtual sites on a Web server can share the same IP and port.
HTTP1.0 does not have a host domain, HTTP1.1 only supports this parameter.
HTTP1.1 HTTP 2.0 Main differences
Multiplexing
HTTP2.0 uses multiplexing technology to handle multiple requests concurrently with the same connection, and the number of concurrent requests is several orders of magnitude larger than HTTP1.1.
Of course HTTP1.1 can also build several TCP connections to support processing more concurrent requests, but creating a TCP connection itself is also expensive.
TCP connection has a process of preheating and protection, first check whether the data transmission success, once successful, then slowly increase the speed of transmission. As a result, the server responds slowly to a transient concurrent connection. So it is best to use a built-in connection, and this connection can support instantaneous concurrent requests.
For multiplexing, refer to learning NiO.
Data Compression
HTTP1.1 does not support header data compression, HTTP2.0 uses the hpack algorithm to compress the header data, so that the data volume is small, the transmission on the network will be faster.
Server Push
This means that when we request data for a Web server that supports HTTP2.0, the server pushes some of the resources that the client needs together to the client, lest the client create a connection to send the request to the server side again. This is a perfect way to load static resources.
Server-side push these resources actually exist somewhere in the client, the client directly from the local load these resources can be, do not go to the network, speed is naturally much faster.
The difference between http1.0,http1.1 and http2.0