Skip site navigation (1) Skip section navigation (2)

Pipes vs Events

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "pgsql-hackers-win32" <pgsql-hackers-win32(at)postgresql(dot)org>
Subject: Pipes vs Events
Date: 2003-12-17 12:47:53
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE171579@algol.sollentuna.se (view raw or flat)
Thread:
Lists: 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

Next:From: Tom LaneDate: 2003-12-17 14:56:49
Subject: Re: [HACKERS] [PATCHES] fork/exec patch
Previous:From: Magnus HaganderDate: 2003-12-17 10:03:08
Subject: Re: [HACKERS] [PATCHES] fork/exec patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group