Reinventing the wheel...

Lists: pgsql-hackers
From: Sean Chittenden <sean(at)chittenden(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Reinventing the wheel...
Date: 2003-07-21 00:16:04
Message-ID: 20030721001604.GE24784@perrin.int.nxad.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

While talking with someone about code portability and building in a
scalable persistent connection manager into PostgreSQL, someone
pointed me to libevent's existence . In the past, I'd always
rewritten this wrapper by hand every time I needed to do handle
providing a generic kqueue/poll/select. It looks Niels has done this
correctly and in a more general/useful way. Because this library
provides a much more general interface that makes use of an OSes
optimal FD event system call, is BSD licensed (standard 3-4 clause
license), and should be very portable, would would anyone object if I
integrated this into the tree? The savings across the entire tree
could be sizable, though I have no numbers to back this up other than
the graphs that are presented.

http://www.monkey.org/~provos/libevent/libevent-benchmark.jpg
http://www.monkey.org/~provos/libevent/libevent-benchmark2.jpg

To prevent lib naming collisions with machines that have libevent
installed, I plan on renaming all of the functions from event_* to
pgevent_*. libevent also has the appropriate autoconf goo to make
detection of the right library pretty seamless. It even supports the
new Linux interface epoll.

Tom, I know you just replaced a bunch of select() calls with poll().
Would you mind if I went through and patched things to use libevent's
abstraction layer?

Once this is done, then I'll go back and use libevent for the
persistent connections goo. -sc

--
Sean Chittenden


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sean Chittenden <sean(at)chittenden(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Reinventing the wheel...
Date: 2003-07-21 04:28:10
Message-ID: 19943.1058761690@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sean Chittenden <sean(at)chittenden(dot)org> writes:
> ... Because this library
> provides a much more general interface that makes use of an OSes
> optimal FD event system call, is BSD licensed (standard 3-4 clause
> license), and should be very portable, would would anyone object if I
> integrated this into the tree?

AFAICS this library is presuming facts not in evidence, namely that
we care about watching thousands of connections at once. In the
current Postgres structure we have absolutely no use for it.

You're welcome to base your multiconnection hack on it, but I won't
vote for integrating any of that work until I see proof that it's
actually a win (which, quite honestly, I do not expect to see).

regards, tom lane


From: "Peter Galbavy" <peter(dot)galbavy(at)knowtion(dot)net>
To: "Sean Chittenden" <sean(at)chittenden(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Reinventing the wheel...
Date: 2003-07-21 09:52:44
Message-ID: 00b401c34f6d$d58f6540$7c28a8c0@cblan.mblox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Sean Chittenden wrote:
> To prevent lib naming collisions with machines that have libevent
> installed, I plan on renaming all of the functions from event_* to
> pgevent_*. libevent also has the appropriate autoconf goo to make
> detection of the right library pretty seamless. It even supports the
> new Linux interface epoll.

Please don't. For those of us using an OS that has libevent as standard,
this is just pollution and perhaps you should instead look to carry the
portable code in the distribution and build/link to it if the normal
libevent is not available (configure will happily check for you).

Peter