Problem
PutEncoder() drops the wbuf write buffer if cap > 32KB. If Arc's messages are consistently 50-100KB, every pooled encoder loses its buffer and must re-grow on next use. This causes repeated allocations and GC pressure under sustained load with large messages.
Proposal
Options:
- Raise the threshold (e.g., 128KB or 256KB)
- Make the threshold configurable via
SetPoolBufferLimit(n int)
- Use adaptive sizing: track recent max and retain buffers up to 2x the observed max
Also apply the same pattern to the decoder's buf field (currently 32KB threshold).
Files
encode.go — PutEncoder() (line ~58)
decode.go — PutDecoder() (line ~45)
Expected Impact
MEDIUM — eliminates buffer re-growth allocations for workloads with consistently large messages. Reduces tail latency spikes.
Problem
PutEncoder()drops thewbufwrite buffer ifcap > 32KB. If Arc's messages are consistently 50-100KB, every pooled encoder loses its buffer and must re-grow on next use. This causes repeated allocations and GC pressure under sustained load with large messages.Proposal
Options:
SetPoolBufferLimit(n int)Also apply the same pattern to the decoder's
buffield (currently 32KB threshold).Files
encode.go—PutEncoder()(line ~58)decode.go—PutDecoder()(line ~45)Expected Impact
MEDIUM — eliminates buffer re-growth allocations for workloads with consistently large messages. Reduces tail latency spikes.