mmap vs alloc

Arnt Gulbrandsen arnt at
Thu Sep 25 11:15:19 UTC 2003

Jaap Akkerhuis writes, quoting me:
>     It's better to mmap() and pray that the file isn't changed, than 
>     to read() and pray that overcommit won't explode.
> Seeing this discussion and being agnostic, it seems to me that this 
> has more to do with the operating environment (amount of data served, 
> operating system used etc.) then with nsd itself, praying is not an 
> option.

If the nsd admin is in a position to guarantee that nsd.db is never 
edited, mmap() is fine.

To do that, write access to nsd.db must be tightly controlled and zonec 
must use e.g. "open(); write(); close(); rename()" in order to build 
the new database without touching the old one. So, root passwords 
carefully controlled, no stray users with write access to the nsd 
files, etc.

> My suggestions is, that a proper thing to do is to document that nsd 
> has specific memory requirements (lots) and how the various system 
> might deal with it or not.

How many linux 2.4.x kernels have contained sweeping VM changes so far? 
The one mentioned this week was a prepatch, even. I don't think 
"document how various systems might deal with it" is a good policy when 
the _stable_ linux kernels change like that.


More information about the nsd-users mailing list