zoukankan      html  css  js  c++  java
  • Flow Control & Congestion Control

    In order to make sure that every packet reaches its destination, we use Retransmit. There are 3 approaches: Stop-and-Wait, Go Back N and Selective Repeat.

    • Stop-and-Wait
      Sender transmits packet one by one, label each with a sequence number and sets timer after transmitting. If receive ACK, send next. If timer goes off, resend the previous packet.
      When receive packet, send ACK. If packet is corrupted, ignore it and sender will resend.
    • SR
      Send packets from the window and set timeout for each packet. On receiving ACK for left side of the window, slide forward and send packets that have now entered the window. On timeout, resend only the timed out packet.
      Receiver keeps a buffer of size of the window. On receiving packets, send ACK. If packet comes in out of order, just store it in the buffer and send ACK anyway.

    How big should we size the sender's window

    Don't overload the receiver. Sender cannot send as fast as possible since it will overflow the receiver's buffer.
    在这里插入图片描述
    The solution is Advertised Window (W): tell the sender how much space the receiver's buffer has through ACK. So the window size of the sender: the size <= W. Thus we won't overload the receiver. This is Flow Control.

    But if we set the size to W, we cannot solve the problem thoroughly:
    在这里插入图片描述
    Sender's window contains a set of packets that have been transmitted but not yet acked. But some packets will get dropped at router and sender will never receive ACKs for these packets. The result is these packets will remain buffered in the window. It means that we cannot set the size to W, we only want to send at 50Mbps. It will take a RTT(200ms) to receive an ACK back for the first packet. We will send 50*200=1.25MB data and that's exactly the definition of the sender's window.

    The window size of the sender should <= bandwidth-delay product (BDP). Thus we won't overload the network. This is Congestion Control. BDP is the "volume" of the link, the amount of data that can be "in flight" at any time.

    How should we determine the BDP

    Things are much harder to calculate the BDP:

    • We don't know the bandwidth or RTT
    • My share of bandwidth is dependent on the other user on the network, so the window size will change as other users start or stop sending
    • The router will stall the excess packets in the bottleneck queue instead of dropping, so you can overshoot the size a little bit

    There are many algorithms to solve the problem given the prior constraints. The old one is Reno, although no one uses it anymore, sigh!!

    Use Multiplicative Increase at startup to find the right sending rate quickly, this process is called "slow start";
    Then uses Additive Increase/Multiplicative Decrease (AIMD) to adjust the sending rate over time.
    在这里插入图片描述

    Reference

    CMU 15-441 TCP Part 2

  • 相关阅读:
    有几个点会导致插件包不出现
    JScrollPane恢复正常滚动量
    java jlabel 对齐_java将JLabel中的文本右对齐
    SVN的安装和使用手册
    idea生成类注释和方法注释的正确方法
    关于RCP中英文的一些总结
    精通Hibernate类与类关联关系:[一]建立多对一的单向关联关系
    Hibernate笔记=>继承关系的映射[转 王继彬]
    Unity(六):使用场景Ⅲ:用于依赖注入(上)
    NHibernate之旅(13):初探立即加载机制[转 Blog 李永京]
  • 原文地址:https://www.cnblogs.com/EIMadrigal/p/14448307.html
Copyright © 2011-2022 走看看