> pgsql@mohawksoft.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.