Pipes vs Events - Mailing list pgsql-hackers-win32

From Magnus Hagander
Subject Pipes vs Events
Date
Msg-id 6BCB9D8A16AC4241919521715F4D8BCE171579@algol.sollentuna.se
Whole thread Raw
List pgsql-hackers-win32
Hi!

I did some very rudimentary performance testing on "the pipe model" vs
"the event and shared mem model".

When using the Connx code right off, named pipes were significantly
faster. This is because of the Sleep(100) call that was in the Connx
code.

However, when switching to using two events and one shared memory
section (one event signalling in each direction, so WaitForSingleObject
with an actual timeout can be used instead of a manual loop with a Sleep
call in it), using this method was almost 20 times faster than using
named pipes.

I don't know how performance critical this part is, but it's a
significant enough difference to think about, I think.

On a sidenote, I don't think the Connx code right off is secure against
two clients hitting the same backend with a signal at the same time.
There is a (very small) window where they might conflict, since the
shared memory is not protected by a mutex. But this is easily fixed.
Named pipes are automatically synchronized, so this problem does not
appear in that scenario.


//Magnus


pgsql-hackers-win32 by date:

Previous
From: "Magnus Hagander"
Date:
Subject: Re: [HACKERS] [PATCHES] fork/exec patch
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] [PATCHES] fork/exec patch