1. 问题背景
用sar工具发现tcp的网络重传率比较高(0.15%);这个网络重传率是:cat /proc/net/snmp|grep Tcp
里面的:
重传=
(
RetransSegs
-
last
RetransSegs
)
/
(
OutSegs
-
last
OutSegs
)
来计算的,所以这个网络重传率是网络链路层的,应用层可能不会引起网络包重传。
2. 查询方案
- ping 机器看是否有丢包
A 机器:ping B -n 100
- mtr 工具,主要是看网络是否有loss
My traceroute [v0.71]
hostname (0.0.0.0) Wed Jun 4 20:21:12 2014
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Last Avg Best Wrst StDev
1. localhost
- 如果TCP 通信有延迟,用traceroute 看哪个网络路由(网络一跳、二跳)有延迟;分析rt比较大的IP 地址
/bin/traceroute 172.22.172.136
traceroute to 172.22.172.136 (172.22.172.136), 30 hops max, 40 byte packets
1 172.22.47.251 (172.22.47.251) 1.068 ms 0.901 ms 1.148 ms
2 172.22.63.173 (172.22.63.173) 9.240 ms 9.335 ms 172.22.63.205 (172.22.63.205) 9.119 ms
3 121.0.17.116 (121.0.17.116) 1.099 ms 121.0.17.114 (121.0.17.114) 1.790 ms 15.291 ms
4 42.120.253.54 (42.120.253.54) 17.076 ms 17.160 ms 42.120.253.94 (42.120.253.94) 11.109 ms
5 * * *
6 * * *
7 * * *
/bin/traceroute www.baidu.com
traceroute to www.baidu.com (115.239.211.110), 30 hops max, 40 byte packets
1 172.22.47.251 (172.22.47.251) 0.715 ms 0.593 ms 0.782 ms
2 172.22.63.173 (172.22.63.173) 1.152 ms 172.22.63.205 (172.22.63.205) 0.968 ms 172.22.63.173 (172.22.63.173) 1.239 ms
3 172.22.60.241 (172.22.60.241) 0.656 ms 0.657 ms 0.647 ms
4 121.0.21.86 (121.0.21.86) 1.895 ms 1.894 ms 2.167 ms
5 121.0.17.88 (121.0.17.88) 64.336 ms 121.0.17.124 (121.0.17.124) 2.319 ms 121.0.17.114 (121.0.17.114) 62.625 ms
6 42.120.253.46 (42.120.253.46) 10.143 ms 42.120.253.78 (42.120.253.78) 2.020 ms 42.120.253.66 (42.120.253.66) 2.827 ms
3. 机器双网卡绑定的小工具 bond0
sudo ifconfig eth0 down
sudo ifconfig eht1 up
sudo ifconfig eth1 down
sudo ifconfig eht0 up
cat /proc/net/bonding/bond0
sudo ethtool eth0