net.ipv4.tcp_tw_recycle.The Linux kernel documentation is not very helpful about what
net.ipv4.tcp_tw_recycle does:Enable fast recyclingIts sibling,TIME-WAITsockets. Default value is 0. It should not be changed without advice/request of technical experts.
net.ipv4.tcp_tw_reuse is a little bit more documented
but the language is about the same:Allow to reuseThe mere result of this lack of documentation is that we find numerous tuning guides advising to set both these settings to 1 to reduce the number of entries in theTIME-WAITsockets for new connections when it is safe from protocol viewpoint. Default value is 0. It should not be changed without advice/request of technical experts.
TIME-WAIT state. However, as stated by
tcp(7) manual page, the net.ipv4.tcp_tw_recycle option is quite
problematic for public-facing servers as it won’t handle connections
from two different computers behind the same NAT device, which is a
problem hard to detect and waiting to bite you: