Re: scalability bottlenecks with (many) partitions (and more)
Tomas Vondra <tomas@vondra.me>
From: Tomas Vondra <tomas@vondra.me>
To: Robert Haas <robertmhaas@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>,
Andres Freund <andres@anarazel.de>
Date: 2024-09-05T17:21:01Z
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
- v20240905-0001-Increase-the-number-of-fast-path-lock-slot.patch (text/x-patch) patch v20240905-0001
- v20240905-0002-Size-fast-path-slots-using-max_locks_per_t.patch (text/x-patch) patch v20240905-0002
- v20240905-0003-separate-guc-to-allow-benchmarking.patch (text/x-patch) patch v20240905-0003
- v20240905-0004-lock-stats.patch (text/x-patch) patch v20240905-0004
Hi, Here's a bit more polished version of this patch series. I only propose 0001 and 0002 for eventual commit, the two other bits are just stuff to help with benchmarking etc. 0001 ---- increases the size of the arrays, but uses hard-coded number of groups (64, so 1024 locks) and leaves everything in PGPROC 0002 ---- Allocates that separately from PGPROC, and sets the number based on max_locks_per_transactions I think 0001 and 0002 should be in fairly good shape, IMO. There's a couple cosmetic things that bother me (e.g. the way it Asserts after each FAST_PATH_LOCK_REL_GROUP seems distracting). But other than that I think it's fine, so a review / opinions would be very welcome. 0003 ---- Adds a separate GUC to make benchmarking easier (without the impact of changing the size of the lock table). I think the agreement is to not have a new GUC, unless it turns out to be necessary in the future. So 0003 was just to make benchmarking a bit easier. 0004 ---- This was a quick attempt to track the fraction of fast-path locks, and adding the infrastructure is mostly mechanical thing. But it turns out it's not quite trivial to track why a lock did not use fast-path. It might have been because it wouldn't fit, or maybe it's not eligible, or maybe there's a stronger lock. It's not obvious how to count these to help with evaluating the number of fast-path slots. regards -- Tomas Vondra