Synch Rep: communication between backends and walsender

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Synch Rep: communication between backends and walsender
Date: 2009-06-16 11:50:29
Message-ID: 3f0b79eb0906160450n7680bb4se35255d330464ee8@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

http://archives.postgresql.org/pgsql-hackers/2008-12/msg00448.php

One of the major complaints about the current synch rep patch is that
signals are used for communication between backends and walsender.
On some platforms, a signal doesn't interrupt sleep (i.e. poll or select
system call), which would increase the performance overhead of
replication.

So I'd like to propose using the UDP socket and the semaphores
instead of signals for communication from backends to walsender
and vice versa, respectively.

The UDP socket is used for backends to request walsender to send
WAL records. Semaphores cannot be used for this purpose because
walsender must wait for the request from backends and the reply from
the standby server concurrently. Some UDP packets might get lost,
but that doesn't matter because the important data is communicated
via the shared memory and walsender wakes up periodically without
receiving that request. This UDP socket can be created like that for
statistics collector.

On the other hand, the semaphores are used for backends to wait
for the reply from walsender. The backend registers its semaphore
on the shared memory before sleeping, then walsender wakes it up
by using that semaphore.

Comments? Do you have another better approach?

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-06-16 12:03:24 Re: [PATCH] backend: compare word-at-a-time in bcTruelen
Previous Message Andres Freund 2009-06-16 11:19:18 Re: machine-readable explain output