perf(proxy): add sync.Pool for UDP buffers#277
perf(proxy): add sync.Pool for UDP buffers#277LaurenceJJones wants to merge 1 commit intofosrl:devfrom
Conversation
- Add udpBufferPool for reusable 65507-byte UDP packet buffers - Add getUDPBuffer() and putUDPBuffer() helper functions - Clear buffer contents before returning to pool to prevent data leakage - Apply pooling to both main handler buffer and per-client goroutine buffers - Reduces GC pressure from frequent large allocations during UDP proxying
|
We can confirm the UDP buffer allocation issue described in this PR from our production environment. On an affected Newt instance (details in #268), we observed 11+ simultaneous UDP connections to our DNS resolver, each with its own file descriptor — no reuse: Under high TCP forwarding load (SMTP targets with health checks), DNS lookups are very frequent, which amplifies the buffer allocation issue significantly. In The Would love to see this merged. |
Community Contribution License Agreement
By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.
Description
How to test?
Internal code changes.