Re: fsync vs open_sync

From: pgsql(at)mohawksoft(dot)com
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: fsync vs open_sync
Date: 2004-08-09 21:57:46
Message-ID: 17625.24.91.171.78.1092088666.squirrel@mail.mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> pgsql(at)mohawksoft(dot)com writes:
>> I did a little test on the various options of fsync.
>
> There were considerably more extensive tests back when we created the
> different WAL options, and the conclusions seemed to be that the best
> choice is platform-dependent and also usage-dependent. (In particular,
> it makes a huge difference whether WAL has its own drive or not.)
>
> I don't really recall why open_sync didn't end up among the set of
> choices considered for the default setting. It may be that we need to
> reconsider based on the behavior of newer Linux versions ...
>
> In any case, comparing open_sync to fsync is irrelevant, seeing that
> the current default choice on Linux is fdatasync. What you ought to
> be telling us about is the performance relative to that.

I can tell you, and I'll send all the results if you like, but fsync and
fdatasync are, as far as I can tell, idenitical. In fact, I can't find any
documentation that fdatasync is no longer implemented on Linux as fsync.

I tested fsync and fdatasync first and in my tests, the performance of
fdatasync and fsync were the same. I never went beyond these as it looked
like the fsync options were all basically the same. I hadn't read anywhere
where open_sync could make such a difference. It is only because of some
idle chatter (over a few years) I read in a couple Linux kernel mailing
list about O_SYNC being improved, that I thought I'd try it.

The improvements were REALLY astounding, and I would like to know if other
Linux users see this performance increase, I mean, it is almost 8~10 times
faster than using fsync.

Furthermore, it seems to also have the added benefit of reducing the I/O
storm at checkpoints over a system running with fsync off.

I'm really serious about this, changing this one parameter had dramatic
results on performance. We should have a general call to users to test
this setting with their OS of choice. If not that, if we can be sure that
there are no cases where using O_SYNC is worse than fsync() or
fdatasync(), it should be considered as the default.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-08-09 22:28:33 Re: Beta Leader?
Previous Message Kevin Brown 2004-08-09 21:46:33 Re: Tablespace issues (comment on ,moving indexes)