mmap vs alloc

Ted Lindgreen ted at tednet.nl
Wed Sep 24 16:15:54 UTC 2003


[Quoting Jakob Schlyter, on Sep 24, 15:58, in "mmap vs alloc ..."]

> >   If the data can, and should be shared (read-only), then the *correct* thing
> > is to mmap() things appropriately. That is the right thing to do, even on a
> > system that supports overcommit.
> 
> I'd like to second this - do not rely on overcommit.

Yes, I agree also in principle, however in practice overcommit is
almost always safe (unless it's implementation is broken, like
in some linux-versions, of course).

> is performance worse with mmap?

This is not tested (yet), but unless the mmap implementation is
broken, it should not make anything worse.

In hindsight one can say that using mmap always is the right way,
however changing it in mid-version may cause new complications
(possible machine/operating system dependend mmap issues). It
must be thoroughly tested.

Please note that this whole thing is never an issue, unless one runs
a huge database on a machine with too little virtual-memory and/or
swapspace configured. It would be nice to get feedback from people
with various hw/sw combinations on configuring with "--enable-mmap".
We will check it on the hw/sw combinations we have available, and
if no complications show up, then we can make it the default.

Regards,
-- ted



More information about the nsd-users mailing list