Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] SRT configuration helper functions #703

Closed
maxsharabayko opened this issue May 24, 2019 · 1 comment · Fixed by #1951
Closed

[FR] SRT configuration helper functions #703

maxsharabayko opened this issue May 24, 2019 · 1 comment · Fixed by #1951
Assignees
Labels
[apps] Area: Test applications related improvements Type: Enhancement Indicates new feature requests
Milestone

Comments

@maxsharabayko
Copy link
Collaborator

maxsharabayko commented May 24, 2019

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.

@maxsharabayko maxsharabayko added the Type: Enhancement Indicates new feature requests label May 24, 2019
@maxsharabayko
Copy link
Collaborator Author

maxsharabayko commented May 24, 2019

Buffer Sizes and Flow Control Window Size

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.

Receiver Buffer Size

  • Socket option: SRTO_RCVBUF
  • URI option: rcvbuf
def calc_rcv_buf_bytes(rtt_ms, bps, latency_ms):
    return (latency_ms + rtt_ms / 2) * bps / 1000 / 8

To delete (old version)

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

@maxsharabayko maxsharabayko pinned this issue Jul 5, 2019
@maxsharabayko maxsharabayko added the [apps] Area: Test applications related improvements label Aug 12, 2019
@maxsharabayko maxsharabayko unpinned this issue Feb 6, 2020
@maxsharabayko maxsharabayko pinned this issue Sep 14, 2020
@mbakholdina mbakholdina added this to the Parking Lot milestone Oct 21, 2020
@mbakholdina mbakholdina changed the title FR: SRT configuration helper functions [FR] SRT configuration helper functions Feb 2, 2021
@mbakholdina mbakholdina modified the milestones: Parking Lot, v1.4.4 May 26, 2021
@maxsharabayko maxsharabayko unpinned this issue Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[apps] Area: Test applications related improvements Type: Enhancement Indicates new feature requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants