pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgbench - compute & show latency consistently
9+ messages / 4 participants
[nested] [flat]

* pgbench - compute & show latency consistently
@ 2016-07-09 08:42  Fabien COELHO <coelho@cri.ensmp.fr>
  0 siblings, 1 reply; 9+ messages in thread

From: Fabien COELHO @ 2016-07-09 08:42 UTC (permalink / raw)
  To: pgsql-hackers


Currently the latency is not computed and displayed consistently:

  - the computation is wrong under -t (duration is zero...)

  - depending on the conditions it is shown with a ":" syntax or
    a "=" syntax.

The attached minor patch makes the computation & display more consistent.

-- 
Fabien.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

pgbench-latency-t-1.patch (text/x-diff, 1.7K) download diff --git a/doc/src/sgml/ref/pgbench.sgml b/doc/src/sgml/ref/pgbench.sgml index f3afedb..26c030e 100644 --- a/doc/src/sgml/ref/pgbench.sgml +++ b/doc/src/sgml/ref/pgbench.sgml @@ -1254,8 +1254,8 @@ number of clients: 10 number of threads: 1 number of transactions per client: 1000 number of transactions actually processed: 10000/10000 -latency average = 15.844 ms -latency stddev = 2.715 ms +latency average: 15.844 ms +latency stddev: 2.715 ms tps = 618.764555 (including connections establishing) tps = 622.977698 (excluding connections establishing) script statistics: diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index 87fb006..6eb9f28 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3237,8 +3237,8 @@ printSimpleStats(char *prefix, SimpleStats *ss) double latency = ss->sum / ss->count; double stddev = sqrt(ss->sum2 / ss->count - latency * latency); - printf("%s average = %.3f ms\n", prefix, 0.001 * latency); - printf("%s stddev = %.3f ms\n", prefix, 0.001 * stddev); + printf("%s average: %.3f ms\n", prefix, 0.001 * latency); + printf("%s stddev: %.3f ms\n", prefix, 0.001 * stddev); } /* print out results */ @@ -3291,9 +3291,9 @@ printResults(TState *threads, StatsData *total, instr_time total_time, if (throttle_delay || progress || latency_limit) printSimpleStats("latency", &total->latency); else - /* only an average latency computed from the duration is available */ + /* no measure, show average latency computed from run time */ printf("latency average: %.3f ms\n", - 1000.0 * duration * nclients / total->cnt); + 1000.0 * time_include * nclients / total->cnt); if (throttle_delay) {
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-07-12 17:54  Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  parent: Fabien COELHO <coelho@cri.ensmp.fr>
  0 siblings, 1 reply; 9+ messages in thread

From: Peter Eisentraut @ 2016-07-12 17:54 UTC (permalink / raw)
  To: Fabien COELHO <coelho@cri.ensmp.fr>; pgsql-hackers

On 7/9/16 4:42 AM, Fabien COELHO wrote:
>  number of transactions per client: 1000
>  number of transactions actually processed: 10000/10000
> -latency average = 15.844 ms
> -latency stddev = 2.715 ms
> +latency average: 15.844 ms
> +latency stddev: 2.715 ms
>  tps = 618.764555 (including connections establishing)
>  tps = 622.977698 (excluding connections establishing)

I think what you have here is that colons separate input parameters and
equal signs separate result output.  So I think it's OK the way it is.

Maybe a better improvement would be introducing section headings like
"test parameters" and "test results".

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-07-13 08:39  Fabien COELHO <coelho@cri.ensmp.fr>
  parent: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Fabien COELHO @ 2016-07-13 08:39 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers


Hello Peter,

>>  number of transactions per client: 1000
>> -latency average = 15.844 ms
>> +latency average: 15.844 ms
>>  tps = 618.764555 (including connections establishing)
>
> I think what you have here is that colons separate input parameters and
> equal signs separate result output.  So I think it's OK the way it is.

Hmmm... Then other measures displayed are not all consistent with this 
theory.

Also there is still the bug under -t which displays a 0 latency.

The attached patch still fixes that and make it consistent the other way 
around, i.e. by using "=" for latency. I switched to use ":" for weight 
which is an input parameter. I let ":" when there is a long sentence to 
describe the figure displayed, more on aesthetical grounds.

> Maybe a better improvement would be introducing section headings like
> "test parameters" and "test results".

This would add more lines to the report, to sure how desirable it is.

-- 
Fabien.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

pgbench-latency-t-2.patch (text/x-diff, 1.1K) download diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index 87fb006..af1169a 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -3291,9 +3291,9 @@ printResults(TState *threads, StatsData *total, instr_time total_time, if (throttle_delay || progress || latency_limit) printSimpleStats("latency", &total->latency); else - /* only an average latency computed from the duration is available */ - printf("latency average: %.3f ms\n", - 1000.0 * duration * nclients / total->cnt); + /* no measure, show average latency computed from run time */ + printf("latency average = %.3f ms\n", + 1000.0 * time_include * nclients / total->cnt); if (throttle_delay) { @@ -3319,7 +3319,7 @@ printResults(TState *threads, StatsData *total, instr_time total_time, { if (num_scripts > 1) printf("SQL script %d: %s\n" - " - weight = %d (targets %.1f%% of total)\n" + " - weight: %d (targets %.1f%% of total)\n" " - " INT64_FORMAT " transactions (%.1f%% of total, tps = %f)\n", i + 1, sql_script[i].desc, sql_script[i].weight,
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-09-21 10:07  Kuntal Ghosh <kuntalghosh.2007@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Kuntal Ghosh @ 2016-09-21 10:07 UTC (permalink / raw)
  To: coelho@cri.ensmp.fr; +Cc: pgsql-hackers

On Thus, July 7,2016 at 08:39 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
> Also there is still the bug under -t which displays a 0 latency.
Your patch clearly fixed the issue.

> The attached patch still fixes that and make it consistent the other way
> around, i.e. by using "=" for latency. I switched to use ":" for weight
> which is an input parameter. I let ":" when there is a long sentence to
> describe the figure displayed, more on aesthetic grounds.
In the above context, I suggest few other changes.

Present output-> progress: 1.0 s, 1221.0 tps, lat 0.816 ms stddev 0.272
Suggestion-> progress: 1.0 s, 1221.0 tps, lat avg 0.816 ms stddev 0.272 ms

Present output->
SQL script 1: so.sql
   - weight = 1 (targets 50.0% of total)
   - 10010 transactions (50.1% of total, tps = 100.101872)
   - latency average = 1.878 ms
   - latency stddev = 3.614 ms
Suggestion->
SQL script 1: so.sql
   - weight = 1 (targets 50.0% of total)
   - 10010 transactions (50.1% of total)
   - tps = 100.101872
   - latency average = 1.878 ms
   - latency stddev = 3.614 ms

Apart from that, pgbench.sgml should be updated to reflect latency
average in the output.

-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-09-21 10:30  Heikki Linnakangas <hlinnaka@iki.fi>
  parent: Fabien COELHO <coelho@cri.ensmp.fr>
  0 siblings, 0 replies; 9+ messages in thread

From: Heikki Linnakangas @ 2016-09-21 10:30 UTC (permalink / raw)
  To: Fabien COELHO <coelho@cri.ensmp.fr>; Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-hackers

On 07/13/2016 11:39 AM, Fabien COELHO wrote:
>>>  number of transactions per client: 1000
>>> -latency average = 15.844 ms
>>> +latency average: 15.844 ms
>>>  tps = 618.764555 (including connections establishing)
>>
>> I think what you have here is that colons separate input parameters and
>> equal signs separate result output.  So I think it's OK the way it is.
>
> Hmmm... Then other measures displayed are not all consistent with this
> theory.
>
> Also there is still the bug under -t which displays a 0 latency.
>
> The attached patch still fixes that and make it consistent the other way
> around, i.e. by using "=" for latency. I switched to use ":" for weight
> which is an input parameter. I let ":" when there is a long sentence to
> describe the figure displayed, more on aesthetical grounds.

Committed, thanks!

- Heikki



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-09-21 10:35  Heikki Linnakangas <hlinnaka@iki.fi>
  parent: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Heikki Linnakangas @ 2016-09-21 10:35 UTC (permalink / raw)
  To: Kuntal Ghosh <kuntalghosh.2007@gmail.com>; coelho@cri.ensmp.fr; +Cc: pgsql-hackers

(I just pushed the patch, didn't see your post until after that)

On 09/21/2016 01:07 PM, Kuntal Ghosh wrote:
> On Thus, July 7,2016 at 08:39 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
>> Also there is still the bug under -t which displays a 0 latency.
> Your patch clearly fixed the issue.
>
>> The attached patch still fixes that and make it consistent the other way
>> around, i.e. by using "=" for latency. I switched to use ":" for weight
>> which is an input parameter. I let ":" when there is a long sentence to
>> describe the figure displayed, more on aesthetic grounds.
> In the above context, I suggest few other changes.
>
> Present output-> progress: 1.0 s, 1221.0 tps, lat 0.816 ms stddev 0.272
> Suggestion-> progress: 1.0 s, 1221.0 tps, lat avg 0.816 ms stddev 0.272 ms

Yeah, perhaps.

> Present output->
> SQL script 1: so.sql
>    - weight = 1 (targets 50.0% of total)
>    - 10010 transactions (50.1% of total, tps = 100.101872)
>    - latency average = 1.878 ms
>    - latency stddev = 3.614 ms
> Suggestion->
> SQL script 1: so.sql
>    - weight = 1 (targets 50.0% of total)
>    - 10010 transactions (50.1% of total)
>    - tps = 100.101872
>    - latency average = 1.878 ms
>    - latency stddev = 3.614 ms

I think it fits well on a single line.

> Apart from that, pgbench.sgml should be updated to reflect latency
> average in the output.

pgbench.sgml actually already had the "latency average = ..." version in 
its example. Even before this patch, we printed it with a "=" if one of 
options that caused per-transaction timings to be measured, like --rate, 
was used, and as ":" otherwise.

- Heikki



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-09-21 10:57  Kuntal Ghosh <kuntalghosh.2007@gmail.com>
  parent: Heikki Linnakangas <hlinnaka@iki.fi>
  0 siblings, 1 reply; 9+ messages in thread

From: Kuntal Ghosh @ 2016-09-21 10:57 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnaka@iki.fi>; +Cc: pgsql-hackers

On Wed, Sep 21, 2016 at 4:05 PM, Heikki Linnakangas <hlinnaka@iki.fi> wrote:

> pgbench.sgml actually already had the "latency average = ..." version in its
> example. Even before this patch, we printed it with a "=" if one of options
> that caused per-transaction timings to be measured, like --rate, was used,
> and as ":" otherwise.
>
> - Heikki
>
I'm talking about the first example in pgbench.sgml.

Typical output from <application>pgbench</application> looks like:
<screen>
transaction type: &lt;builtin: TPC-B (sort of)&gt;
scaling factor: 10
query mode: simple
number of clients: 10
number of threads: 1
number of transactions per client: 1000
number of transactions actually processed: 10000/10000
tps = 85.184871 (including connections establishing)
tps = 85.296346 (excluding connections establishing)
</screen>

Shouldn't we include latency average here as well and explain what it is?

-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-09-21 13:23  Fabien COELHO <coelho@cri.ensmp.fr>
  parent: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Fabien COELHO @ 2016-09-21 13:23 UTC (permalink / raw)
  To: Kuntal Ghosh <kuntalghosh.2007@gmail.com>; +Cc: Heikki Linnakangas <hlinnaka@iki.fi>; pgsql-hackers


Hello Kuntal,

> <screen>
> transaction type: &lt;builtin: TPC-B (sort of)&gt;
> scaling factor: 10
> query mode: simple
> number of clients: 10
> number of threads: 1
> number of transactions per client: 1000
> number of transactions actually processed: 10000/10000
> tps = 85.184871 (including connections establishing)
> tps = 85.296346 (excluding connections establishing)
> </screen>
>
> Shouldn't we include latency average here as well and explain what it is?

Indeed, now it seems to be always printed but the documentation did not 
follow, there should be a:

   latency average = 117.392 ms

In front of the tps line. Well, the performance displayed could also be 
improved... On my dual core SSD laptop I just got:

  sh> ./pgbench -c 10 -t 1000
  starting vacuum...end.
  transaction type: <builtin: TPC-B (sort of)>
  scaling factor: 100
  query mode: simple
  number of clients: 10
  number of threads: 1
  number of transactions per client: 1000
  number of transactions actually processed: 10000/10000
  latency average = 9.527 ms
  tps = 1049.665115 (including connections establishing)
  tps = 1049.890194 (excluding connections establishing)

Which is about 10 times better.

-- 
Fabien.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: pgbench - compute & show latency consistently
@ 2016-09-22 11:07  Kuntal Ghosh <kuntalghosh.2007@gmail.com>
  parent: Fabien COELHO <coelho@cri.ensmp.fr>
  0 siblings, 0 replies; 9+ messages in thread

From: Kuntal Ghosh @ 2016-09-22 11:07 UTC (permalink / raw)
  To: Fabien COELHO <coelho@cri.ensmp.fr>; +Cc: Heikki Linnakangas <hlinnaka@iki.fi>; pgsql-hackers

On Wed, Sep 21, 2016 at 6:53 PM, Fabien COELHO <coelho@cri.ensmp.fr> wrote:
> In front of the tps line. Well, the performance displayed could also be
> improved... On my dual core SSD laptop I just got:
>
>  sh> ./pgbench -c 10 -t 1000
>  starting vacuum...end.
>  transaction type: <builtin: TPC-B (sort of)>
>  scaling factor: 100
>  query mode: simple
>  number of clients: 10
>  number of threads: 1
>  number of transactions per client: 1000
>  number of transactions actually processed: 10000/10000
>  latency average = 9.527 ms
>  tps = 1049.665115 (including connections establishing)
>  tps = 1049.890194 (excluding connections establishing)
>
> Which is about 10 times better.

Yes, you are right. In the documentation, the above example has not
been updated across different pg versions. Although this is just an
example, it should reflect the current performance.

-- 
Thanks & Regards,
Kuntal Ghosh
EnterpriseDB: http://www.enterprisedb.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2016-09-22 11:07 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-07-09 08:42 pgbench - compute & show latency consistently Fabien COELHO <coelho@cri.ensmp.fr>
2016-07-12 17:54 ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2016-07-13 08:39   ` Fabien COELHO <coelho@cri.ensmp.fr>
2016-09-21 10:30     ` Heikki Linnakangas <hlinnaka@iki.fi>
2016-09-21 10:07 Re: pgbench - compute & show latency consistently Kuntal Ghosh <kuntalghosh.2007@gmail.com>
2016-09-21 10:35 ` Heikki Linnakangas <hlinnaka@iki.fi>
2016-09-21 10:57   ` Kuntal Ghosh <kuntalghosh.2007@gmail.com>
2016-09-21 13:23     ` Fabien COELHO <coelho@cri.ensmp.fr>
2016-09-22 11:07       ` Kuntal Ghosh <kuntalghosh.2007@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox