Reduce metadata overhead in qpzone
Summary
Investigating memory consumption in #4986 (closed) shows that a significant amount of memory usage of qpzone
is due to metadata in dns_slabheader_t
and dns_name_t
. It should be possible to reduce memory consumption by optimizing the layout of those structs.
BIND version affected
BIND 9.21
Steps to reproduce
To identify how much memory is used by the slabs, replicate the setup from #4986 (closed), running either the primary or the secondary with jemalloc
configured and memory profiling enabled.
An example command for profiling the primary is:
$ export MALLOC_CONF='abort_conf:true,prof:true,lg_prof_interval:20,lg_prof_sample:20,prof_prefix:jeprof'
$ /path/to/named -n 1 -g -c /path/to/primary.conf
Then run jeprof
to postprocess the data:
$ jeprof --show_bytes --nodefraction=0 --exclude="default_memalloc|mem_get|isc___mem_get|isc__mem_get|mem_allocateunlocked|isc___mem_allocate|isc__mem_allocate|isc___mem_strdup|isc__mem_strdup" /path/to/named /path/to/jeprof.$PID.$IDX.i$IDX.heap --pdf > jeprof.pdf
Separating the slab header memory usage from the rest of the slab is more difficult, but it can be done by modifying the code and adding a counter that accumulates on reservelen
in the function dns_rdataslab_fromrdataset
.
What is the expected correct behavior?
Lower overall memory usage.
Relevant configuration files
Same as #4986 (closed)