Thread: BUG #8326: pgbench tps wrong BUG

BUG #8326: pgbench tps wrong BUG

From
digoal@126.com
Date:
The following bug has been logged on the website:

Bug reference:      8326
Logged by:          digoal.zhou
Email address:      digoal@126.com
PostgreSQL version: Unsupported/Unknown
Operating system:   CentOS 5.8 x64
Description:

when client thread big, the tps without connection time wrong!!!!
pg94@db-172-16-3-33-> pgbench  -M prepared -n -r -f ./test.sql -T 10 -c 800
-j 100 digoal
transaction type: Custom query
scaling factor: 1
query mode: prepared
number of clients: 800
number of threads: 100
duration: 10 s
number of transactions actually processed: 2037960
tps = 199534.267305 (including connections establishing)
tps = 675603.691013 (excluding connections establishing)
statement latencies in milliseconds:
        1.019046        select 1;


when client threads small, the wrong is little.
pg94@db-172-16-3-33-> pgbench  -M prepared -n -r -f ./test.sql -T 10 -c 800
-j 10 digoal
transaction type: Custom query
scaling factor: 1
query mode: prepared
number of clients: 800
number of threads: 10
duration: 10 s
number of transactions actually processed: 1035345
tps = 102285.117970 (including connections establishing)
tps = 115616.181725 (excluding connections establishing)
statement latencies in milliseconds:
        6.812371        select 1;

Re: BUG #8326: pgbench tps wrong BUG

From
Fabien COELHO
Date:
> when client thread big, the tps without connection time wrong!!!!
> number of threads: 100
> duration: 10 s

My 0.02 €:

I cannot test that on my laptop! What kind of server is this?

The thread start time is currently taken before thread creation. The
overhead of creating 100 threads compared to 10 seconds of run is quite
significant and may impact the result. The second issue is that 800
connections and as many server processes must be created, and the time for
that must be quite significant as well against the 10 second run.

So I would mostly classify that as a feature rather than a bug, because
the run is so short.

BTW, I'm planning to submit an enhancement patch to pgbench to improve
measurements, that will include moving the start time after the thread is
started, and possibly help getting more consistent figures.

--
Fabien.

Re: BUG #8326: pgbench tps wrong BUG

From
digoal
Date:
SEksCiAgIHRoYW5rcyBmb3IgeW91ciByZXBsYXksIAogICAKQXQgMjAxMy0wNy0yNiAxNToxNzox
NywiRmFiaWVuIENPRUxITyIgPGNvZWxob0BjcmkuZW5zbXAuZnI+IHdyb3RlOgoK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