pg_test_fsync performance

Bruce Momjian <bruce@momjian.us>

From: Bruce Momjian <bruce@momjian.us>
To: PostgreSQL-development <pgsql-hackers@postgreSQL.org>
Date: 2012-02-14T00:42:53Z
Lists: pgsql-hackers

Attachments

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  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +