Skip to content

Instantly share code, notes, and snippets.

Created Mar 12, 2020
What would you like to do?
Postgres Filesystem Benchmark of an Intel Optane 900P 480GB PCIe SSD mounted in a PCIe 4.0 x8 slot (linked directly to CPU, not to chipset)
$ uname -a
Linux owl 5.5.8-arch1-1 #1 SMP PREEMPT Fri, 06 Mar 2020 00:57:33 +0000 x86_64 GNU/Linux
$ cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
$ pg_config --version
PostgreSQL 12.2
$ pg_test_fsync
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 34040.623 ops/sec 29 usecs/op
fdatasync 33762.892 ops/sec 30 usecs/op
fsync 31874.647 ops/sec 31 usecs/op
fsync_writethrough n/a
open_sync 31882.292 ops/sec 31 usecs/op
Compare file sync methods using two 8kB writes:
(in wal_sync_method preference order, except fdatasync is Linux's default)
open_datasync 28638.931 ops/sec 35 usecs/op
fdatasync 28652.748 ops/sec 35 usecs/op
fsync 28329.926 ops/sec 35 usecs/op
fsync_writethrough n/a
open_sync 28294.717 ops/sec 35 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 28022.049 ops/sec 36 usecs/op
2 * 8kB open_sync writes 28228.306 ops/sec 35 usecs/op
4 * 4kB open_sync writes 16144.664 ops/sec 62 usecs/op
8 * 2kB open_sync writes 4352.070 ops/sec 230 usecs/op
16 * 1kB open_sync writes 1836.779 ops/sec 544 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 31803.079 ops/sec 31 usecs/op
write, close, fsync 31768.603 ops/sec 31 usecs/op
Non-sync'ed 8kB writes:
write 569657.775 ops/sec 2 usecs/op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment