Re: win32 performance - fsync question

From: "Merlin Moncure" <merlin(dot)moncure(at)rcsonline(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>, "Magnus Hagander" <mha(at)sollentuna(dot)net>
Subject: Re: win32 performance - fsync question
Date: 2005-02-17 20:39:38
Message-ID: 6EE64EF3AB31D5448D0007DD34EEB3412A762C@Herge.rcsinc.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> "Magnus Hagander" <mha(at)sollentuna(dot)net> writes:
> > Is there actually a reason why we don't use O_DIRECT on Unix?
>
> Portability, or rather the complete lack of it. Stuff that isn't in
the
> Single Unix Spec is a hard sell.

Well, how about this (ok, maybe I'm way out in left field):
Change fsync option from on/off to on/off/O_SYNC. On win32 we treat
O_SYNC as opened with FILE_FLAG_WRITE_THROUGH. When we are in O_SYNC
mode, all files, WAL or otherwise, are assumed to be synced when written
and are therefore not synced during pg_fsync(). WAL syncing may of
course be overridden using alternate sync methods in postgresql.conf.

I suspect that this will drastically alter windows performance,
especially on raid systems. What is TBD is the safety aspect. What I
like about this that now are not dealing with a win32-only hack, any
unix system now has another performance setting top play with. We also
don't touch the O_DIRECT flag (on win32: FILE_FLAG_WRITE_THROUGH |
FILE_FLAG_NO_BUFFERING) leaving that can of worms for another day.

Under normal situations, we would expect O_SYNCing everything all the
time to slow stuff down, especially during checkpoints, but it might
actually help on a caching raid controller. On win32, it will help
because the performance of fsync() sucks so horribly, even or raid.

Merlin

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergey E. Koposov 2005-02-17 20:57:53 Re: Strange RETURN NEXT behaviour in Postgres 8.0
Previous Message Oliver Jowett 2005-02-17 20:24:06 Re: win32 performance - fsync question