Search code examples
clinuxtcpbacklog

listen() backlog upper limits


even though a lot was said on the topic, I am still stumped.

I experiment with a monster linux server capable of handling proper load ramps, presumably many thousand connections a second. Now, if i check default listen() queue:

#cat /proc/sys/net/core/somaxconn
128

which couldn't be actual queue size at all. I suspect it might be a legacy, and actual size is given by this:

#cat /proc/sys/net/ipv4/tcp_max_syn_backlog
2048

However, man tcp says the latter is connections awaiting ACK from clients, which is different from total number of connections having not yet been accepted, which is what listen() backlog is.

So my question is how can I increase listen() backlog, and how to get/set upper limit of it (right before kernel recompilation)?


Solution

  • somaxconn is the number of complete connections waiting.

    tcp_max_syn_backlog is the number of incomplete connections waiting.

    They aren't the same thing. It's all described in the man page.