w3c / webtransport

WebTransport is a web API for flexible data transport
https://w3c.github.io/webtransport/
Other
845 stars 50 forks source link

Add stats.atSendCapacity #603

Closed jan-ivar closed 1 month ago

jan-ivar commented 6 months ago

Fixes #559. For discussion.


Preview | Diff

jan-ivar commented 6 months ago

These are modeled on estimatedSendRate, the lone stat specific to the WebTransport session, as opposed to all the other stats which are for the entire underlying connection.

I dunno if that was a mistake or not. We should discuss.

jan-ivar commented 5 months ago

Meeting:

jan-ivar commented 4 months ago

Meeting:

jan-ivar commented 4 months ago

Personally, I'm actually partial to a flat hierarchy a bit, since a hierarchy doesn't really solve ambiguity that much due to the ?. operator in JS. Example:

This will throw if stats or stats.sendRate is undefined:

stats.sendRate.isDataLimited;

This result in undefined (which might interpreted as false by websites):

stats.sendRate?.isDataLimited;
jan-ivar commented 4 months ago

@wilaw wrote in https://github.com/w3c/webtransport/issues/607#issuecomment-2206558189:

In the prior meeting, a comment was made that some of the proposed 'sending' stats may not be known, and that coercing a boolean value could cause a problem. Is this a real problem, or can robust defaults be chosen that will not mislead applications?

(replying here about stats we're still adding here)

If unavailable stats are mostly a problem at connection start, then defaults reflecting initial state should work.

stats.estimatedSendRate; //nullable stats.isSendingDataLimited; // default false

A connection is inherently data limited to start, so this would naturally default to (start out as) true, unless we can think of a name for the inverse state.

stats.isSendingServerLimited; // default false

Is it possible for a session to be both data limited AND server limited? If I have two long-lived streams, one server limited (receiving back pressure from the server) and the other data limited, would both be true? How would I know which applies to which?

stats.inSendingSlowStart; // default false stats.blockedFramesCount; // default 0

These seem fine to me.

jan-ivar commented 4 months ago

Meeting:

jan-ivar commented 2 months ago

Meeting:

martinthomson commented 2 months ago

Including what I typed into chat...

When false, it indicates that estimatedSendRate is not being fully utilized and could be an unreliable estimate of actual network capacity.

When true, it indicates that the data that the application sends is close to the estimatedSendRate. As long as that send rate is sustained, estimatedSendRate will adapt to network conditions and be a fair estimate of what capacity is available to the application.