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

Add rate control event #421

Merged
merged 42 commits into from
Feb 14, 2023
Merged

Conversation

pthatcher
Copy link
Contributor

@pthatcher pthatcher commented Sep 27, 2022

Fixes #21 by adding an event to give RateControlFeedback to let the application know the maximum rate it should send at to avoid queuing.


Preview | Diff

@jan-ivar
Copy link
Member

Meeting:

  • Figure out what data we want and how it will be used before we work out how to deliver it
  • expected size of congestion window (how much you can send in one roundtrip), remaining/total availability, rtt?, calculations just focused at the next frame, or projections multiple frames ahead? a complex problem, and the information we are able to provide isn't well suited
  • iframe is 40kb, it's going to take me 4 rtts to send, -> lower resolution etc.
  • how big a frame can I send?
  • reporting congstion window leads may lead to odd outcomes, like underutilizing bandwidth.
  • a leaky abstraction, whereas sites need a lot of context

@wilaw
Copy link
Contributor

wilaw commented Oct 19, 2022

@pthatcher - while we debate this PR, can you fix the ipr issue signalled above? The system would like you to link your github accounts with your W3C account so that PRs can be automatically accepted.

@pthatcher
Copy link
Contributor Author

@pthatcher - while we debate this PR, can you fix the ipr issue signalled above? The system would like you to link your github accounts with your W3C account so that PRs can be automatically accepted.

It's fixed now.

@pthatcher
Copy link
Contributor Author

Meeting:

  • Figure out what data we want and how it will be used before we work out how to deliver it

I think we want a bitrate that means "if you write this much or less, you won't cause queueing", so you can go throttle you video encoder, for example.

  • expected size of congestion window (how much you can send in one roundtrip), remaining/total availability, rtt?, calculations just focused at the next frame, or projections multiple frames ahead? a complex problem, and the information we are able to provide isn't well suited

I don't think we need anything more complex than the bitrate you should send at that will avoid queueing.

  • iframe is 40kb, it's going to take me 4 rtts to send, -> lower resolution etc.

Does anyone do rate control that way (based on RTT)? It seems strange to me, but I suppose you could calculate it using the RTT.

  • how big a frame can I send?

I think it's less about an individual frame and more about bitrate over time. If you exceed the bitrate for a brief period (with a key frame), it will queue, so make sure you go lower than the target rate for a while after to a make sure it drains.

  • reporting congstion window leads may lead to odd outcomes, like underutilizing bandwidth.
  • a leaky abstraction, whereas sites need a lot of context

I think we should stick with the rate, not the window. In fact, many algorithms, like googcc calculate target rate directly, not a window.

@pthatcher pthatcher marked this pull request as ready for review November 22, 2022 04:43
@wilaw wilaw changed the title Add congestion control event Add rate control event Nov 23, 2022
@pthatcher
Copy link
Contributor Author

I think this is ready for more review.

Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have any plans to write some prose to go with this?

@jan-ivar
Copy link
Member

jan-ivar commented Dec 7, 2022

Meeting:

  • unsigned long long
  • time range? rtt? coming out of a congestion control algorithm
  • what about pooling? Is it over multiple sessions?
  • algorithms to back up webidl

@pthatcher
Copy link
Contributor Author

Do you have any plans to write some prose to go with this?

I have added prose.

@pthatcher
Copy link
Contributor Author

Meeting:

  • unsigned long long
  • time range? rtt? coming out of a congestion control algorithm
  • what about pooling? Is it over multiple sessions?
  • algorithms to back up webidl

All of these have been added/fixed.

@pthatcher
Copy link
Contributor Author

I've done my best to make WebTransport an EventTarget and define the ratecontrolfeedback event, copying off of the WebRTC and WebCodecs specs. Please let me know what I did wrong :).

Copy link
Member

@jan-ivar jan-ivar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is coming together! Lots of detail to work out here, so pardon all the comments.

index.bs Outdated
Comment on lines 566 to 568
attribute unsigned long? rateControlFeedbackMinInterval;
attribute EventHandler onratecontrolfeedback;
readonly attribute WebTransportRateControlFeedback rateControlFeedback;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the bikeshed logic for the difference here?

wt.rateControlFeedbackMinInterval
wt.rateControlFeedback.sendRate

Isn't the following simpler to remember?

wt.rateControlFeedback.minInterval
wt.rateControlFeedback.sendRate

Easier to read, and I don't see why we need to make a difference between input and output.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lastly, to put in writing what I've advocated in meetings, I'd personally prefer something simpler like:

wt.rateControlMinInterval
wt.rateControlSendRate

...as this seems sufficient to satisfy the "capture any state information in the target object." design principle. I really don't see what the extra . dot accomplishes, even if we add more attributes in the future. They're still attributes of the session.

I don't see them as something separate — I.e. the attributes will be readable and update whether one listens for the event or not.

I'd love to hear other opinions on this, to understand the benefit(s) of the . dot.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made #470 and #471 to look at which one we like better (or this one as-is).

pthatcher and others added 15 commits February 14, 2023 07:59
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
Co-authored-by: Jan-Ivar Bruaroey <jan-ivar@users.noreply.github.com>
@pthatcher pthatcher merged commit 6e4b8b7 into w3c:main Feb 14, 2023
github-actions bot added a commit that referenced this pull request Feb 14, 2023
SHA: 6e4b8b7
Reason: push, by pthatcher

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Comment on lines +632 to +633
<td class="non-normative">A {{long}} indicating the maximum frequency
that the {{WebTransport/ratecontrolfeedback}} will be fired.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the minimum time between events? Or even the duration over which the event is suppressed after receiving another.

Sure interval is inversely proportional to rate, but only loosely.

Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incomplete, so I object to it having been merged.

which an application is sending data on another session, one session could learn about the
the rate at which another application is sending data. To avoid this, a user agent
can restrict access to information or modify information provided. For example, it could leave
the send rate at an artifical value to make it more difficult to infer anything from it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty loose. This boils down to "maybe the browser could work something out", which is pretty unsatisfying. We should be more concrete, either block access to the attribute (which reveals the presence of another entity, so that needs thought) or define an exemplar strategy for making it available.

Comment on lines +1927 to +1929
When the user agent changes the rate at which it dequeues bytes for sending on a
{{WebTransport}} |transport|'s [=WebTransport session=],
it MUST [=queue a network task=] with |transport| to run these steps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requirement is impossible, or nearly so. How does the UA monitor the rate?

Comment on lines +1931 to +1933
1. Set |transport|.{{WebTransport/rateControlFeedback}}.{{WebTransportRateControlFeedback/[[SendRate]]}}
to the new rate for [=WebTransport session=].
1. Fire an event named {{WebTransport/ratecontrolfeedback}} at |transport|.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the event limiting feature here?

jan-ivar added a commit to jan-ivar/webtransport that referenced this pull request Mar 3, 2023
jan-ivar added a commit that referenced this pull request Mar 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stats for congestion control and bandwidth estimation
6 participants