Here is an updated version of multi-threaded pgbench patch.
Andrew Dunstan <andrew(at)dunslane(dot)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.
NTT Open Source Software Center
In response to
pgsql-hackers by date
|Next:||From: Noah Misch||Date: 2009-07-09 12:23:28|
|Subject: Re: *_collapse_limit, geqo_threshold|
|Previous:||From: Dave Page||Date: 2009-07-09 07:58:14|
|Subject: Re: modules missing from Application Stack Wizard?|