![TCP 奇怪地停止发送](https://linux22.com/image/553630/TCP%20%E5%A5%87%E6%80%AA%E5%9C%B0%E5%81%9C%E6%AD%A2%E5%8F%91%E9%80%81.png)
为了找出连接到同一交换机的 Linux(RHEL,内核 2.6.18)服务器上 TCP 重传的原因。我让一对客户端-服务器每 200us 互相发送一次“Hello”,并在tcpdump
客户端计算机上捕获数据包。我用来模拟客户端和服务器的命令是:
while [ 0 ]; do echo "Hello"; usleep 200; done | nc server 18510
while [ 0 ]; do echo "Hello"; usleep 200; done | nc -l 18510
当服务器忙于处理其他请求时,客户端偶尔会遭遇突然重传。但输出tcpdump
似乎不合理。
16:04:58.898970 IP server.18510 > client.34533: P 4531:4537(6) ack 3204 win 123 <nop,nop,timestamp 1923778643 3452833828>
16:04:58.901797 IP client.34533 > server.18510: P 3204:3210(6) ack 4537 win 33 <nop,nop,timestamp 3452833831 1923778643>
16:04:58.901855 IP server.18510 > client.34533: P 4537:4549(12) ack 3210 win 123 <nop,nop,timestamp 1923778646 3452833831>
16:04:58.903871 IP client.34533 > server.18510: P 3210:3216(6) ack 4549 win 33 <nop,nop,timestamp 3452833833 1923778646>
16:04:58.903950 IP server.18510 > client.34533: P 4549:4555(6) ack 3216 win 123 <nop,nop,timestamp 1923778648 3452833833>
16:04:58.905796 IP client.34533 > server.18510: P 3216:3222(6) ack 4555 win 33 <nop,nop,timestamp 3452833835 1923778648>
16:04:58.905860 IP server.18510 > client.34533: P 4555:4561(6) ack 3222 win 123 <nop,nop,timestamp 1923778650 3452833835>
16:04:58.908903 IP client.34533 > server.18510: P 3222:3228(6) ack 4561 win 33 <nop,nop,timestamp 3452833838 1923778650>
16:04:58.908966 IP server.18510 > client.34533: P 4561:4567(6) ack 3228 win 123 <nop,nop,timestamp 1923778653 3452833838>
16:04:58.911855 IP client.34533 > server.18510: P 3228:3234(6) ack 4567 win 33 <nop,nop,timestamp 3452833841 1923778653>
16:04:59.112573 IP client.34533 > server.18510: P 3228:3234(6) ack 4567 win 33 <nop,nop,timestamp 3452834042 1923778653>
16:04:59.112648 IP server.18510 > client.34533: P 4567:5161(594) ack 3234 win 123 <nop,nop,timestamp 1923778857 3452834042>
16:04:59.112659 IP client.34533 > server.18510: P 3234:3672(438) ack 5161 win 35 <nop,nop,timestamp 3452834042 1923778857>
16:04:59.114427 IP server.18510 > client.34533: P 5161:5167(6) ack 3672 win 126 <nop,nop,timestamp 1923778858 3452834042>
16:04:59.114439 IP client.34533 > server.18510: P 3672:3678(6) ack 5167 win 35 <nop,nop,timestamp 3452834044 1923778858>
16:04:59.116435 IP server.18510 > client.34533: P 5167:5173(6) ack 3678 win 126 <nop,nop,timestamp 1923778860 3452834044>
16:04:59.116444 IP client.34533 > server.18510: P 3678:3684(6) ack 5173 win 35 <nop,nop,timestamp 3452834046 1923778860>
来自客户端的数据包 3228:3234(6) 因确认超时而重新传输。我无法理解的是,在发送第一个 3228:3234(6) 数据包后,客户端计算机没有发送任何数据包。
服务器已通告一个足够大的窗口(缩放)。数据传输到重新传输都很好,这意味着不应发生慢启动。
什么原因会导致客户端机器停止发送直到数据包超时?顺便说一句,我无法tcpdump
在服务器机器上运行。
答案1
只是一些想法:在交换机或服务器上进行流量整形? LAN 上流向服务器的流量是否太多?