Re: We really ought to do something about O_DIRECT and data=journalled on ext4 - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: We really ought to do something about O_DIRECT and data=journalled on ext4
Date
Msg-id 4CFD9612.9030006@agliodbs.com
Whole thread Raw
In response to Re: We really ought to do something about O_DIRECT and data=journalled on ext4  (Greg Smith <greg@2ndquadrant.com>)
Responses Re: We really ought to do something about O_DIRECT and data=journalled on ext4
List pgsql-hackers
> Mac OS X:  Like Solaris, there's a similar mechanism but it's not
> O_DIRECT; see
> http://stackoverflow.com/questions/2299402/how-does-one-do-raw-io-on-mac-os-x-ie-equivalent-to-linuxs-o-direct-flag
> for notes about the F_NOCACHE  feature used.  Same basic situation as
> Solaris; there's an API, but PostgreSQL doesn't use it yet.

Actually, on OSX 10.5.8, o_dsync and fdatasync aren't even available.
From my run, it looks like even so regular fsync might be better than
open_sync.  Results from a MacBook:

Sidney-Stratton:fsync josh$ ./test_fsync
Loops = 10000

Simple write:8k write                       2121.004/second

Compare file sync methods using one write:(open_datasync unavailable)open_sync 8k write
1993.833/second(fdatasyncunavailable)8k write, fsync                1878.154/second
 

Compare file sync methods using two writes:(open_datasync unavailable)2 open_sync 8k writes
1005.009/second(fdatasyncunavailable)8k write, 8k write, fsync      1709.862/second
 

Compare open_sync with different sizes:open_sync 16k write            1728.803/second2 open_sync 8k writes
969.416/second

Test if fsync on non-write file descriptor is honored:
(If the times are similar, fsync() can sync data written
on a different descriptor.)8k write, fsync, close         1772.572/second8k write, close, fsync
1939.897/second


--                                  -- Josh Berkus                                    PostgreSQL Experts Inc.
                        http://www.pgexperts.com
 


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: Timeout for asynchronous replication Re: Timeout and wait-forever in sync rep
Next
From: Josh Berkus
Date:
Subject: Re: [PATCH] Revert default wal_sync_method to fdatasync on Linux 2.6.33+