mmap for zeroing WAL log

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthew Kirkwood <matthew(at)hairy(dot)beasts(dot)org>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: mmap for zeroing WAL log
Date: 2001-02-25 04:28:53
Message-ID: 19434.983075333@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

[ redirected to pgsql-hackers instead of -patches ]

Matthew Kirkwood <matthew(at)hairy(dot)beasts(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-02-25 04:30:53 Re: PL/SQL-to-PL/pgSQL-HOWTO + PL/pgSQL documentation
Previous Message Bruce Momjian 2001-02-25 04:25:56 Re: A patch for xlog.c

Browse pgsql-patches by date

  From Date Subject
Next Message The Hermit Hacker 2001-02-25 20:07:17 Re: A patch for xlog.c
Previous Message Bruce Momjian 2001-02-25 04:25:56 Re: A patch for xlog.c