3

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)?

wick
  • 1,995
  • 2
  • 20
  • 31
  • 4
    'which couldn't be actual queue size at all' - why not? Bounded queues only overflow if the rate of push is consistently greater than the rate of pop. – Martin James Aug 08 '13 at 11:27

2 Answers2

6

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
5

You increase it by following these instructions: https://serverfault.com/questions/271380/how-can-i-increase-the-value-of-somaxconn - basically by using sysctl.

And yes, somaxconn is the cap on listen backlog.

Community
  • 1
  • 1
John Zwinck
  • 239,568
  • 38
  • 324
  • 436