Here is an updated version of multi-threaded pgbench patch. Andrew Dunstan <and...@dunslane.net> wrote:
> > Hmm, but how will you communicate stats back from the sub-processes? > My first reaction is to say "use a pipe." I added partial implementation of pthread using fork and pipe for platform without ENABLE_THREAD_SAFETY. Pthread version is not necessarily needed if we have the fork version, but I still left it as-is. The name of new option is still -j, that is borrowed from pg_restore and gmake. They use -j for multi-worker-processing. -j NUM number of threads (default: 1) I needed to modify the meaning of tps (excluding connections establishing) a little because connections are executed in parallel. I subtract average of connection times from total execution time. total_time := last_thread_finish_time - first_thread_start_time tps (including connection) := num_transaction / total_time tps (excluding connection) := num_transaction / (total_time - (total_connection_time / num_threads)) I notice that I also fixed a few parts of pgbench: * Use instr_time instead of struct timeval. Macros in portability/instr_time.h makes codes cleaner. * Accept "\sleep 1ms" format (no spaces between "1" and "ms") for sleep meta command. The old version of pgbench interprets "1ms" as just "1", that means "1 s". It was confusable. I'll add the patch to the commitfest page. Regards, --- ITAGAKI Takahiro NTT Open Source Software Center
pgbench-mt_20090709.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers