TCP状态迁跃如下:
主动关闭一方会进入time_wati,与应用是客户端服务端无关
被动关闭一方会进入close_wait,与应用是客户端服务端无关
listening socket会维护两个队列:
- incomplete connection queue => max(64, net.ipv4.tcp_max_syn_backlog) when syncookies is disabled
- completely established queue => min(net.core.somaxconn, backlog)
对于客户端,我们需要加大端口范围,加快time_wait回收
- ip_local_port_range, ip_local_reserved_ports
- tcp_fin_timeout