There are some tricky parts in configuring SRT, like maxbw, SRTO_SNDBUF, SRTO_RCVBUF, SRTO_FC that have to be adjusted to the expected sending bitrate and RTT.
Helper functions will be useful for that.
Here all such functions will be accumulated, to be later included into SRT code base.
Stay in sync with SRT Deployment Guide.
See also #621.
Default receiver buffer size is 8192 脳 (1500-28) = 12058624 bytes or approximately 96 Mbits.
Default flow control window size is 25600 packets or approximately 300 Mbits.
The target number of packets in flight (FC window) should be (assuming max payload size):
FC = bps 脳 RTTsec / 8 / (1500 - 28).
For example for 1,5 Gbps link with 150 ms RTT:
FC = 1500 脳 106 脳 0.15 / 8 / (1472) = 19106 packets (or 225 Mbits).
For 2,0 Gbps link with 150 ms RTT:
FC = 2 脳 109 脳 0.15 / 8 / (1472) = 25475 packets (or 300 Mbits).
Flow control window limits the number of packets in flight. Those packets are not only packets being literally in flight to the receiver and back via ACK message, but also unacknowledged packets due to losses. This means, that if the very first packet of the transmission was lost, then the whole flight window will not be acknowledged. And thus the sender will be blocked by this window, not allowing to send more data. Therefore FC should by higher than the actual number of packet in flight, e.g. twice higher.
SRTO_RCVBUFrcvbufdef calc_rcv_buf_bytes(rtt_ms, bps, latency_ms):
return (latency_ms + rtt_ms / 2) * bps / 1000 / 8
Pseudocode:
auto srt_suggest_buffer_config(int msRTT, int bps, int msLatency)
{
const int FC = 2 * bps * msRTT / 1000 / 8 / (1500 - 28);
const int rcvBufBytes = (msLatency + msRTT / 2) * bps / 1000 / 8;
const int sndBufBytes = rcvBufSize;
return {rcvBufBytes, sndBufBytes, FC};
}
See issue #700
Most helpful comment
Buffer Sizes and Flow Control Window Size
Default receiver buffer size is
8192 脳 (1500-28) = 12058624bytes or approximately 96 Mbits.Default flow control window size is 25600 packets or approximately 300 Mbits.
The target number of packets in flight (FC window) should be (assuming max payload size):
FC = bps 脳 RTTsec / 8 / (1500 - 28).
For example for 1,5 Gbps link with 150 ms RTT:
FC = 1500 脳 106 脳 0.15 / 8 / (1472) = 19106 packets (or 225 Mbits).
For 2,0 Gbps link with 150 ms RTT:
FC = 2 脳 109 脳 0.15 / 8 / (1472) = 25475 packets (or 300 Mbits).
Flow control window limits the number of packets in flight. Those packets are not only packets being literally in flight to the receiver and back via ACK message, but also unacknowledged packets due to losses. This means, that if the very first packet of the transmission was lost, then the whole flight window will not be acknowledged. And thus the sender will be blocked by this window, not allowing to send more data. Therefore FC should by higher than the actual number of packet in flight, e.g. twice higher.
Receiver Buffer Size
SRTO_RCVBUFrcvbufTo delete (old version)
Pseudocode:
See issue #700