[RFC,PATCH] SIGPIPE masking in local socket connections - Mailing list pgsql-hackers

From Jeremy Kerr
Subject [RFC,PATCH] SIGPIPE masking in local socket connections
Date
Msg-id 1243914753.517210.131510259224.0.gpush@pingu
Whole thread Raw
Responses Re: [RFC,PATCH] SIGPIPE masking in local socket connections
List pgsql-hackers
Currently, I'm seeing the psecure_{red,write} functions being invoked
when connecting to postgres via a unix domain socket. psecure_write
seems to alter the signal mask of the process to disable sigpipe
reporting. psecure_read only does this when the connection is using SSL.

When using a multithreaded client application on Linux, this can result
in poor scalability. Each change to the signal mask requires an
current->sighand->siglock, which becomes highly contended between
the client threads. It also means we do 3 syscalls per write: mask
sigpipe, write, unmask sigpipe.

The following patch changes psecure_write to be more like psecure_read -
it only alters the signal mask if the connection is over SSL. It's only
an RFC, as I'm not entirely sure about the reasoning behind blocking
SIGPIPE for the non-SSL case - there may be other considerations here.

With this change I see the following performance improvement
during a sysbench OLTP run:
http://ozlabs.org/~jk/projects/db/data/sigpipe-perf.png
load: sysbench --test=oltp --oltp-read-only=on, connecting locally,machine: POWER6, 64-way, 4.2GHz

Comments most welcome,


Jeremy

---
Jeremy Kerr (1):     Only disable sigpipe during SSL write



pgsql-hackers by date:

Previous
From: Jeremy Kerr
Date:
Subject: [RFC,PATCH] Only disable sigpipe during SSL write
Next
From: Kris Jurka
Date:
Subject: Re: It's June 1; do you know where your release is?