> $ gcc -Wall -O -DINIT_WRITE -DUSE_DSYNC -DBLOCKS=1 tfsync.c
                              ^^^^^^^^^^^
You should use -DUSE_OSYNC to test O_SYNC.
So you've tested N * write() + fsync(), exactly what I've asked -:)

> So I also see that there is no benefit to writing more than 
> one block at a time with ODSYNC.  And even at half a meg per write,
> DSYNC is slower than ODSYNC with 8K per write!  Note the fairly high
> system-time consumption for DSYNC, too.  I think this is not so much
> a matter of a really good ODSYNC implementation, as a really bad DSYNC
> one ...

So seems we can use O_DSYNC without losing log write performance
comparing with write() + fsync. Though, we didn't tested write() +
fdatasync()
yet...

Vadim

Fri, 9 Mar 2001 18:31:36 -0800 
"Mikheev, Vadim" <vmikheev@SECTORBASE.COM>
RE: AW: AW: AW: WAL does not recover gracefully from ou
	t-of -dis k-sp ace
"Mikheev, Vadim" <vmikheev@SECTORBASE.COM> writes:
>> $ gcc -Wall -O -DINIT_WRITE -DUSE_DSYNC -DBLOCKS=1 tfsync.c
>                               ^^^^^^^^^^^
> You should use -DUSE_OSYNC to test O_SYNC.

Ooops ... let's hear it for cut-and-paste, and for sharp-eyed readers!

Just for completeness, here are the results for O_SYNC:

$ gcc -Wall -O -DINIT_WRITE -DUSE_OSYNC -DBLOCKS=1 tfsync.c
$ time a.out

real    0m43.44s
user    0m0.02s
sys     0m0.74s
$ gcc -Wall -O -DINIT_WRITE -DUSE_OSYNC -DBLOCKS=4 tfsync.c
$ time a.out

real    0m26.38s
user    0m0.01s
sys     0m0.59s
$ gcc -Wall -O -DINIT_WRITE -DUSE_OSYNC -DBLOCKS=8 tfsync.c
$ time a.out

real    0m23.86s
user    0m0.01s
sys     0m0.59s

$ gcc -Wall -O -DINIT_WRITE -DUSE_OSYNC -DBLOCKS=64 tfsync.c
$ time a.out

real    0m22.93s
user    0m0.01s
sys     0m0.66s

Better than fsync(), but still not up to O_DSYNC.

> So seems we can use O_DSYNC without losing log write performance
> comparing with write() + fsync. Though, we didn't tested write() +
> fdatasync() yet...

Good point, we should check fdatasync() too --- although I have no
machines where it's different from fsync().

			regards, tom lane

Fri, 09 Mar 2001 21:53:12 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: AW: AW: AW: WAL does not recover gracefully from ou t-of -dis
	k-sp ace