Re: Proposal: Out-of-Order NOTIFY via GUC to Improve LISTEN/NOTIFY Throughput
Joel Jacobson <joel@compiler.org>
From: "Joel Jacobson" <joel@compiler.org>
To: "Rishu Bagga" <rishu.postgres@gmail.com>
Cc: "Tom Lane" <tgl@sss.pgh.pa.us>,
pgsql-hackers <pgsql-hackers@postgresql.org>,
"nik@postgres.ai" <nik@postgres.ai>
Date: 2025-07-30T09:03:59Z
Lists: pgsql-hackers
On Tue, Jul 22, 2025, at 14:48, Joel Jacobson wrote: > Benchmark from original post: ... > For a normal PostgreSQL with the CPU and storage on the same physical machine, > I think the results above clearly demonstrate that the global exclusive lock > is at least not the bottleneck, which I strongly believe instead is the flood of > unnecessary kill(pid, SIGUSR1) syscalls. I was wrong here. This is much more complex than I initially thought. After some additional benchmarking and analyzing perf results, I realize the bottleneck depends on the workload, which is either the kill() syscalls *or* the heavyweight lock. Here is one scenario where the heavyweight lock actually *is* the bottleneck: 1 session does LISTEN pgbench -f notify.sql -c 1000 -j 8 -T 60 -n Simply commenting out the heavyweight lock gives a dramatic difference: tps = 7679 (with heavyweight lock; in commit order) tps = 95430 (without heavyweight lock; not in commit order) My conclusion so far is that we would greatly benefit both from reducing/eliminating kill() syscalls, as well as finding ways to avoid the heavyweight lock while preserving commit order. /Joel