这个参数表示操作系统允许TIME_WAIT套接字数量的最大值, 如果超过这个数字,TIME_WAIT套接字将立刻被清除并打印警告信息。
该参数默认为 180000,过多的TIME_WAIT套接字会使Web服务器变慢。
node2:/root/test#sysctl -w net.ipv4.tcp_max_tw_buckets=10
net.ipv4.tcp_max_tw_buckets = 10
node2:/root#netstat -na | grep 8080
tcp 0 0 192.168.137.3:46705 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46696 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46702 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46698 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46697 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46699 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46701 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46700 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46703 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46704 192.168.137.2:8080 TIME_WAIT
node2:/root#netstat -na | grep 8080
tcp 0 0 192.168.137.3:46705 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46696 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46702 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46698 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46697 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46699 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46701 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46700 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46703 192.168.137.2:8080 TIME_WAIT
tcp 0 0 192.168.137.3:46704 192.168.137.2:8080 TIME_WAIT
node2:/root#netstat -na | grep 8080 | wc -l
10
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow
TCP: time wait bucket table overflow