Re: Optimize LISTEN/NOTIFY
От | Joel Jacobson |
---|---|
Тема | Re: Optimize LISTEN/NOTIFY |
Дата | |
Msg-id | c8e84bb2-d2e5-4a77-b547-3a93c5778e7e@app.fastmail.com обсуждение исходный текст |
Ответ на | Re: Optimize LISTEN/NOTIFY ("Joel Jacobson" <joel@compiler.org>) |
Список | pgsql-hackers |
On Thu, Jul 24, 2025, at 23:03, Joel Jacobson wrote: > * 0001-Optimize-LISTEN-NOTIFY-signaling-with-a-lock-free-at.patch > * 0002-Optimize-LISTEN-NOTIFY-wakeup-by-replacing-signal-wi.patch I'm withdrawing the latest patches, since they won't fix the scalability problems, but only provide some performance improvements by eliminating redundant IPC signalling. This could also be improved outside of async.c, by optimizing ProcSignal [1] or removing ProcSignal as "Interrupts vs Signals" [2] is working on. There seems to be two different scalability problems, that appears to be orthogonal: First, it's the thundering herd problems that I tried to solve initially in this thread, by introducing a hash table in shared memory, to keep track of what backends listen to what channels, to avoid immediate wakeup of all listening backends for every notification. Second, it's the heavyweight lock in PreCommit_Notify(), that prevents parallelism of NOTIFY. Tom Lane has an idea [3] on how to improve this. My perf+pgbench experiments indicate that out of these two different scalability problems, if one or the other is the bottleneck depends on the workload. I think the idea of keeping track of channels per backends has merit, but I want to take a step back and see what others think about the idea first. I guess my main question is if we think we should fix one problem first, then the other, both at the same time, or only one or the other? I've attached some benchmarks using pgbench and running postgres under perf, which I hope can provide some insights. /Joel [1] https://www.postgresql.org/message-id/flat/a0b12a70-8200-4bd4-9e24-56796314bdce%40app.fastmail.com [2] https://www.postgresql.org/message-id/flat/CA%2BhUKG%2B3MkS21yK4jL4cgZywdnnGKiBg0jatoV6kzaniBmcqbQ%40mail.gmail.com [3] https://www.postgresql.org/message-id/1878165.1752858390%40sss.pgh.pa.us
Вложения
В списке pgsql-hackers по дате отправления: