Re: multi-threaded pgbench

Поиск
Список
Период
Сортировка
От Itagaki Takahiro
Тема Re: multi-threaded pgbench
Дата
Msg-id 20090709172254.98BC.52131E4D@oss.ntt.co.jp
обсуждение исходный текст
Ответ на Re: multi-threaded pgbench  (Andrew Dunstan <andrew@dunslane.net>)
Ответы Re: multi-threaded pgbench  (Robert Haas <robertmhaas@gmail.com>)
Re: multi-threaded pgbench  (Greg Smith <gsmith@gregsmith.com>)
Список pgsql-hackers
Here is an updated version of multi-threaded pgbench patch.

Andrew Dunstan <andrew@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


Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: modules missing from Application Stack Wizard?
Следующее
От: Peter Hunsberger
Дата:
Сообщение: Re: *_collapse_limit, geqo_threshold