Re: mmap for zeroing WAL log
От | Matthew Kirkwood |
---|---|
Тема | Re: mmap for zeroing WAL log |
Дата | |
Msg-id | Pine.LNX.4.10.10102272159490.5542-100000@sphinx.mythic-beasts.com обсуждение исходный текст |
Ответ на | mmap for zeroing WAL log (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-hackers |
On Sat, 24 Feb 2001, Tom Lane 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. See the "one syscall" bit above. > It's possible that the overhead of a syscall for each 8K block is > significant, I had assumed that the overhead would come from synchronous metadata incurring writes of at least the inode, block bitmap and probably an indirect block for each syscall. > 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! Results: On Linux/ext2, it appears good for a gain of 3-5% for log creations (via a fairly minimal test program). On FreeBSD 4.1-RELEASE/ffs (with all of sync/async/softupdates) it is a couple of percent worse in elapsed time, but consumes around a third more system CPU time (12sec vs 9sec on one test system). I am awaiting numbers from reiserfs but, for now, it looks like I am far from vindicated. Matthew.
В списке pgsql-hackers по дате отправления: