Re: Fix around conn_duration in pgbench
Fujii Masao <masao.fujii@oss.nttdata.com>
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Yugo NAGATA <nagata@sraoss.co.jp>
Cc: Asif Rehman <asifr.rehman@gmail.com>, pgsql-hackers@lists.postgresql.org,
Fabien COELHO <coelho@cri.ensmp.fr>
Date: 2021-07-30T06:26:51Z
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
Commits
-
pgbench: Fix bug in measurement of disconnection delays.
- d760d942c73c 14.0 landed
- 4dc528bfa7da 15.0 landed
-
pgbench: Avoid unnecessary measurement of connection delays.
- efe2382d5ade 14.0 landed
- bfd4567b8849 15.0 landed
-
pgbench: Improve time logic.
- 547f04e7348b 14.0 cited