connection establishment versus parallel workers
Nathan Bossart <nathandbossart@gmail.com>
From: Nathan Bossart <nathandbossart@gmail.com>
To: pgsql-hackers@postgresql.org
Cc: thomas.munro@gmail.com
Date: 2024-12-11T20:42:58Z
Lists: pgsql-hackers
Attachments
- repro.txt (text/plain)
My team recently received a report about connection establishment times increasing substantially from v16 onwards. Upon further investigation, this seems to have something to do with commit 7389aad (which moved a lot of postmaster code out of signal handlers) in conjunction with workloads that generate many parallel workers. I've attached a set of reproduction steps. The issue seems to be worst on larger machines (e.g., r8g.48xlarge, r5.24xlarge) when max_parallel_workers/max_worker_process is set very high (>= 48). Our theory is that commit 7389aad (and follow-ups like commit 239b175) made parallel worker processing much more responsive to the point of contending with incoming connections, and that before this change, the kernel balanced the execution of the signal handlers and ServerLoop() to prevent this. I don't have a concrete proposal yet, but I thought it was still worth starting a discussion. TBH I'm not sure we really need to do anything since this arguably comes down to a trade-off between connection and worker responsiveness. -- nathan
Commits
-
Fix latch event policy that hid socket events.
- b4b52c911aaf 16.7 landed
- 44f400fbc6a4 17.3 landed
- 73f6b9a3b0fe 18.0 landed
-
Teach WaitEventSetWait() to report multiple events on Windows.
- 04a09ee944ac 17.0 cited
-
Process pending postmaster work before connections.
- 239b1753421c 16.0 cited
-
Use WaitEventSet API for postmaster's event loop.
- 7389aad63666 16.0 cited
-
Replace buffer I/O locks with condition variables.
- d87251048a0f 14.0 cited