[nsd-users] High memory consumption for small AXFR

Anand Buddhdev anandb at ripe.net
Thu Jul 27 14:38:49 UTC 2023


On 27/07/2023 13:43, Klaus Darilion via nsd-users wrote:

Hi Klaus,

> So, even that there were ~6GB RAM available, NSD could not replace
> the  currently serving zone (50mio RRs) with a small zone with 5RRs.
> 
> I wonder, why does NSD needs so much memory to apply the "AXFR-style
> IXFR"? Is this by design, or a bug?

This is a design bug/feature of NSD. When it receives updates, it forks 
a child process. This child process consumes the XFR, and updates its 
in-memory view of the zone. Once it has done that, the previous server 
process is killed, and this new child process takes over to answer queries.

This design makes NSD consume more memory when processing updates. We 
have run into this problem as well.

There are 2 ways to work around this:

1. Add more RAM to the server; or
2. add swap space to the server.

The swap space allows the kernel to allocate more memory to NSD when it 
forks. The swap space will not actually be used, because the old NSD 
process and the new one will be identical, and share the memory space. 
When the new process updates one or some of its zones, only that memory 
will be modified, and a little extra RAM will be consumed.

We have NSD servers will limited RAM, but the swap space trick helps 
them function without being killed by the out-of-memory killer.

I'm not an expert on Linux kernel terminology, so please excuse my 
rather simple explanation.

Regards,
Anand Buddhdev
RIPE NCC


More information about the nsd-users mailing list