Skip to main content

DEFAULT_FRAME_WRITER_BACKPRESSURE_BYTES

Constant DEFAULT_FRAME_WRITER_BACKPRESSURE_BYTES 

Source
const DEFAULT_FRAME_WRITER_BACKPRESSURE_BYTES: usize = 4096;
Expand description

Default pending-write-buffer byte threshold on the framed writer before a flush is forced. This value is in bytes, not in messages — that is how tokio_util::codec::FramedWrite::set_backpressure_boundary is defined.

The previous value of 1 byte forced a flush syscall on every message (the buffer exceeds one byte the moment a frame is encoded), making a relay forwarding N packets issue N individual writes rather than coalescing adjacent small frames. 4096 bytes is a conservative default that lets roughly ~4 HOPR packets (~1 KiB each) batch into a single write while still flushing quickly under single-packet traffic.

Override with HOPR_TRANSPORT_FRAME_WRITER_BACKPRESSURE_BYTES.