开发者

Know the size of accept pending connections queue in GNU/Linux

开发者 https://www.devze.com 2023-02-07 04:29 出处:网络
In a typical C network server implementation, the size of the accept pending queue can be set with listen. When a new connection incomes and there is no more space in the queue, ECONNREFUSED is send t

In a typical C network server implementation, the size of the accept pending queue can be set with listen. When a new connection incomes and there is no more space in the queue, ECONNREFUSED is send to the client or the request is ignored.

Is any way to know the state of this queue? It's important because in a high load event-based daemon, we're detecting some retries from the client, and we suspect that this queue goes full and the connection tries are being ignored.

Thanks in adv开发者_如何学Goance.


in linux: /proc/sys/net/ipv4/tcp_max_syn_backlog:

Maximal number of remembered connection requests, which are still did not receive an acknowledgment from connecting client.

Default value is 1024 for systems with more than 128Mb of memory, and 128 for low memory machines. If server suffers of overload, try to increase this number.

/proc/sys/net/core/somaxconn: Limit of socket listen() backlog, known in userspace as SOMAXCONN. Defaults to 128. See also tcp_max_syn_backlog for additional tuning for TCP sockets.

these are the relevant sysctls .. on openbsd that i am sitting now a quick sysctl -a reveals: net.inet.ip.maxqueue=300

0

精彩评论

暂无评论...
验证码 换一张
取 消