Re: win32 performance - fsync question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>
Cc: lsunley(at)mb(dot)sympatico(dot)ca, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, "E(dot)Rodichev" <er(at)sai(dot)msu(dot)su>, "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: win32 performance - fsync question
Date: 2005-02-17 17:52:04
Message-ID: 8646.1108662724@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> This is what we have discovered. AFAIK, all other major databases or
> other similar apps (like exchange or AD) all open files with
> FILE_FLAG_WRITE_THROUGH and do *not* use fsync. It might give noticably
> better performance with an O_DIRECT style WAL logging at least. But I'm
> unsure if the current code for O_DIRECT works on win32 - I think it
> needs some fixing for that. Which might be worth looking at for 8.1.

Doesn't Windows support O_SYNC (or even better O_DSYNC) flag to open()?
That should be the Posixy spelling of FILE_FLAG_WRITE_THROUGH, if the
latter means what I suppose it does.

> Not much to do about the bgwriter, the way it is designed it *has* to
> fsync during checkpoint.

Theoretically at least, the fsync during checkpoints should not be a
performance killer. The issue that's at hand here is fsyncing the WAL,
and the reason we need that is (a) to be sure a transaction is committed
when we say it is, and (b) to be sure that WAL writes hit disk before
associated data file updates do (it's write AHEAD log remember). Direct
writes of WAL should be fine.

So: try O_SYNC instead of fsync for WAL, ie, wal_sync_method =
open_sync or open_datasync.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2005-02-17 17:55:28 Re: win32 performance - fsync question
Previous Message Magnus Hagander 2005-02-17 17:32:08 Re: win32 performance - fsync question