-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
HTTP3Perfarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Milestone
Description
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:
- A concurrent queue is added to
QuicConnection. It acts as a cache for completedQuicStreamContextinstances. - When accepting a stream on a connection, the queue is checked for existing
QuicStreamContextinstances. An instance is reused if available. Otherwise, a newQuicStreamContextis created. The stream has a reference to its connection. - There isn't an API to "return" a stream to the connection on
MultiplexedConnectionContext. Instead, returning will be implicit with disposing ofQuicStreamContext. When a cleanly completed (i.e. neither side of the stream was aborted) stream is disposed it will add itself to itsQuicConnectionconcurrent queue cache so it can be reused. - We're now reusing the
QuicStreamContext🥳 We also want to reuse theHttp3Stream. Rather than having a separate cache, the feature collection on the stream transport -QuicStreamContext.FeatureCollection- is used to stashHttp3Stream. A reusedQuicStreamContextwill have aHttp3Streamon 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.
Metadata
Metadata
Assignees
Labels
HTTP3Perfarea-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions