Time wait bucket overflow

1. Review current connections

  • Check which port has the most of TW connections
  • Dump all time-wait connections to a file
# ss -antp state time-wait > /tmp/tw-connections-`date +%Y%m%d` 
  • Get local TW for the local ports
# cat /tmp/tw-connections-`date +%Y%m%d` | awk '{print $3}' | sort | uniq -c | sort -k 1 -n -r | head
    • Example output
   2619 10.0.20.15:80
    711 127.0.0.1:28080
    496 127.0.0.1:8080
    438 127.0.0.1:18080
     12 10.0.20.15:10050
    • Local Port 80 has 2619 connections on Time-Wait
  • Get remote TW for the local ports
# cat /tmp/tw-connections-`date +%Y%m%d` | awk '{print $4}' | sort | uniq -c | sort -k 1 -n -r | head
  • Check number of connections that are in TIME_WAIT state.
# wc -l /tmp/tw-connections-`date +%Y%m%d` 
  • Add to the escalation request
  • Get a summary of current connections
# ss -s 

2. Verify kernel setting for tcp_max_tw_buckets.

# cat /proc/sys/net/ipv4/tcp_max_tw_buckets 
  • The correct value is 180000
 180000 

3. Verify kernel setting for tcp_fin_timeout.

 
# cat /proc/sys/net/ipv4/tcp_fin_timeout
  • By our standards it should be 30
 30 

4. If TCP related kernel setting are not properly set, we need to modify those setting manually.

  • Check if appropriate kernel setting exist in sysctf.conf file
# cat /etc/sysctl.conf | grep tcp_max_tw_buckets
net.ipv4.tcp_max_tw_buckets = 5000 
# cat /etc/sysctl.conf | grep net.ipv4.tcp_fin_timeout
net.ipv4.tcp_fin_timeout = 30 
  • Modify values in /etc/sysctl.conf file
# vi /etc/sysctl.conf 
net.ipv4.tcp_max_tw_buckets = 180000
net.ipv4.tcp_fin_timeout = 30 
  • Apply changes and check current TW max bucket value
# sysctl -p 
# cat /proc/sys/net/ipv4/tcp_max_tw_buckets 
# cat /proc/sys/net/ipv4/tcp_fin_timeout
  • Monitor logs and number of Time Wait connections for some time.

转载于:https://my.oschina.net/am313/blog/681017

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值