Re: scalability bottlenecks with (many) partitions (and more)
Tomas Vondra <tomas@vondra.me>
From: Tomas Vondra <tomas@vondra.me>
To: Jakub Wartak <jakub.wartak@enterprisedb.com>
Cc: Robert Haas <robertmhaas@gmail.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Andres Freund <andres@anarazel.de>
Date: 2024-09-17T20:16:04Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Make FP_LOCK_SLOTS_PER_BACKEND look like a function
- c878de1db438 18.0 landed
-
Fix asserts in fast-path locking code
- a7e5237f268e 18.0 landed
-
Increase the number of fast-path lock slots
- c4d5cb71d229 18.0 landed
Attachments
- lock-test.sh (application/x-shellscript)
- lock-test.pdf (application/pdf)
- lock-test.ods (application/vnd.oasis.opendocument.spreadsheet)
I've spent the last couple days doing all kinds of experiments trying to find regressions caused by the patch, but no success. Which is good. Attached is a script that just does a simple pgbench on a tiny table, with no or very few partitions. The idea is that this will will fit into shared buffers (thus no I/O), and will fit into the 16 fast-path slots we have now. It can't benefit from the patch - it can only get worse, if having more fast-path slots hurts. I ran this on my two machines, and in both cases the results are +/- 1% from the master for all combinations of parameters (clients, mode, number of partitions, ..). In most cases it's actually much closer, particularly with the default max_locks_per_transaction value. For higher values of the GUC, I think it's fine too - the differences are perhaps a bit larger (~1.5%), but it's clearly hardware specific (i5 gets a bit faster, xeon a bit slower). And I'm pretty sure people who increased that GUC value likely did that because of locking many rels, and so will actually benefit from the increased fast-path capacity. At this point I'm pretty happy and confident the patch is fine. Unless someone objects, I'll get it committed after going over over it one more time. I decided to commit that as as a single change - it would be weird to have an intermediate state with larger arrays in PGPROC, when that's not something we actually want. I still haven't found any places in the docs that should mention this, except for the bit about max_locks_per_transaction GUC. There's nothing in SGML mentioning details of fast-path locking. I thought we have some formula to calculate per-connection memory, but I think I confused that with the shmmem formulas we had in "Managing Kernel Resources". But even that no longer mentions max_connections in master. regards -- Tomas Vondra