mengelbart / rtp-over-quic-draft

Other
14 stars 5 forks source link

Congestion Control and Rate Control #128

Closed aboba closed 1 year ago

aboba commented 1 year ago

From the AVTCORE WG mailing list: https://mailarchive.ietf.org/arch/msg/avt/7IFLBJAmFbB3f1_OgkoPyN0lhT8/

Looking over the coverage of Congestion Control and Rate Control, the two topics appear to be conflated in places and also there appear to be some issues that have not been fully considered.

Section 1.2.2

While the effect of QUIC's response to congestion means that some RTP packets will arrive at the receiver later than a user of the RTP flow might prefer, it is still preferable to "ceasing transmission" completely until the RTP sender has a reason to believe that restarting the flow will not result in congestion.¶

[BA] In contrast to circuit breakers, which do not restrict the ability to send RTCP feedback, QUIC congestion control affects RTCP feedback, not just RTP. So saying QUIC congestion control is "preferable" seems questionable.

Moreover, when a single QUIC connection is used to multiplex both RTP-RTCP and non-RTP packets as described in Section 1.2.5 the QUIC connection will still be Internet-safe, with no coordination required.

[BA] While it may be "Internet-safe", delays in RTCP feedback are likely to destabilize rate control as well as resulting in challenges to A/V sync. So not sure that "Internet-safe" is the only important metric here.

Section 1.2.3

One word of caution is in order - RTP implementations may rely on at least some minimal periodic RTCP feedback, in order to determine that an RTP flow is still active, and is not causing sustained congestion (as described in RFC8083, but since this "periodicity" is measured in seconds, the impact of this "duplicate" feedback on path bandwidth utilization is likely close to zero.

[BA] Under congestion, RTCP feedback can potentially be delayed substantially. Here the issue is not "bandwidth utilization" but whether RTCP receives the transport treatment required for control traffic. Note also that similar considerations apply to treatment of audio vs. video. Serious problems with a/v sync are possible (or even likely) under congestion.

Section 1.2.4

This is especially useful in certain conferencing topologies, where otherwise senders have no choice but to use the lowest path MTU for all conference participants, but even in point-to-point RTP sessions, this also allows senders to piggyback audio media in the same UDP packet as video media, for example, and also allows QUIC receivers to piggyback QUIC ACK frames on any QUIC frames being transmitted in the other direction.¶

[BA] The draft does not talk much about piggybacking of audio and video media, but we have seen some implementations experimenting with this to avoid audio/video sync issues without having to resort to other techniques such as prioritization. Is this something that deserves more discussion?

Section 2

Rate control:

A congestion control mechanism that helps a sender determine and adjust its sending rate, in order to maximize the amount of information that is sent to a receiver, without causing queues to build beyond a reasonable amount, causing "buffer bloat" and "jitter". Rate adapation is one way to accomplish congestion control for real-time media, especially when a sender has multiple media streams to the receiver, because the sum of all sending rates for media streams must not be high enough to cause congestion on the path these media streams share between sender and receiver.¶

[BA] Rate control and congestion control are distinct. So the definition here doesn't seem right, particularly for RoQ where congestion control is built into QUIC while rate adaptation is application and even codec-specific as you state later in the document.

Elsewhere in the document, the relationship is stated more clearly. QUIC congestion control limits the amount that can be sent. Since realtime applications seek to achieve low latency, they will typically prefer to respond to bandwidth limitations by controlling rate, rather than experiencing queueing delays or increased loss.

But since congestion control and rate control are distinct and are handled at different layers, rate control is not "one way to accomplish congestion control" but rather "one way to respond to send rate limitations imposed by congestion control algorithms".

Section 3

A rate adaptation algorithm can be plugged in to adapt the media bitrate to the available bandwidth. This document does not mandate any specific rate adaptation algorithm, because the desired response to congestion can be application and codec-specific. For example, adjusting quantization in response to congestion may work well in many cases, but if what's being shared is video that includes text, maintaining readability is important.

[BA] This text is good. I believe it should be placed earlier in the document (perhaps in the scope section).

As of this writing, the IETF has produced two Experimental-track rate adaptation specifications, Network-Assisted Dynamic Adaptation (NADA) [ RFC8698 https://www.rfc-editor.org/rfc/rfc8698] and Self-Clocked Rate Adaptation for Multimedia (SCReAM) [RFC8298 https://www.rfc-editor.org/rfc/rfc8298]. These rate adaptation algorithms require some feedback about the network's performance to calculate target bitrates. Traditionally this feedback is generated at the receiver and sent back to the sender via RTCP.

[BA] Within the context of the previous paragraph is it correct to characterize these specifications as "rate adaptation algorithms"? The previous paragraph mentions QP-based rate control which is indeed codec and application specific. NADA, SCReAM, gcc, etc. were developed as congestion control algorithms and therefore they do not provide application and codec-specific rate control mechanisms. Elswhere you characterize NADA and SCReAM as "congestion control algorithms", which seems correct.

Section 6

Like any other application on the internet, RoQ applications need a mechanism to perform congestion control to avoid overloading the network. While any generic congestion controller can protect the network, this document takes advantage of the opportunity to use rate adaptation mechanisms that are designed to provide superior user experiences for real-time media applications.¶ https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#section-6-1

[BA] This paragraph appears to conflate congestion control and rate control. Congestion control is built into QUIC, and RoQ therefore inherits it. So RoQ applications have a mechanism for congestion control.

Since earlier it was stated that there is no normative guidance on rate control, how can "this document take advantage of the opportunity to use rate adaptation mechanisms that are designed to provide superior user experiences"?

A wide variety of rate adaptation algorithms for real-time media have been developed (for example, "Google Congestion Controller" [ I-D.draft-ietf-rmcat-gcc https://datatracker.ietf.org/doc/html/draft-ietf-rmcat-gcc-02]). The IETF has defined two algorithms in two Experimental RFCs (e.g. SCReAM [RFC8298 https://www.rfc-editor.org/rfc/rfc8298] and NADA [RFC8698 https://www.rfc-editor.org/rfc/rfc8698]). These rate adaptation algorithms for RTP are specifically tailored for real-time transmissions at low latencies, but this section would apply to any rate adaptation algorithm that meets the requirements described in "Congestion Control Requirements for Interactive Real-Time Media" [RFC8836 https://www.rfc-editor.org/rfc/rfc8836].

[BA] As noted earlier, NADA, etc. are not rate control algorithms (e.g. per-frame QP), they are congestion control algorithms and should be referred to as such.

This document defines two architectures for congestion control and bandwidth estimation for RoQ, depending on whether most rate adaptation is performed within a QUIC implementation at the transport layer, as described in Section 6.1 https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#cc-quic-layer, or within an RTP application layer, as described in Section 6.2 https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#cc-application-layer, but this document does not mandate any specific congestion control or rate adaptation algorithm for either QUIC or RTP.¶ https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#section-6-3

[BA] QUIC implementations cannot implement rate control, because as you state earlier, that is application and/or codec-specific. So again you seem to be conflating congestion control and rate control.

It is assumed that the congestion controller in use provides a pacing mechanism to determine when a packet can be sent to avoid bursts. The currently proposed congestion control algorithms for real-time communications (e.g. SCReAM and NADA) provide such pacing mechanisms. The use of congestion controllers which don't provide a pacing mechanism is out of scope of this document. https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#section-6-6

[BA] In this paragraph you correctly refer to SCReaM and NADA as congestion control algorithms. Please use this terminology consistently.

Section 6.1

If a QUIC implementation is to perform rate adaptation in a way that accommodates real-time media, one way for the implementation to recognize that it is carrying real-time media is to be explicitly told that this is the case. This document defines a new "TLS Application-Layer Protocol Negotiation (ALPN) Protocol ID", as described in Section 4 https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#alpn, that a QUIC implementation can use as a signal to choose a real-time media-centric rate controller, but this is not required for ROQ deployments. ¶ https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#section-6.1-2

[BA] Again, QUIC implementations do not perform rate adaptation. That is an application layer function. I think you mean "perform congestion control" here.

Congestion control is orthogonal to the use of an ALPN, so mixing these two concepts is problematic.

If congestion control is to be applied at the transport layer, it is RECOMMENDED that the QUIC Implementation uses a congestion controller that keeps queueing delays short to keep the transmission latency for RTP and RTCP packets as low as possible, such as the IETF-defined SCReAM [RFC8298 https://www.rfc-editor.org/rfc/rfc8298] and NADA [RFC8698 https://www.rfc-editor.org/rfc/rfc8698] algorithms.¶ https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#section-6.1-3

[BA] You might also mention L4S here. This seems more likely to be supported as a built-in QUIC CC mechanism than the other low latency algorithms you mention in the draft.

If congestion control is done by the QUIC implementation, the application needs a mechanism to query the currently available bandwidth to adapt media codec configurations. The employed congestion controller of the QUIC connection SHOULD expose such an API to the application. If a current bandwidth estimate is not available from the QUIC congestion controller, the sender can either implement an alternative bandwidth estimation at the application layer as described in Section 6.2 https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#cc-application-layer or a receiver can feedback the observed bandwidth through RTCP, e.g., using [I-D.draft-alvestrand-rmcat-remb https://datatracker.ietf.org/doc/html/draft-alvestrand-rmcat-remb-03].¶ https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#section-6.1-5

[BA] This paragraph is good, since it describes how the QUIC implementation provides info to the application, to be used in rate control. I think you need to be more clear about the relationship throughout the document.

However, normative language is problematic because this document cannot have normative API dependencies. Also, you need to be careful with references to drafts which will not be published as RFCs, particularly REMB which has been deprecated in favor of transport CC.

Section 6.2

The rate adaptation algorithms for RTP are specifically tailored for real-time transmissions at low latencies, as described in Section 6 https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#congestion-control. The available rate adaptation algorithms expose a target_bitrate that can be used to dynamically reconfigure media codecs to produce media at a rate that can be sent in real-time under the observed network conditions.¶ https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#section-6.2-2

[BA] Again, there is a conflation of rate adaptation and congestion control. In this paragraph "congestion control algorithms" should be used instead of "rate control algorithms".

Section 6.3

Because QUIC is a congestion-controlled transport, as described in Section 6.1 https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#cc-quic-layer, and RTP applications can also perform congestion control and rate adaptation,

[BA] Since congestion control is built into QUIC, RoQ applications can only do rate control, not congestion control.

[BA] This document probably isn't the right place to discuss this, but it is a very big issue that has limited the deployment of the algorithms produced by RMCAT, because probing was supported by gcc and not in the NADA, SCreAM, etc. In practice, fixing this problem requires probing controlled by the CC algorithm at the QUIC layer. So far I'm not aware of any QUIC implementations which support this kind of probing.

fideltian commented 1 year ago

Very interesting record. Is congestion control a must for RTP over Quic? why not let application layer to do congest control and bitrate control? Then it will have broad usage, especially on real time data or low latency data.

Another idea is Why not raw UDP alike solution(such as Direct Sockets( https://wicg.github.io/direct-sockets/).) or limited "congest control" for "RTP over Quic". "Limited" means satisfy the minimum requirement of security if really need.

mengelbart commented 1 year ago

I opened PR #134 to address some of these issues. See some comments below:

From the AVTCORE WG mailing list: https://mailarchive.ietf.org/arch/msg/avt/7IFLBJAmFbB3f1_OgkoPyN0lhT8/

Looking over the coverage of Congestion Control and Rate Control, the two topics appear to be conflated in places and also there appear to be some issues that have not been fully considered.

Section 1.2.2

While the effect of QUIC's response to congestion means that some RTP packets will arrive at the receiver later than a user of the RTP flow might prefer, it is still preferable to "ceasing transmission" completely until the RTP sender has a reason to believe that restarting the flow will not result in congestion.¶

[BA] In contrast to circuit breakers, which do not restrict the ability to send RTCP feedback, QUIC congestion control affects RTCP feedback, not just RTP. So saying QUIC congestion control is "preferable" seems questionable.

Moreover, when a single QUIC connection is used to multiplex both RTP-RTCP and non-RTP packets as described in Section 1.2.5 the QUIC connection will still be Internet-safe, with no coordination required.

[BA] While it may be "Internet-safe", delays in RTCP feedback are likely to destabilize rate control as well as resulting in challenges to A/V sync. So not sure that "Internet-safe" is the only important metric here.

Section 1.2.3

One word of caution is in order - RTP implementations may rely on at least some minimal periodic RTCP feedback, in order to determine that an RTP flow is still active, and is not causing sustained congestion (as described in RFC8083, but since this "periodicity" is measured in seconds, the impact of this "duplicate" feedback on path bandwidth utilization is likely close to zero.

[BA] Under congestion, RTCP feedback can potentially be delayed substantially. Here the issue is not "bandwidth utilization" but whether RTCP receives the transport treatment required for control traffic. Note also that similar considerations apply to treatment of audio vs. video. Serious problems with a/v sync are possible (or even likely) under congestion.

I think these are good points, but since #134 is already quite large, I will create a new issue to address these separately.

Section 1.2.4

This is especially useful in certain conferencing topologies, where otherwise senders have no choice but to use the lowest path MTU for all conference participants, but even in point-to-point RTP sessions, this also allows senders to piggyback audio media in the same UDP packet as video media, for example, and also allows QUIC receivers to piggyback QUIC ACK frames on any QUIC frames being transmitted in the other direction.¶

[BA] The draft does not talk much about piggybacking of audio and video media, but we have seen some implementations experimenting with this to avoid audio/video sync issues without having to resort to other techniques such as prioritization. Is this something that deserves more discussion?

I think this could be addressed in #86.

Section 2

Rate control:

A congestion control mechanism that helps a sender determine and adjust its sending rate, in order to maximize the amount of information that is sent to a receiver, without causing queues to build beyond a reasonable amount, causing "buffer bloat" and "jitter". Rate adapation is one way to accomplish congestion control for real-time media, especially when a sender has multiple media streams to the receiver, because the sum of all sending rates for media streams must not be high enough to cause congestion on the path these media streams share between sender and receiver.¶

[BA] Rate control and congestion control are distinct. So the definition here doesn't seem right, particularly for RoQ where congestion control is built into QUIC while rate adaptation is application and even codec-specific as you state later in the document.

I tried to fix this in #134. I added another definition for bandwidth estimation, because I think that was also conflated with the other terms. In my understanding, congestion control is what the transport layer does to avoid transmitting too much data in-flight and overloading the network. Bandwidth estimation is necessary to calculate a bitrate and rate adaptation is how a sender decides what to send while being limited to the estimated bandwidth. Congestion control should happen at QUIC layer and rate adaptation at the application, but bandwidth estimation can be done by both and depends on the APIs provided by QUIC.

Please let me know what you think about the changes I made.

Elsewhere in the document, the relationship is stated more clearly. QUIC congestion control limits the amount that can be sent. Since realtime applications seek to achieve low latency, they will typically prefer to respond to bandwidth limitations by controlling rate, rather than experiencing queueing delays or increased loss.

But since congestion control and rate control are distinct and are handled at different layers, rate control is not "one way to accomplish congestion control" but rather "one way to respond to send rate limitations imposed by congestion control algorithms".

Section 3

A rate adaptation algorithm can be plugged in to adapt the media bitrate to the available bandwidth. This document does not mandate any specific rate adaptation algorithm, because the desired response to congestion can be application and codec-specific. For example, adjusting quantization in response to congestion may work well in many cases, but if what's being shared is video that includes text, maintaining readability is important.

[BA] This text is good. I believe it should be placed earlier in the document (perhaps in the scope section).

I will open another issue/pull request for this.

As of this writing, the IETF has produced two Experimental-track rate adaptation specifications, Network-Assisted Dynamic Adaptation (NADA) [ RFC8698 https://www.rfc-editor.org/rfc/rfc8698] and Self-Clocked Rate Adaptation for Multimedia (SCReAM) [RFC8298 https://www.rfc-editor.org/rfc/rfc8298]. These rate adaptation algorithms require some feedback about the network's performance to calculate target bitrates. Traditionally this feedback is generated at the receiver and sent back to the sender via RTCP.

[BA] Within the context of the previous paragraph is it correct to characterize these specifications as "rate adaptation algorithms"? The previous paragraph mentions QP-based rate control which is indeed codec and application specific. NADA, SCReAM, gcc, etc. were developed as congestion control algorithms and therefore they do not provide application and codec-specific rate control mechanisms. Elswhere you characterize NADA and SCReAM as "congestion control algorithms", which seems correct.

Do we need the reference to these algorithms in the overview section at all? As explained in the updated section 7, they can only be used when QUIC timestamp extensions are available and that is discussed in detail in section 7. I suggest removing this paragraph.

Section 6.3

Because QUIC is a congestion-controlled transport, as described in Section 6.1 https://datatracker.ietf.org/doc/html/draft-ietf-avtcore-rtp-over-quic-05#cc-quic-layer, and RTP applications can also perform congestion control and rate adaptation,

[BA] Since congestion control is built into QUIC, RoQ applications can only do rate control, not congestion control.

I tried to shorten and merge this section into the previous one. Please let me know if you think we should keep it as a separate section.

SpencerDawkins commented 1 year ago

Hi, @fideltian ,

Thanks for the comments!

Very interesting record. Is congestion control a must for RTP over Quic? why not let application layer to do congest control and bitrate control? Then it will have broad usage, especially on real time data or low latency data.

@mengelbart and I have done multiple PRs about this, trying to get the explanation right in the editor's version, especially in Section 1.2.2 and Section 7

The part that we didn't actually write down was that we haven't talked to anyone who thinks that adding a mechanism for an (untrusted) application to disable QUIC-level congestion control is a good idea. We would have to force a draft about this through the QUIC working group, and that seemed like a problem if we wanted to deploy RoQ in a timely way.

What we tried to say in Section 1.2.2 is that

Please let us know if that's not clear from the (just merged about an hour ago) text.

Another idea is Why not raw UDP alike solution(such as Direct Sockets( https://wicg.github.io/direct-sockets/).) or limited "congest control" for "RTP over Quic". "Limited" means satisfy the minimum requirement of security if really need.

Thank you for pointing me to https://wicg.github.io/direct-sockets/ - I had not seen this previously. Apparently I lead a sheltered life. :upside_down_face:

This is actually a better question for @aboba and JonathanLennox, as AVTCORE chairs - speaking only for me, I'm not sure if this would be in scope for RoQ, and perhaps not in scope for AVTCORE. But I do have a couple of thoughts about this:

If this sounds like something you'd like to pursue, I'd suggest that you start by talking with the AVTCORE chairs, and being ready to talk to the DISPATCH chairs, in case the AVTCORE chairs don't think this idea would be in scope for them.

Best wishes, of course!