Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
$ bin/pg_test_fsync -f /data/m/my/data/mysql.ibd
5 seconds per test
O_DIRECT supported on this platform for open_datasync and open_sync.
Compare file sync methods using one 8kB write:
(in wal_sync_method preference order, except fdatasync is Linux's default)
open_datasync 435.834 ops/sec 2294 usecs/op
fdatasync 739.356 ops/sec 1353 usecs/op
fsync 275.887 ops/sec 3625 usecs/op
fsync_writethrough n/a
open_sync 289.213 ops/sec 3458 usecs/op
Compare file sync methods using two 8kB writes:
(in wal_sync_method preference order, except fdatasync is Linux's default)
open_datasync 215.263 ops/sec 4645 usecs/op
fdatasync 664.017 ops/sec 1506 usecs/op
fsync 298.834 ops/sec 3346 usecs/op
fsync_writethrough n/a
open_sync 168.928 ops/sec 5920 usecs/op
Compare open_sync with different write sizes:
(This is designed to compare the cost of writing 16kB in different write
open_sync sizes.)
1 * 16kB open_sync write 297.779 ops/sec 3358 usecs/op
2 * 8kB open_sync writes 159.258 ops/sec 6279 usecs/op
4 * 4kB open_sync writes 79.624 ops/sec 12559 usecs/op
8 * 2kB open_sync writes 37.313 ops/sec 26801 usecs/op
16 * 1kB open_sync writes 18.225 ops/sec 54871 usecs/op
Test if fsync on non-write file descriptor is honored:
(If the times are similar, fsync() can sync data written on a different
write, fsync, close 291.049 ops/sec 3436 usecs/op
write, close, fsync 302.126 ops/sec 3310 usecs/op
Non-sync'ed 8kB writes:
write 253601.768 ops/sec 4 usecs/op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.