(In Lecture 14, I mentioned the performance of HTTP, which can be summarized in six words: "not bad, not good enough". At the same time, I also talked about "thread blockage", but due to time, I didn't elaborate. This time, let's take a good look at the performance of HTTP in the connection.HTTP connection management can also be regarded as an "old-fashioned" topic. You must have heard the terms "short connection" and "long connection". Let's clarify it today.Short circuitHTTP protocol (0.9 / 1.0) was originally a very simple protocol, and the communication process also adopted a simple "request response" mode.Its underlying data transmission is based on TCP / IP. Before sending a request, it needs to establish a connection with the server and close the connection immediately after receiving the response message.Because the whole connection process between the client and the server is very short and does not maintain a long-term connection with the server, it is called "short-term connection". The early HTTP protocol was also called "connectionless" protocol.The disadvantage of short connection is quite serious, because in TCP protocol, establishing and closing connection is a very "expensive" operation. To establish a connection with TCP, there must be a "second handshake", and one RTT is required to send three packets; Closing the connection is "four waves", and two RTTS are required for four packets.A simple "request response" of HTTP usually requires only 4 packets. If the processing time inside the server is not calculated, the maximum is 2 RTTS. In this way, the wasted time is "3 ÷ 5 = 60%", two-thirds of the time is wasted, and the transmission efficiency is surprisingly low.)