Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue

From: "Joel Jacobson" <joel(at)compiler(dot)org>
To: "Heikki Linnakangas" <hlinnaka(at)iki(dot)fi>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue
Date: 2025-11-04 20:43:15
Message-ID: f118ff45-5978-4225-9545-56b3af83122b@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 4, 2025, at 13:09, Heikki Linnakangas wrote:
> With that and the patches I posted
> previously, I'm getting:
>
> $ PGHOST=localhost PGDB=postgres://localhost/postgres
> ./async-notify-test-3 --listeners=50 --notifiers=4 --channels=1
> --extra-channels=10000
> 10 s: 12716 sent (1274/s), 635775 received (63737/s)
> 0.00-0.01ms 0 (0.0%) avg: 0.000ms
> 0.01-0.10ms 0 (0.0%) avg: 0.000ms
> 0.10-1.00ms # 1915 (0.3%) avg: 0.807ms
> 1.00-10.00ms ######### 633550 (99.7%) avg: 3.502ms
> 10.00-100.00ms # 310 (0.0%) avg: 11.423ms
> >100.00ms 0 (0.0%) avg: 0.000ms
> ^C
>
> Whereas on 'master', I see about 2-3x more notifies/s:
>
> $ PGHOST=localhost PGDB=postgres://localhost/postgres
> ./async-notify-test-3 --listeners=50 --notifiers=4 --channels=1
> --extra-channels=10000
> 10 s: 32057 sent (3296/s), 1602995 received (164896/s)
> 0.00-0.01ms 0 (0.0%) avg: 0.000ms
> 0.01-0.10ms # 11574 (0.7%) avg: 0.078ms
> 0.10-1.00ms ###### 1082960 (67.6%) avg: 0.577ms
> 1.00-10.00ms ### 508199 (31.7%) avg: 1.489ms
> 10.00-100.00ms # 262 (0.0%) avg: 16.178ms
> >100.00ms 0 (0.0%) avg: 0.000ms

Nice with the --extra-channels addition!

Below results on my MacBook Pro M3 Max.
I ran them for 30s to get more stable distributions.

% ninja install
C compiler for the host machine: cc (clang 17.0.0 "Apple clang version 17.0.0 (clang-1700.0.13.5)")
C linker for the host machine: cc ld64 1167.5
Host machine cpu family: aarch64
Host machine cpu: aarch64
buildtype: release

% gcc -Wall -Wextra -O2 -pthread -I/Users/joel/pg19/include/postgresql/server -I/Users/joel/pg19/include -o async-notify-test-3 async-notify-test-3.c -L/Users/joel/pg19/lib -lpq -pthread -lm

% ./async-notify-test-3 --listeners=50 --notifiers=4 --channels=1 --extra-channels=10000

# master (c98dffcb7c7010d216dc16d22cb594ef7d65fde1)
30 s: 293329 sent (9656/s), 14653182 received (480181/s)
0.00-0.01ms 0 (0.0%) avg: 0.000ms
0.01-0.10ms # 298195 (2.0%) avg: 0.078ms
0.10-1.00ms ## 3060085 (20.9%) avg: 0.390ms
1.00-10.00ms ## 3310362 (22.6%) avg: 4.242ms
10.00-100.00ms ##### 7482595 (51.1%) avg: 44.441ms
>100.00ms # 501945 (3.4%) avg: 119.257ms

# 0001-Fix-bug-where-we-truncated-CLOG-that-was-still-neede.patch
# 0002-Hold-SLRU-bank-lock-across-TransactionIdDidCommit-in.patch
30 s: 87462 sent (3174/s), 4373100 received (158698/s)
0.00-0.01ms 0 (0.0%) avg: 0.000ms
0.01-0.10ms # 16 (0.0%) avg: 0.091ms
0.10-1.00ms # 576554 (13.2%) avg: 0.798ms
1.00-10.00ms ######## 3796530 (86.8%) avg: 1.589ms
10.00-100.00ms 0 (0.0%) avg: 0.000ms
>100.00ms 0 (0.0%) avg: 0.000ms

# v2-0001-Fix-bug-where-we-truncated-CLOG-that-was-still-ne.patch
# v2-0002-Fix-remaining-race-condition-with-CLOG-truncation.patch
30 s: 274342 sent (10134/s), 13708284 received (525274/s)
0.00-0.01ms 0 (0.0%) avg: 0.000ms
0.01-0.10ms # 241981 (1.8%) avg: 0.079ms
0.10-1.00ms ### 4213484 (30.7%) avg: 0.399ms
1.00-10.00ms # 2727917 (19.9%) avg: 4.033ms
10.00-100.00ms #### 5920198 (43.2%) avg: 46.500ms
>100.00ms # 604712 (4.4%) avg: 118.336ms

/Joel

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Alger 2025-11-04 20:56:41 Re: [PATCH] Add pretty formatting to pg_get_triggerdef
Previous Message Tom Lane 2025-11-04 20:41:25 Re: Add notification on BEGIN ATOMIC SQL functions using temp relations