900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > linux tcp重传超时时间 tcp 重传超时次数

linux tcp重传超时时间 tcp 重传超时次数

时间:2022-07-21 08:37:16

相关推荐

linux tcp重传超时时间 tcp 重传超时次数

tcp 重传超时次数

数据被重发以后若还是收不到应答, 则进行再次发送. 此时等待确认应答时间会以 2 倍, 4 倍的指数函数延长.

此外, 数据也不会被无限, 反复的重发. 达到一定的重发次数之后, 如果仍然没有任何确认应答返回, 就会判断为网络或者对端主机发生了异常, 强制关闭连接.

Linux 的设置

最小重传时间是 200ms

最大重传时间是 120s

重传次数为 15TCP retransmits an unacknowledged packet up to tcp_retries2 sysctl setting times(defaults to15)usingan exponential backoff timeoutforwhich each retransmission timeoutisbetween TCP_RTO_MIN(200ms)andTCP_RTO_MAX(120seconds).Oncethe15thretryexpires(bydefault),the TCP stack will notify the layers above(IE.App)ofa broken connection.

ThevalueofTCP_RTO_MINandTCP_RTO_MAXishardcodedintheLinuxkernelanddefinedbythe following constants:

#defineTCP_RTO_MAX((unsigned)(120*HZ))

#defineTCP_RTO_MIN((unsigned)(HZ/5))

Linux 2.6+ uses HZ of 1000ms, so TCP_RTO_MIN is ~200 ms and TCP_RTO_MAX is ~120 seconds. Given a default value of tcp_retries set to 15, it means that it takes 924.6 seconds before a broken network link is notified to the upper layer (IE. application), since the connection is detected as broken when the last (15th) retry expires.

image.PNGFromtheLinuxkernel doc

tcp_retries2-INTEGER

Thisvalueinfluences the timeoutofan alive TCP connection,

when RTO retransmissions remain unacknowledged.GivenavalueofN,a hypothetical TCP connection following

exponential backoffwithan initial RTOofTCP_RTO_MIN would

retransmit N times before killing the connection at the(N+1)th RTO.

Thedefaultvalueof15yields a hypothetical timeoutof924.6

secondsandisa lower boundforthe effective timeout.

TCP will effectively timeoutat the first RTO which exceeds the

hypothetical timeout.

RFC1122recommends at least100secondsforthe timeout,

which corresponds to avalueofat least8.

参考地址

/linux-tcp-rto-min-max-and-tcp-retries2.html

来源: /p/51d7f7fb3e4b

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。