Re: Fix for Extra Parenthesis in pgbench progress message
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Tatsuo Ishii <ishii@postgresql.org>, pgsql-release@lists.postgresql.org, pgsql-hackers@postgresql.org
Date: 2025-02-07T17:28:16Z
Lists: pgsql-hackers
Hi,
On 2024-11-26 01:32:10 +0900, Fujii Masao wrote:
> On 2024/11/25 8:31, Tatsuo Ishii wrote:
> > Now that two minor releases are out, are you going to commit and
> > back-patch this?
>
> Yes, I will.
>
> But, the patch didn't apply cleanly to some back branches, so I've created
> and attached updated patches for them. Could you review these?
> If they look good, I'll proceed with pushing them.
I just did pgbench -i 100 -q via ssh and noticed it was *way* slower than I
expected. Did it with debian's pgbench, no such issue.
It's due to this patch.
/srv/dev/build/m-opt/src/bin/pgbench/pgbench -i -s 10 -Idtg -h /tmp -q > /tmp/pgiu 2>&1
With HEAD:
pgbench -i -s 10 -Idtg -h /tmp -q 2>&1|wc
1000114 52 1000448
With af35fe501af reverted:
pgbench -i -s 10 -Idtg -h /tmp -q 2>&1|wc
6 52 340
Outputting that many lines to the terminal causes noticeable slowdowns even
locally and make the terminal use a *lot* more cpu cycles.
With HEAD:
perf stat -p $(pidof gnome-terminal-server) /srv/dev/build/m-opt/src/bin/pgbench/pgbench -i -s 100 -Idtg -h /tmp -q
dropping old tables...
creating tables...
generating data (client-side)...
done in 6.31 s (drop tables 0.02 s, create tables 0.00 s, client-side generate 6.28 s).
Performance counter stats for process id '3615':
3,726.37 msec task-clock # 0.590 CPUs utilized
692,360 context-switches # 185.800 K/sec
49 cpu-migrations # 13.150 /sec
2 page-faults # 0.537 /sec
13,340,182,520 instructions # 1.35 insn per cycle
# 0.14 stalled cycles per insn
9,893,907,904 cycles # 2.655 GHz
1,913,148,556 stalled-cycles-frontend # 19.34% frontend cycles idle
2,935,132,872 branches # 787.665 M/sec
17,293,477 branch-misses # 0.59% of all branches
6.315407944 seconds time elapsed
With af35fe501af reverted:
perf stat -p $(pidof gnome-terminal-server) /srv/dev/build/m-opt/src/bin/pgbench/pgbench -i -s 100 -Idtg -h /tmp -q
dropping old tables...
creating tables...
generating data (client-side)...
done in 5.77 s (drop tables 0.02 s, create tables 0.00 s, client-side generate 5.75 s).
Performance counter stats for process id '3615':
228.02 msec task-clock # 0.039 CPUs utilized
239 context-switches # 1.048 K/sec
16 cpu-migrations # 70.170 /sec
0 page-faults # 0.000 /sec
298,383,249 instructions # 0.35 insn per cycle
# 0.28 stalled cycles per insn
857,475,516 cycles # 3.761 GHz
82,918,558 stalled-cycles-frontend # 9.67% frontend cycles idle
48,317,810 branches # 211.903 M/sec
618,525 branch-misses # 1.28% of all branches
5.780547274 seconds time elapsed
IOW, pgbench -i -s 100 -q got ~0.8s slower and made the terminal use 15x more
cycles.
Given the upcoming set of minor releases, I think it may be best for this this
patch ought to be reverted for now.
Greetings,
Andres Freund
Commits
-
Fix pgbench performance issue induced by commit af35fe501.
- b6decfc1d22b 13.19 landed
- 5addea71c7c7 14.16 landed
- 499d1cf55d3d 15.11 landed
- fb056564ec5b 18.0 landed
- e35d396ec354 17.3 landed
- 21b815f92e82 16.7 landed
-
pgbench: Ensure previous progress message is fully cleared when updating.
- f1cb5e51f329 13.19 landed
- 0f13e1a78b14 14.16 landed
- 1e46f7351abc 15.11 landed
- 1cf646957135 16.7 landed
- adb103fcacdd 17.3 landed
- af35fe501af5 18.0 landed