How can I do congestion control for a UDP protocol?

后端 未结 5 1398
深忆病人
深忆病人 2021-02-05 17:29

I have a custom UDP protocol with multiple senders/receivers designed to send large files around as fast as possible. It is client/server based.

How can I detect conge

5条回答
  •  暖寄归人
    2021-02-05 18:02

    I had the following idea:

    • Sender sends the data.
    • Receiver waits a couple of seconds and then calculates the throughput rate / s
    • Receiver sends the rate at which its receiving packets (bytes / s) to sender
    • Sender calculates its rate of sending packets
    • If the rate of sender is significantly higher, reduce it to match receiving rate.

    Alternatively, a more advanced approach:

    • Sender starts sending at a predefined min rate (eg. 1kb / s)
    • Receiver sends the calculated receiving rate back to sender.
    • If the receiving rate is the same as sending rate (taking latency into account) increase the rate by a set pct (eg. rate * 2)
    • Keep doing this until the sending rate becomes higher than receiving rate.
    • Keep monitoring the rates to account for changes in bandwidth increase / reduce rate if needed.

    Disclaimer: im not network expert, this might not work for you.

提交回复
热议问题