Re: SLRU optimization - configurable buffer pool and partitioning the SLRU lock
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-10-24T17:04:51Z
Lists: pgsql-hackers
On Tue, Oct 24, 2023 at 06:04:13PM +0200, Alvaro Herrera wrote: > Like everybody else, I like having less GUCs to configure, but going > this far to avoid them looks rather disastrous to me. IMO we should > just use Munro's older patches that gave one GUC per SLRU, and users > only need to increase the one that shows up in pg_wait_event sampling. > Someday we will get the (much more complicated) patches to move these > buffers to steal memory from shared buffers, and that'll hopefully let > use get rid of all this complexity. +1 > On the other hand, here's a somewhat crazy idea. What if, instead of > stealing buffers from shared_buffers (which causes a lot of complexity), > we allocate a common pool for all SLRUs to use? We provide a single > knob -- say, non_relational_buffers=32MB as default -- and we use a LRU > algorithm (or something) to distribute that memory across all the SLRUs. > So the ratio to use for this SLRU or that one would depend on the nature > of the workload: maybe more for multixact in this server here, but more > for subtrans in that server there; it's just the total amount that the > user would have to configure, side by side with shared_buffers (and > perhaps scale with it like wal_buffers), and the LRU would handle the > rest. The "only" problem here is finding a distribution algorithm that > doesn't further degrade performance, of course ... I think it's worth a try. It does seem simpler, and it might allow us to sidestep some concerns about scaling when the SLRU pages are in shared_buffers [0]. [0] https://postgr.es/m/ZPsaEGRvllitxB3v%40tamriel.snowman.net -- Nathan Bossart Amazon Web Services: https://aws.amazon.com
Commits
-
Fix zeroing of pg_serial page without SLRU bank lock
- be2f07310063 17.0 landed
-
Fix misspelled assertions
- 0d3a71d0c8a7 17.0 landed
-
GUC table: Add description to computed variables
- 30b8d6e4ce11 17.0 landed
-
Improve performance of subsystems on top of SLRU
- 53c2a97a9266 17.0 landed
-
Rename SLRU elements in view pg_stat_slru
- bcdfa5f2e2f2 17.0 landed
-
Use atomic access for SlruShared->latest_page_number
- d172b717c6f4 17.0 landed
-
Split use of SerialSLRULock, creating SerialControlLock
- 7b745d85b80d 17.0 landed
-
Index SLRUs by 64-bit integers rather than by 32-bit integers
- 4ed8f0913bfd 17.0 cited
-
Add a macro templatized hashtable.
- b30d3ea824c5 10.0 cited