-
Notifications
You must be signed in to change notification settings - Fork 50
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
Define datagram backpressure control attributes #267
Conversation
I made set(Incoming|Outgoing)HighWaterMark methods rather than members in WebTransportOptions because it'd be useful to set them multiple times, especially when the network condition changes. |
index.bs
Outdated
undefined setIncomingExpirationDuration(double ms); | ||
undefined setOutgoingExpirationDuration(double ms); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look like simple setters, and should therefore be read-write attributes instead of methods, I claim. E.g. using latest naming from #251 (comment):
wt.datagrams.incomingMaxAge = 300; // ms
wt.datagrams.outgoingMaxAge = 800; // ms
I'm also wondering if we should take a cue from recent changes to bidirectional streams, and subclass readable and writable stream here, so we can push the attributes down:
wt.datagrams.readable.maxAge = 300; // ms
wt.datagrams.writable.maxAge = 800; // ms
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One concern is it can return null (when not set/the browser default behavior). Are you fine with the following IDL?
attribute double? incomingMaxAge;
attribute double? outgoingMaxAge;
I share the sentiment about subclassing with @ricea and I'd like to avoid that without a clear benefit. I'm not sure this is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meeting:
- Might be better to expose the implementation-defined default than return
null
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that the implementation-default value can be chosen for each receiveDatagram call when [[IncomingDatagramsExpirationDuration]]. So exposing a fixed value reduces the flexisibility. Ditto for the outgoing direction.
index.bs
Outdated
undefined setIncomingHighWaterMark(long highWaterMark); | ||
undefined setOutgoingHighWaterMark(long highWaterMark); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it comes to highwaterMark, there's potential confusion with the same-named concept in the streams spec:
const stream = new WritableStream(
{ ... },
new CountQueuingStrategy({ highWaterMark: 5 })
);
But I'm not 100% sure it's the same thing. That API I think is generally understood to be the buffer in the ReadableStream/WritableStream itself, distinct from its underlying source, whereas in our case, we have a setup at least on the writable side where we pre-fill the underlying sink's write-queue (for throughput and threading purposes), and what we really mean to control here is the depth of that write queue. But maybe this is a detail and that from the viewpoint of a producer (or consumer in the readable case) this is close enough to the the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They represent the same concept, the length of the queue in a stream. We have them in the underlying source and sink because removing stale chunks is not supported in general streams. Given that I think it's good to keep the same name. Web developers cannot control the buffer lengths in the streams, but instead they can control these values.
91e61d7
to
c67152f
Compare
I replaced the methods with attributes. PTAL again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@jan-ivar PTAL again. I'm aware of #267 (comment) but I'd like to land this change soon. We can file another issue and discuss it there. If you don't like the possible breaking change, I can remove the getter part of incomingMaxAge and outgoingMaxAge. |
Removing the "Discuss at next meeting" label as it is for the previous one. |
I'm going to land this change on Jun 16 (JST) if unless further comments are made. |
850b33a
to
4c11ddc
Compare
SHA: 809721b Reason: push, by @yutakahirano Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Define the following attributes on DatagramDuplexStream.
Fixes #251, #221, #152
Preview | Diff