diff --git a/.changelog/18524.txt b/.changelog/18524.txt new file mode 100644 index 000000000..f2f3a7d6b --- /dev/null +++ b/.changelog/18524.txt @@ -0,0 +1,3 @@ +```release-note:improvement +template: reduce memory usage associated with communicating with the Nomad API +``` diff --git a/helper/bufconndialer/bufconndialer.go b/helper/bufconndialer/bufconndialer.go index ea5fe40f7..5d9b5512a 100644 --- a/helper/bufconndialer/bufconndialer.go +++ b/helper/bufconndialer/bufconndialer.go @@ -24,7 +24,10 @@ type BufConnWrapper struct { // New returns a new BufConnWrapper with a new bufconn.Listener. The wrapper // provides a dialer for creating connections to the listener. func New() (net.Listener, *BufConnWrapper) { - ln := bufconn.Listen(1024 * 1024) + // this buffer is sized to accept a maximum-sized Nomad Variable payload + // (64k) with plenty of room to spare for the metadata and envelope, in a + // single read + ln := bufconn.Listen(1024 * 100) return ln, &BufConnWrapper{listener: ln} }