Talked about some knowledge points of the lower-level protocol tcp/ip of http: what tcp/ip needs to do to establish a connection, the delay brought by tcp/ip, and some methods to improve network performance from the perspective of http, involving An overview of serial connections, parallel connections, persistent connections, pipe connections, etc. and concepts such as how to close connections
-
Usually, there are several steps when an http transaction occurs. The following is an example of visiting http://www.xxx.com:80/ggg/index.html:
-
The browser resolves the domain name (host name) from the address bar, that is, to get www.xxx.com
-
The browser queries the ip address according to the obtained host name, for example, the ip is calculated as 202.43.78.3, (the host file may be searched in the middle or the dns server may be queried)
-
The browser resolves the outgoing port (http defaults to 80, https defaults to 443)
-
The browser initiates a link to port 80 of 202.43.78.3, (reconstruction requires several round-trip "handshakes" to determine relevant parameters)
-
The browser initiates the request message
-
The server returns a response message
-
The browser closes the connection (in fact, both the browser and the server can close the connection without notifying each other)
HTTP/1.1 allows optional use of request pipelines over persistent connections. This is a further performance optimization on keep-alive connections. Multiple requests can be queued before a response arrives. As the first request flows over the network to a server on the other side of the world, the second and third requests can also begin to be sent. Under high-latency network conditions, doing so can reduce network loopback time and improve performance.