There is a TCP-backlog configuration in redis2.8, which is described as follows:
# TCP listen () backlog.
#
# In high requests-per-second environments you need an high backlog in order
# To avoid slow clients connections issues. Note that the Linux Kernel
# Will silently truncate it to the value of/proc/sys/NET/CORE/somaxconn so
# Make sure to raise both the value of somaxconn and tcp_max_syn_backlog
# In order to get the desired effect.
TCP-Back log 100
Then run the SS Command to display:
12 |
State Recv - Q Send - Q Local Address:Port Peer Address:Port LISTEN 0 100 * : 6379 * : * |
We can see that the value of send-Q is 100, which is the TCP-backlog value we configured. to understand the meaning of this value, I learned some queue knowledge about TCP's three-way handshake. we can see that when the server receives the sny, it will enter a SYN queue. When the server finally receives the ACK, it will switch to the accept queue. the connection shown on the above terminal in the listen status, and its send-Q is the maximum value of this accept queue. the connection will be removed from the queue only after the server executes accept. the size of this value is affected by somaxconn, because it is the minimum value of both of them, so to increase it, you must modify the somaxconn value of the kernel.
Reference: http://jaseywang.me/2014/07/20/tcp-queue-%E7%9A%84%E4%B8%80%E4%BA%9B%E9%97% AE %E9%A2%98/
Redis TCP-backlog Configuration