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

HTTP/3: Cache and reusing streams #33680

Closed
JamesNK opened this issue Jun 20, 2021 · 2 comments · Fixed by #34576
Closed

HTTP/3: Cache and reusing streams #33680

JamesNK opened this issue Jun 20, 2021 · 2 comments · Fixed by #34576
Assignees
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions HTTP3 Perf
Milestone

Comments

@JamesNK
Copy link
Member

JamesNK commented Jun 20, 2021

In HTTP/2 a connection responsible for creating and stream and all resources related to it. Http2Stream creation and reuse are all handled by Http2Connection.

In HTTP/3 a stream extends into the QUIC transport layer. Http3Connection creates Http3Stream and QuicConnection creates QuicStreamContext. For high performance, both these need to be cached and reused.

tldr; cache should move into the transport layer

Detail:

  1. A concurrent queue is added to QuicConnection. It acts as a cache for completed QuicStreamContext instances.
  2. When accepting a stream on a connection, the queue is checked for existing QuicStreamContext instances. An instance is reused if available. Otherwise, a new QuicStreamContext is created. The stream has a reference to its connection.
  3. There isn't an API to "return" a stream to the connection on MultiplexedConnectionContext. Instead, returning will be implicit with disposing of QuicStreamContext. When a cleanly completed (i.e. neither side of the stream was aborted) stream is disposed it will add itself to its QuicConnection concurrent queue cache so it can be reused.
  4. We're now reusing the QuicStreamContext 🥳 We also want to reuse the Http3Stream. Rather than having a separate cache, the feature collection on the stream transport - QuicStreamContext.FeatureCollection - is used to stash Http3Stream. A reused QuicStreamContext will have a Http3Stream on it to reuse.

Caching and reusing streams should only be necessary for request streams (i.e. bidirectional streams) on an HTTP/3 connection. There isn't value in caching and reusing unidirectional streams. Only a handful are created for a connection and they will live for the lifetime of the connection.

@ghost
Copy link

ghost commented Jun 21, 2021

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@ghost
Copy link

ghost commented Jul 12, 2021

Thanks for contacting us.

We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@JamesNK JamesNK self-assigned this Jul 12, 2021
@JamesNK JamesNK closed this as completed Jul 24, 2021
@JamesNK JamesNK modified the milestones: Next sprint planning, 6.0-rc1 Jul 24, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 23, 2021
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions HTTP3 Perf
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants