Skip to main content

DEFAULT_MAX_CONCURRENT_STREAMS

Constant DEFAULT_MAX_CONCURRENT_STREAMS 

pub const DEFAULT_MAX_CONCURRENT_STREAMS: usize = 1024; // 1_024usize
Available on crate feature ttrpc only.
Expand description

Default per-connection limit on concurrently-executing request handlers. Once reached, new requests are rejected with RESOURCE_EXHAUSTED rather than dispatched. This bounds the handler tasks, their per-stream buffers, and the encoded frames queued for the writer, each in-flight stream self-throttles to +-one unwritten frame, so the writer queue is bounded by this cap.

Note the worst-case inbound memory a peer can pin is this × per-stream buffer × 4 MiB (it must actually send those bytes); lower the cap for untrusted peers.