-
Notifications
You must be signed in to change notification settings - Fork 1
How TCP backlog works in Linux
amazingchow edited this page Aug 23, 2021
·
2 revisions
When an tcp server puts a socket into LISTEN state using the listen syscall, it needs to specify a backlog for that socket. The backlog is usually described as the limit for the queue of incoming connections.
Current Linux versions use two distinct queues: a syn-queue with a size specified by a system wide setting and an accept queue with a size specified by the app (the backlog argument). The maximum length of the syn-queue for incomplete sockets can be set using /proc/sys/net/ipv4/tcp_max_syn_backlog. If the backlog argument is greater than the value in /proc/sys/net/core/somaxconn, then it is silently truncated to that value, the default value in this file is 128.