pg_test_fsync使用记录
pg_test_fsync
pg_test_fsync旨在让您合理地了解特定系统上最快的wal_sync_method,以及在发生识别的I / O问题时提供诊断信息。 但是,pg_test_fsync所显示的差异在实际数据库吞吐量方面可能没有任何显着差异,特别是因为许多数据库服务器不受其事务日志的限制。 pg_test_fsync报告每个wal_sync_method的平均文件同步操作时间(以微秒为单位),也可用于通知努力优化commit_delay的值。
使用非常简单,只需要设置一下-s参数,每个测试执行多少时间,也可以使用默认的5s。
root@XXX# ./pg_test_fsync -s 10 10 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 434.638 ops/sec 2301 usecs/op fdatasync 428.840 ops/sec 2332 usecs/op fsync 434.291 ops/sec 2303 usecs/op fsync_writethrough n/a open_sync 441.457 ops/sec 2265 usecs/op Compare file sync methods using two 8kB writes: (in wal_sync_method preference order, except fdatasync is Linux's default) open_datasync 227.454 ops/sec 4396 usecs/op fdatasync 422.669 ops/sec 2366 usecs/op fsync 433.111 ops/sec 2309 usecs/op fsync_writethrough n/a open_sync 215.747 ops/sec 4635 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 418.466 ops/sec 2390 usecs/op 2 * 8kB open_sync writes 219.613 ops/sec 4553 usecs/op 4 * 4kB open_sync writes 109.423 ops/sec 9139 usecs/op 8 * 2kB open_sync writes 54.230 ops/sec 18440 usecs/op 16 * 1kB open_sync writes 28.370 ops/sec 35249 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 424.550 ops/sec 2355 usecs/op write, close, fsync 427.676 ops/sec 2338 usecs/op Non-sync'ed 8kB writes: write 147612.547 ops/sec 7 usecs/op
具体每项测试都有指出测试条件。
严以律己、宽以待人