listen()积压上限 [英] listen() backlog upper limits

查看:106
本文介绍了listen()积压上限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在这个话题上说了很多,我还是很困惑.

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

我尝试了一个能够处理适当的负载上升(可能每秒每秒有数千个连接)的巨型linux服务器.现在,如果我检查默认的listen()队列:

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

但是, man tcp 说,后者是等待来自客户端的ACK的连接,这与尚未接受的连接总数(listen()待办事项)不同.

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.

所以我的问题是如何增加 listen()积压,以及如何获取/设置它的上限(在内核重新编译之前)?

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

推荐答案

somaxconn 是等待 complete 连接的数量.

tcp_max_syn_backlog 是等待的不完整连接数.

他们不是同一回事.在 手册页 中进行了全部描述.

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

这篇关于listen()积压上限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆