Streams

Streams in QUIC provide a lightweight, ordered byte-stream abstraction.

There are two basic types of stream in QUIC:

  • Unidirectional streams carry data in one direction: from the initiator of the stream to its peer.

  • Bidirectional streams allow for data to be sent in both directions.

Either type of stream can be created by either endpoint, can concurrently senddata interleaved with other streams, and can be canceled.

To send data over a QUIC connection, one or more streams are used.

Flow control

Streams are individually flow controlled, allowing an endpoint to limit memorycommitment and to apply back pressure. The creation of streams is also flowcontrolled, with each peer declaring the maximum stream ID it is willing toaccept at a given time.

Stream Identifiers

Streams are identified by an unsigned 62-bit integer, referred to as theStream ID. The least significant two bits of the Stream ID are used toidentify the type of stream (unidirectional or bidirectional) and theinitiator of the stream.

The least significant bit (0x1) of the Stream ID identifies the initiator ofthe stream. Clients initiate even-numbered streams (those with the leastsignificant bit set to 0); servers initiate odd-numbered streams (with the bitset to 1).

The second least significant bit (0x2) of the Stream ID differentiates betweenunidirectional streams and bidirectional streams. Unidirectional streamsalways have this bit set to 1 and bidirectional streams have this bit set to0.

Stream concurrency

QUIC allows for an arbitrary number of streams to operate concurrently. Anendpoint limits the number of concurrently active incoming streams by limitingthe maximum stream ID.

The maximum stream ID is specific to each endpoint and applies only to thepeer that receives the setting.

Sending and Receiving Data

Endpoints use streams to send and receive data. That is after all theirultimate purpose. Streams are an ordered byte-stream abstraction. Separatestreams are however not necessarily delivered in the original order.

Stream Prioritization

Stream multiplexing has a significant effect on application performance ifresources allocated to streams are correctly prioritized. Experience withother multiplexed protocols, such as HTTP/2, shows that effectiveprioritization strategies have a significant positive impact on performance.

QUIC itself does not provide frames for exchanging prioritization information.Instead it relies on receiving priority information from the application thatuses QUIC. Protocols that use QUIC are able to define any prioritizationscheme that suits their application semantics.

When HTTP/3 is used over QUIC, the prioritization is done in the HTTP layer.