RE: Parallel Apply

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Zhijie Hou' <houzhijie22(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Tomas Vondra <tomas(at)vondra(dot)me>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Andrei Lepikhov <lepihov(at)gmail(dot)com>, wenhui qiu <qiuwenhuifx(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>
Subject: RE: Parallel Apply
Date: 2026-11-13 11:49:11
Message-ID: OS7PR01MB1831709AEBF40AFF8D4022A11F57F2@OS7PR01MB18317.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

> Here is the v28 patch set, which addresses all the comments so far, including
> the above and:
>
> * Manu's comments, including one performance bottleneck due to pg_sleep() [1]
> * Vignesh's comments [2][3]
> * Shlok's comments [4]

I ran the benchmark script based on the report, and confirmed skipping pg_usleep()
can significantly improve the performance.

Machine details
----------------
Intel(R) Xeon(R) CPU E5-2690 v4 @ 2.60GHz: 56 cores, 251GiB memory
Ubuntu 24.04 LST, Huge page is enabled.

Source code:
----------------
Three types of sources are prepared:
* HEAD (e9d0600a)
* HEAD + v27 patchset. This would be a baseline.
* HEAD + v27 + skip pg_usleep() in the first try. It's same as what v28 does.

Setup:
---------
Pub --> Sub
- Two nodes created in pub-sub logical replication setup.
- Both nodes have the same set of pgbench tables created with scale=200.
- The sub node is subscribed to all the changes from the pub node's
pgbench tables.

Workload Run:
--------------------
- Disable the subscription on Sub node
- Run default pgbench(read-write) only on Pub node with #clients=8
and each clients run 100000 transactions.
- Enable the subscription on Sub once pgbench completes and then
measure time taken in replication.

Attached script can construct the same setup and workload.

Results:
---------------
Each cell is a median of 5 runs. I found that skipping the sleep significantly
improves the performance.

number of workers v27 [s] v27 + skip pg_usleep() [s]
2 336.03 46.420
4 463.83 42.994
8 664.78 27.616
16 778.81 26.718
32 834.34 26.844
40 844.06 26.025

JFYI, result with HEAD was 56.115 [s]. It meant unconditional sleep could
cause a performance regression, must be avoided.

I'm thinking the brief measurement showed enough information, and upcoming
measurements should be done for v28 and newer.

Best regards,
Hayato Kuroda
FUJITSU LIMITED
> Zhijie Hou

Attachment Content-Type Size
scripts.zip application/x-zip-compressed 2.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2026-11-13 11:50:38 compiler attribute alloc_size
Previous Message Nikhil Sontakke 2026-11-13 11:16:17 Re: Dropping a composite attribute causes data integrity violations