I have heard complaints that /contrib/pg_test_fsync is too slow. I thought it was impossible to speed up pg_test_fsync without reducing its accuracy.
However, now that I some consumer-grade SATA 2 drives, I noticed that the slowness is really in the open_sync test: 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 76.421 ops/sec 2 * 8kB open_sync writes 38.689 ops/sec 4 * 4kB open_sync writes 19.140 ops/sec 8 * 2kB open_sync writes 4.938 ops/sec 16 * 1kB open_sync writes 2.480 ops/sec These last few lines can take very long, so I developed the attached patch that scales down the number of tests. This makes it more reasonable to run pg_test_fsync. I would like to apply this for PG 9.2. -- Bruce Momjian <br...@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. +
diff --git a/contrib/pg_test_fsync/pg_test_fsync.c b/contrib/pg_test_fsync/pg_test_fsync.c new file mode 100644 index 042b02b..970deda *** a/contrib/pg_test_fsync/pg_test_fsync.c --- b/contrib/pg_test_fsync/pg_test_fsync.c *************** test_open_syncs(void) *** 358,368 **** printf("(This is designed to compare the cost of writing 16kB\n"); printf("in different write open_sync sizes.)\n"); ! test_open_sync("16kB open_sync write", 16); ! test_open_sync(" 8kB open_sync writes", 8); ! test_open_sync(" 4kB open_sync writes", 4); ! test_open_sync(" 2kB open_sync writes", 2); ! test_open_sync(" 1kB open_sync writes", 1); } /* --- 358,368 ---- printf("(This is designed to compare the cost of writing 16kB\n"); printf("in different write open_sync sizes.)\n"); ! test_open_sync(" 1 * 16kB open_sync write", 16); ! test_open_sync(" 2 * 8kB open_sync writes", 8); ! test_open_sync(" 4 * 4kB open_sync writes", 4); ! test_open_sync(" 8 * 2kB open_sync writes", 2); ! test_open_sync("16 * 1kB open_sync writes", 1); } /* *************** test_open_sync(const char *msg, int writ *** 376,381 **** --- 376,385 ---- ops, writes; #endif + int save_ops_per_test = ops_per_test; + + /* This test can be long, so scale down the number of tests */ + ops_per_test = ops_per_test * writes_size / 16; printf(LABEL_FORMAT, msg); fflush(stdout); *************** test_open_sync(const char *msg, int writ *** 402,407 **** --- 406,412 ---- #else printf(NA_FORMAT, "n/a\n"); #endif + ops_per_test = save_ops_per_test; } static void
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers