Re: High CPU consumption in cascade replication with large number of walsenders and ConditionVariable broadcast issues

Alexey Makhmutov <a.makhmutov@postgrespro.ru>

From: Alexey Makhmutov <a.makhmutov@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Date: 2025-03-30T22:19:29Z
Lists: pgsql-hackers

Attachments

 > We’ve prepared two test patches on top of current master to address 
both issues:
 > ...
 > * 0002-Implement-batching-for-cascade-replication.patch – test patch 
to implement possible batching approach in xlogreceiver.c with timer. 
Currently it uses GUC variables to allow testing of different batch 
sizes and timeout values.

I've played with the second patch a little more and made some 
adjustments to it:
1. Setup timer only if we actually have applied messages, which are 
(potentially) not yet signaled to walsenders.
2. Notify logical walsenders without delay if time line has changed.

Modified patch is attached.

Thanks,
Alexey