Skip to content

Instantly share code, notes, and snippets.

@pklaus
Last active March 12, 2020 15:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pklaus/daa5d1f84213014c66971358c24783aa to your computer and use it in GitHub Desktop.
Save pklaus/daa5d1f84213014c66971358c24783aa to your computer and use it in GitHub Desktop.
PostgreSQL Benchmarks with pgbench and pg_test_fsync on an Intel Optane 900P 480GB PCIe SSD (w/ Ryzen 3600X amd X570 chipset)
$ uname -a
Linux owl 5.4.8-arch1-1 #1 SMP PREEMPT Sat, 04 Jan 2020 23:46:18 +0000 x86_64 GNU/Linux
$ cat /etc/issue
Arch Linux \r (\l)
$ pg_config --version
PostgreSQL 12.1
$ cd /var/lib/postgres/data/
$ 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 33125.867 ops/sec 30 usecs/op
fdatasync 32820.947 ops/sec 30 usecs/op
fsync 30742.545 ops/sec 33 usecs/op
fsync_writethrough n/a
open_sync 31870.873 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 27483.496 ops/sec 36 usecs/op
fdatasync 28573.229 ops/sec 35 usecs/op
fsync 28281.408 ops/sec 35 usecs/op
fsync_writethrough n/a
open_sync 27087.070 ops/sec 37 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 28103.020 ops/sec 36 usecs/op
2 * 8kB open_sync writes 27073.324 ops/sec 37 usecs/op
4 * 4kB open_sync writes 15794.683 ops/sec 63 usecs/op
8 * 2kB open_sync writes 4265.749 ops/sec 234 usecs/op
16 * 1kB open_sync writes 1818.145 ops/sec 550 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 31816.711 ops/sec 31 usecs/op
write, close, fsync 31824.815 ops/sec 31 usecs/op
Non-sync'ed 8kB writes:
write 590913.573 ops/sec 2 usecs/op
$ uname -a
Linux owl 5.4.8-arch1-1 #1 SMP PREEMPT Sat, 04 Jan 2020 23:46:18 +0000 x86_64 GNU/Linux
$ cat /etc/issue
Arch Linux \r (\l)
$ pg_config --version
PostgreSQL 12.1
$ pgbench -i -h localhost -p 5432 -U postgres -s 25
$ pgbench -h localhost -p 5432 -U postgres -t 1000
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 25
query mode: simple
number of clients: 1
number of threads: 1
number of transactions per client: 1000
number of transactions actually processed: 1000/1000
latency average = 0.314 ms
tps = 3187.503741 (including connections establishing)
tps = 3199.668095 (excluding connections establishing)
[postgres@owl data]$ pgbench -h localhost -p 5432 -U postgres -t 10000 -c 90 -t 20
starting vacuum...end.
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 25
query mode: simple
number of clients: 90
number of threads: 1
number of transactions per client: 20
number of transactions actually processed: 1800/1800
latency average = 10.575 ms
tps = 8510.254512 (including connections establishing)
tps = 8545.540015 (excluding connections establishing)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment