Skip to main content

SUBSCRIBE_MAX_BUFFERED_BYTES

Constant SUBSCRIBE_MAX_BUFFERED_BYTES 

Source
pub const SUBSCRIBE_MAX_BUFFERED_BYTES: Config<usize>;
Expand description

Budget for the backlog a SUBSCRIBE (or COPY (SUBSCRIBE ...) TO STDOUT) may accumulate in environmentd while waiting for a slow client to read.

The subscribe producer runs on the non-blockable coordinator loop, so it cannot apply backpressure to a slow client. Instead the coordinator retires the subscribe once its buffered backlog exceeds this budget, bounding the memory a slow client can make the shared process hold.

The backlog excludes the message the client is currently draining, so this bounds the accumulation of messages, not the size of any single one. max_result_size is what bounds an individual message. A client that keeps up holds at most one message at a time, so it stays at a zero backlog and a large snapshot batch is delivered rather than retired.