connection management

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

 

  1. The browser resolves the domain name (host name) from the address bar, that is, to get www.xxx.com

  2. 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)

  3. The browser resolves the outgoing port (http defaults to 80, https defaults to 443)

  4. The browser initiates a link to port 80 of 202.43.78.3, (reconstruction requires several round-trip "handshakes" to determine relevant parameters)

  5. The browser initiates the request message

  6. The server returns a response message

  7. The browser closes the connection (in fact, both the browser and the server can close the connection without notifying each other)

Parallel connection browsing has initiated an http transaction at the same time, because it is parallel, so the delay is also parallel, so the total delay is small, the page rendering is faster, and the experience is better. But that's not always the case, because if the network is slow and multiple connections are competing for less bandwidth, there's no point in speeding things up. There is also a cost for parallel connections, such as increasing system internal training consumption and server load. For example, if there are 100 clients who initiate 100tcp parallel connections to the service at the same time, then the server has to be responsible for 10,000 processing requests. Soon you server will crash. Of course, parallel connections can indeed bring visual speed improvements, because compared to serial connections that display data slowly and all the information can be displayed in parallel, visually parallel connections will give people the feeling of being faster! Persistent link persistent connection describes: if multiple http transaction connections are initiated to the same ip and the same port, you can not close the tcp connection after the previous transaction is completed, so as to reduce the slow start of tcp and tcp. incoming latency piped connection

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326401277&siteId=291194637