Skip to content

Instantly share code, notes, and snippets.

@pklaus
Created March 12, 2020 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pklaus/b0db7e1ae36f90ac4bb796a8ae9d91bd to your computer and use it in GitHub Desktop.
Save pklaus/b0db7e1ae36f90ac4bb796a8ae9d91bd to your computer and use it in GitHub Desktop.
Postgres Filesystem Benchmark of a Corsair MP600 2TB NVMe SSD mounted in a PCIe 4.0 x8 slot
$ 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"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="0;36"
HOME_URL="https://www.archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"
$ 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 580.333 ops/sec 1723 usecs/op
fdatasync 1435.984 ops/sec 696 usecs/op
fsync 682.364 ops/sec 1465 usecs/op
fsync_writethrough n/a
open_sync 688.987 ops/sec 1451 usecs/op
Compare file sync methods using two 8kB writes:
(in wal_sync_method preference order, except fdatasync is Linux's default)
open_datasync 289.439 ops/sec 3455 usecs/op
fdatasync 1326.101 ops/sec 754 usecs/op
fsync 659.379 ops/sec 1517 usecs/op
fsync_writethrough n/a
open_sync 344.222 ops/sec 2905 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 659.935 ops/sec 1515 usecs/op
2 * 8kB open_sync writes 344.816 ops/sec 2900 usecs/op
4 * 4kB open_sync writes 177.187 ops/sec 5644 usecs/op
8 * 2kB open_sync writes 82.043 ops/sec 12189 usecs/op
16 * 1kB open_sync writes 41.345 ops/sec 24187 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
descriptor.)
write, fsync, close 679.352 ops/sec 1472 usecs/op
write, close, fsync 525.375 ops/sec 1903 usecs/op
Non-sync'ed 8kB writes:
write 433558.074 ops/sec 2 usecs/op
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment