listen() backlog upper limits

谁说我不能喝 提交于 2020-06-08 06:28:04

问题


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


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/18122498/listen-backlog-upper-limits

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!