Skip to main content

Module buffer

Module buffer 

Source
Expand description

Buffer size constants

All buffer sizes are carefully chosen for NNTP workloads:

  • Commands are small (< 512 bytes)
  • Articles range from 1KB to 768KB typically (99th percentile)
  • Pooled buffers use aligned sizes for optimal memory access

Constants§

CAPTURE
Size of each capture buffer (1 MiB, page-aligned).
CAPTURE_COUNT
Default number of capture buffers in the pool.
COMMAND
Maximum command line size (512 bytes) NNTP commands are typically small: “ARTICLE msgid@example.com
MAX_PENDING_BACKEND_BYTES
Maximum pending bytes kept on a pooled backend connection.
POOL
Size of each pooled buffer (1 MiB, page-aligned) Large enough to keep typical article reads in a single chunk while leaving headroom for bigger first reads and direct streaming paths.
POOL_COUNT
Default number of buffers in the buffer pool Sized for ~100 concurrent streaming connections Total memory: 100 × 1MiB = 100MiB This is a conservative default; increase via config for higher concurrency
READER_CAPACITY
BufReader capacity for client command parsing.
RESPONSE_INITIAL
Initial capacity for response accumulation buffers (8KB, page-aligned) Sized for typical status lines and small responses
RESPONSE_MAX
Maximum size for a single response (2MB) Increased to handle larger articles, prevents memory exhaustion
STREAM_CHUNK
Chunk size for streaming responses (1 MiB, page-aligned) Matches POOL size so the first direct backend read and follow-on reads use the same pooled allocation size.