3 ms·
How TCP backlog works in Linux (2014)
- majke 12y agoUnfortunately it's not complete: > The maximum length of the queue for incomplete sockets can be set using /proc/sys/net/ipv4/tcp_max_syn_backlog. Yes, but: * http://livegrep.com/search/linux?q=tcp_max_syn_backlog http://livegrep.com/search/linux?q=tcp_max_syn_backlog points to "sysctl_max_syn_backlog" variable * http://livegrep.com/search/linux?q=sysctl_max_syn_backlog http://livegrep.com/search/linux?q=sysctl_max_syn_backlog * Which is used when the "syn backlog queue" or "request_sock_queue" in kernel nomenclature is created: https://github.com/torvalds/linux/blob/v3.17/net/core/request_sock.c#L46 https://github.com/torvalds/linux/blob/v3.17/net/core/reques... But It's a max! The desired value is passed from: * https://github.com/torvalds/linux/blob/v3.17/net/ipv4/inet_connection_sock.c#L746 https://github.com/torvalds/linux/blob/v3.17/net/ipv4/inet_c... * https://github.com/torvalds/linux/blob/v3.17/net/ipv4/af_inet.c#L232 https://github.com/torvalds/linux/blob/v3.17/net/ipv4/af_ine... IE: if you want to have big syn backlog you _MUST_ do two things: * bump tcp_max_syn_backlog to 65535 * bump listen "Backlog" to 65535 Artur Bergman from fastly famously says that "tcp_max_syn_backlog" must not be greater than 65535, but I saw no evidence for that: * https://www.youtube.com/watch?v=6UvK6BS42Jc#t=2036 https://www.youtube.com/watch?v=6UvK6BS42Jc#t=2036