[Beowulf] Re: dealing with lots of sockets

Perry E. Metzger perry at piermont.com
Thu Jul 3 07:04:19 PDT 2008


Lawrence Stewart <larry.stewart at sicortex.com> writes:
> My obligatory internet startup wrote a new single-threaded single-
> process web server based on select(2) with careful attention to the
> blocking or not nature of the kernel calls and were able to handle
> some hundreds of connections per second on the same hardware and
> over 1000 open connections before breaking the stack.  Alas it was
> never made open source and the company is gone.

There are others out there now, so the one can find a reasonable event
driven http server pretty easily.

> More recently at SiCortex, We've been using libevent to write single
> threaded applications that do multithreaded things.  On our 16
> megabyte 70 MHz freescale embedded boot processors, this is very
> handy for reducing the memory footprint.  On the x86 front end, a
> single process has no difficulty multiplexing 1000 streams of
> console data this way.  I'd hate to have a process for each one of
> those!

You couldn't possibly manage a process for every one of those -- the
only way to get the sort of performance you're talking about is with
events. You picked right with events.

> So if anyone wants to try an easy to use event library, I can
> recommend libevent.  The learning curve is modest.  It does require
> a little turning inside out to do things like have a tftp client as
> a libevent task but its not bad.

Libevent was the result of my describing to Niels Provos the way we
wrote ticker plants and trading software at a particular hedge fund I
was at in the early 1990s.

We used libXt, the X toolkit library, as our event driven programming
environment on SERVERS. It turned out to work rather well. I was at
the Atlanta Linux Showcase many years ago when Niels was a grad
student and he presented a paper showing how much better events were
than threads or other methods for managing large loads. I explained to
him afterwards what we had done, and he proceeded to write a pretty
amazing piece of open source software.

I don't take any credit for it at all, but I am happy that something
came out of my experiences, because the software we built at that
hedge fund also got lost to history, just as your http server was. It
is good that the ideas survived, at least.


Perry
-- 
Perry E. Metzger		perry at piermont.com



More information about the Beowulf mailing list