mmap for zeroing WAL log - Mailing list pgsql-hackers

From Tom Lane
Subject mmap for zeroing WAL log
Date
Msg-id 19434.983075333@sss.pgh.pa.us
Whole thread Raw
Responses Re: mmap for zeroing WAL log  (Matthew Kirkwood <matthew@hairy.beasts.org>)
List pgsql-hackers
[ redirected to pgsql-hackers instead of -patches ]

Matthew Kirkwood <matthew@hairy.beasts.org> writes:
> On Sat, 24 Feb 2001, Bruce Momjian wrote:
>> I am confused why mmap() is better than writing to a real file.

> It isn't, except that it allows to initialise the logfile in
> one syscall, without first allocating and zeroing (and hence
> dirtying) 16Mb of memory.

Uh, the existing code does not zero 16Mb of memory... it zeroes
8K and then writes that block repeatedly.  It's possible that the
overhead of a syscall for each 8K block is significant, but on the
other hand writing a block at a time is a heavily used and heavily
optimized path in all Unixen.  It's at least as plausible that the
mmap-as-source-of-zeroes path will be slower!

I think this is worth looking into, but I'm very far from being
sold on it...
        regards, tom lane


pgsql-hackers by date:

Previous
From: ncm@zembu.com (Nathan Myers)
Date:
Subject: Re: CommitDelay performance improvement
Next
From: Tom Lane
Date:
Subject: Re: PL/SQL-to-PL/pgSQL-HOWTO + PL/pgSQL documentation