Re: heavily contended lwlocks with long wait queues scale badly
Jakub Wartak <jakub.wartak@enterprisedb.com>
From: Jakub Wartak <jakub.wartak@enterprisedb.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: "Jonathan S. Katz" <jkatz@postgresql.org>,
Nathan Bossart <nathandbossart@gmail.com>, Andres Freund <andres@anarazel.de>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>,
pgsql-hackers@postgresql.org, Thomas Munro <thomas.munro@gmail.com>,
Yura Sokolov <y.sokolov@postgrespro.ru>
Date: 2024-01-19T12:49:59Z
Lists: pgsql-hackers
Attachments
- qlat10parts.png (image/png)
- tps10parts.png (image/png)
- tps100parts.png (image/png)
- qlat100parts.png (image/png)
On Thu, Jan 18, 2024 at 7:17 AM Michael Paquier <michael@paquier.xyz> wrote: > > On Tue, Jan 16, 2024 at 03:11:48PM +0900, Michael Paquier wrote: > > I'd like to apply that, just let me know if you have any comments > > and/or objections. > > And done on 12~15. Hi Michael, just to reassure you that it is a good thing. We have a customer who reported much better performance on 16.x than on 13~15 in very heavy duty LWLock/lockmanager scenarios (ofc, before that was committed/released), so I gave it a try here today to see how much can be attributed to that single commit. Given: # $s=10, $p=10,100, DURATION=10s, m=prepared,simple, no reruns , just single $DURATION run to save time pgbench -i -s $s --partitions $p $DBNAME ALTER TABLE pgbench_accounts ADD COLUMN aid_parent INT; UPDATE pgbench_accounts SET aid_parent = aid CREATE INDEX ON pgbench_accounts(aid_parent) pgbench -n -M $m -T $DURATION -c $c -j $c -f join.sql $DBNAME join.sql was: \set aid random(1, 100000 * :scale) select * from pgbench_accounts pa join pgbench_branches pb on pa.bid = pb.bid where pa.aid_parent = :aid; see attached results.The benefits are observable (at least when active working sessions >= VCPUs [threads not cores]) and give up to ~2.65x boost in certain cases at least for this testcase. Hopefully others will find it useful. -J.
Commits
-
lwlock: Fix quadratic behavior with very long wait lists
- 81038228582a 12.18 landed
- dc9d424cf0cd 13.14 landed
- 5f6ec27a6477 14.11 landed
- f374fb4aab3e 15.6 landed
- a4adc31f6902 16.0 landed