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 BufReadercapacity 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.