]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Add per-backend `max_udp_outstanding` YAML config setting 17180/head
authorRobert Edmonds <edmonds@users.noreply.github.com>
Tue, 21 Apr 2026 21:22:32 +0000 (17:22 -0400)
committerRobert Edmonds <edmonds@users.noreply.github.com>
Tue, 21 Apr 2026 21:22:32 +0000 (17:22 -0400)
commit8e8a0e306054d2202c58eccffbd93b4a5d62701c
tree0b39616e77de5b47f80c1d4c9b48455160626643
parent15e2d3e10d7b4c735d6524dcbf209fbb538e2de1
dnsdist: Add per-backend `max_udp_outstanding` YAML config setting

This commit adds a new per-backend config setting `max_udp_outstanding`
which overrides the global `tuning.udp.max_outstanding_per_backend`
setting.

If the per-backend `max_udp_outstanding` setting is omitted, the value
of the global option `tuning.udp.max_outstanding_per_backend` will be
used instead.

This allows tuning the number of UDP states allocated on a per-backend
basis in order to tune the amount of memory consumed by dnsdist.
Low-latency backends may only need a small number of UDP states, while
high-latency backends may need a higher number of UDP states.

The `tuning.udp.max_outstanding_per_backend` setting and the new
per-backend `max_udp_outstanding` setting directly control the sizes of
the vectors of `IDState` objects that are preallocated at startup.

The size of the `IDState` object can vary depending on compile time
options, but in my local build it is currently 496 bytes. This means
that a backend with the maximum number of UDP states (65535) will
require allocating at least (496 * 65535 / 1048576) = 31 MB. Similarly,
a backend with 8192 UDP states will require allocating 3.9 MB, and a
backend with 256 UDP states only requires 124 KB.

Signed-off-by: Robert Edmonds <edmonds@users.noreply.github.com>
pdns/dnsdistdist/dnsdist-backend.cc
pdns/dnsdistdist/dnsdist-configuration-yaml.cc
pdns/dnsdistdist/dnsdist-settings-definitions.yml
pdns/dnsdistdist/dnsdist.hh