📜  TCP Tahoe 和 TCP Reno

📅  最后修改于: 2022-05-13 01:57:03.116000             🧑  作者: Mango

TCP Tahoe 和 TCP Reno

TCP 被称为面向连接的协议,它确保了可靠性,并且还负责网络中的拥塞控制机制。 TCP Tahoe 和 TCP Reno 是 TCP 拥塞控制的两种技术,在发送方收到三个重复确认时使用。

TCP太浩:

太浩湖是美国的一个湖。这个特殊的 TCP 是围绕那个湖设计的,因此它被命名为TCP Tahoe 。它是第一个具有内置拥塞控制算法的 TCP 变体。当 TCP 于 1981 年首次设计时,拥塞控制并不是它不可或缺的一部分。

慢启动阶段:一直持续到拥塞窗口大小达到“慢启动阈值(ssthresh) ”。慢启动算法在一个 RTT 中将拥塞窗口大小 (cwnd) 加倍。最初,ssthresh 设置为无限(∞)。随后,它根据丢包事件进行调整。当 cwnd 等于 ssthresh 时,慢启动停止。之后,AIMD 阶段接管。

AIMD阶段:当慢启动停止时开始。加法增加将 cwnd 增加 1,乘法减少将 ssthresh 减少到 cwnd 的 50%。请注意,cwnd 不是“减少”50%,而是 ssthresh。这是需要注意的一点,cwnd 再次重置为初始窗口大小(Linux 内核中为 10)。

快速重传阶段:是丢失检测算法。它由 3 个重复确认触发。在检测到丢包时,它会将 cwnd 重置为 initcwnd。

Example:
Suppose cwnd = 200 and packet loss occurs, then
ssthresh=cwnd/2= 100; cwnd will be reset to initcwnd value that is 10.
Again slow start will begin.
Now say cwnd increases to 20, 40, 80 and 100 in 5th RTT.
Once cwnd reached ssthresh, AIMD starts. 
AIMD increases cwnd by 1 per RTT, so if packet drop occurs at cwnd = 125
then cwnd=10 and ssthresh=62 and Slow Start Restarts.
Note: Packet loss can be detected either by RTO algorithm or Fast Retransmit. In both cases, cwnd will be reset to 10
and ssthresh=cwnd/2 and Slow Start restarts again.
TCP 太浩

TCP 太浩

TCP 雷诺:

它是 TCP Tahoe 的扩展。

由于 TCP Reno 是 TCP Tahoe 的扩展,所以慢启动和 AIMD 阶段是一样的。

快速恢复阶段

它同时使用 RTO 和快速重传。如果丢包检测是由 3 个重复确认触发的,那么它是一种快速重传算法。在通过快速重传进行丢包检测时,cwnd 减少了 50% (cwnd = cwnd/2)。接收到 3 个重复的 ACK,这意味着网络运行良好,因为正在接收 ACK,这意味着数据包正在传送到接收器。因此,cwnd 减少了 50%,以使网络脱离拥塞状态。在通过 RTO 检测丢包时,将 cwnd 重置为 initcwnd。如果 RTO 计时器到期,则意味着网络严重拥塞。因此,必须将 cwnd 降低到初始值才能使网络从拥塞中恢复。

TCP 里诺

TCP 里诺

Example:
cwnd=120, ssthresh=∞
1) packet loss detected using 3-duplicate ACK (aka Fast Retransmit).
cwnd will be reduced to 50%, cwnd=60
ssthresh will be new cwnd, ssthresh=60
Now Reno has entered Fast Recovery Phase, it skips the slow start and AIMD takes over. Whereas in Tahoe
Slow Start restarts when packet loss is detected. This is the difference between these two.

2) Now say cwnd is reached to 70 in 10 more RTT from cwnd=60, after AIMD started.
packet drop occurs at cwnd=70, cwnd becomes 35 and ssthresh=35.

3) now cwnd increases to 50, and packet loss detected using RTO.
then cwnd=initial cwnd= 10, ssthresh=cwnd/2=25

Whenever packet loss detected, Reno never uses Slow Start again, it skip it.

TCP Tahoe 和 Reno 的比较图:

TCP Tahoe 和 TCP Reno

TCP Tahoe 和 Reno