In the TCP/IP protocol, backlog analysis and settings, and TCP status changes. In the TCP/IP protocol, the first section describes how to set the backlog value. What is this value? We all know that TCP requires three-way handshake when establishing a connection. But if the three-way handshake is complete, the server will handle it (accept). If not, what will happen, if the accept is not timely, the client will fail to connect or the connection will fail. In this way, we can't talk about throughput. We think that TCP is not so designed. Backlog is actually a connection queue. The following formula shows the size of the backlog queue. Total of backlog queues = incomplete three-way handshake queues + three-way handshake queues have been completed. The preceding parameters are described as follows: Unfinished three-way handshake Queues: the server receives the client syn Packet (connect) when the server is in the listen status) into the unfinished queue. Three-way handshake queue has been completed: the second status of the three-way handshake is after the server syn + ack responds to the client, before the third status ack message arrives (the client sends the syn ack to the server) keep it in the unfinished connection queue. If the three-way handshake is completed, this entry will move the connection queue that has never been completed to the end of the completed connection queue. backlog parameter settings can be set either in the Linux Kernel Parameter settings (modifying the file/etc/sysctl parameters) or when the socket system calls the listen function (the second parameter ), the difference between the two is that the former is global and affects all sockets. The latter is local and affects the current socket. Figure 1 below shows the status of changes in the backlog queue when the server calls accept, a socket is taken from the header of the completed (three-way handshake) queue to connect to the process. The following is the process of change.