Re: Fix around conn_duration in pgbench

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Yugo NAGATA <nagata(at)sraoss(dot)co(dot)jp>
Cc: Asif Rehman <asifr(dot)rehman(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Subject: Re: Fix around conn_duration in pgbench
Date: 2021-07-30 06:26:51
Message-ID: 7a6729bf-b622-40b9-f53c-0ca461053922@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/07/30 14:43, Yugo NAGATA wrote:
> This patch fixes three issues of connection time measurement:
>
> 1. The initial connection time is measured and stored into conn_duration
> but the result is never used.
> 2. The disconnection time are not measured even when -C is specified.
> 3. The disconnection time measurement at the end of threadRun() is
> not necessary.
>
> The first one exists only in v14 and master, but others are also in v13 and
> before. So, I think we can back-patch these fixes.

Yes, you're right.

>
>> But the patch fails to be back-patched to v13 or before because
>> pgbench's time logic was changed by commit 547f04e734.
>> Do you have the patches that can be back-patched to v13 or before?
>
> I attached the patch for v13.

Thanks for the patch!

+ /*
+ * In CSTATE_FINISHED state, this finishCon() is a no-op
+ * under -C/--connect because all the connections that this
+ * thread established should have already been closed at the end
+ * of transactions. So we don't need to measure the disconnection
+ * delays here.

In v13, the disconnection time needs to be measured in CSTATE_FINISHED
because the connection can be closed here when -C is not specified?

/* tps is about actually executed transactions */
tps_include = ntx / time_include;
tps_exclude = ntx /
(time_include - (INSTR_TIME_GET_DOUBLE(conn_total_time) / nclients));

BTW, this is a bit different topic from the patch, but in v13,
tps excluding connection establishing is calculated in the above way.
The total connection time is divided by the number of clients,
but why do we need this division? Do you have any idea?

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2021-07-30 06:32:51 Re: [HACKERS] logical decoding of two-phase transactions
Previous Message Amit Kapila 2021-07-30 06:02:40 Parallel Inserts (WAS: [bug?] Missed parallel safety checks..)