HTTP/3: Cache and reusing streams #33680
Labels
area-networking
Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
HTTP3
Perf
Milestone
In HTTP/2 a connection responsible for creating and stream and all resources related to it.
Http2Stream
creation and reuse are all handled byHttp2Connection
.In HTTP/3 a stream extends into the QUIC transport layer.
Http3Connection
createsHttp3Stream
andQuicConnection
createsQuicStreamContext
. For high performance, both these need to be cached and reused.tldr; cache should move into the transport layer
Detail:
QuicConnection
. It acts as a cache for completedQuicStreamContext
instances.QuicStreamContext
instances. An instance is reused if available. Otherwise, a newQuicStreamContext
is created. The stream has a reference to its connection.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 itsQuicConnection
concurrent queue cache so it can be reused.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 reusedQuicStreamContext
will have aHttp3Stream
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.
The text was updated successfully, but these errors were encountered: