500之后的TIME_WAIT

HTTP 500之后,会出现一段时间的TCP "TIME_WAIT"状态。因为500之后,服务器主动关闭了连接,导致TCP进入了"TIME_WAIT"状态。这段时间持续的长度为2个MSL时间长度。

MSL在RFC 1122上建议是2分钟,而源自berkeley的TCP实现传统上使用30秒。

```

caikiki@ubuntu:~$ netstat -pant
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 192.168.170.190:22      192.168.170.1:50463     ESTABLISHED -
tcp        0      0 192.168.170.190:22      192.168.170.1:50656     ESTABLISHED -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 192.168.170.190:80      192.168.170.1:63422     TIME_WAIT   -
caikiki@ubuntu:~$ date
Sun Jan 21 08:55:16 PST 2018

# 一分钟之后

caikiki@ubuntu:~$ netstat -pant
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 192.168.170.190:22      192.168.170.1:50463     ESTABLISHED -
tcp        0      0 192.168.170.190:22      192.168.170.1:50656     ESTABLISHED -
tcp6       0      0 :::80                   :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
caikiki@ubuntu:~$ date
Sun Jan 21 08:56:16 PST 2018

```

参考:

http://blog.oldboyedu.com/tcp-wait/


猜你喜欢

转载自blog.csdn.net/caiqiiqi/article/details/79124504
今日推荐