News for hackers. Stuff that matters.
Re:Fast portable non-blocking network programming with Libevent by RoboTeddy on Monday January 11, 2010 @09:23AM (#1045118)
Libevent is rock solid -- it handles the event loop for memcache, among other things. This guide looks like a great improvement/accompaniment to libevent's docs.

One problem with using an event dispatcher like libevent is that libraries that make their own blocking calls won't cooperate. That means you'll often be stuck with limited capabilties, unless you write your own libraries or hack up existing ones.

There's a Python project called gevent (http://www.gevent.org/) that works atop libevent. It monkey-patches the python socket module with a version that automatically cooperates with libevent's loop. It uses greenlets to make code written sychronously run asynchronously behind the scenes. If, for example, you want to use an Amazon S3 library that makes use of python's httplib (which would normally block and choke your event loop), it'll automatically work with gevent/libevent. If you need to handle lots of concurrent connections and don't need to be working in C, check it out.

Re:Fast portable non-blocking network programming with Libevent by mcav on Monday January 11, 2010 @10:12AM (#1045181)
Note that gevent is a fork of Eventlet (http://www.eventlet.org/), and there have been talks of reincorporating changes that went to gevent back into eventlet.
Re:Fast portable non-blocking network programming with Libevent by houseabsolute on Monday January 11, 2010 @09:46AM (#1045143)
It's too bad that no standard method for a asynchronous events has been developed for Unix in general. Where I work, there's one single library for concurrency, and every program or toolkit uses it. We do a lot of network programming, so it would be unthinkable for any performance intensive application to do blocking calls exclusively.
Re:Fast portable non-blocking network programming with Libevent by silentbicycle on Monday January 11, 2010 @10:07AM (#1045175)
libevent tries to provide a common interface to select, poll, kselect (on BSD), epoll (on Linux), and comparable calls on Windows. It's not a standard part of Unix, of course, but it seems reasonably portable.
Re:Fast portable non-blocking network programming with Libevent by houseabsolute on Monday January 11, 2010 @10:18AM (#1045195)
Sure, but libraries underneath you have to cooperate for you to use it to the fullest potential. That no common means have been invented for that is what I'm sad about.
Re:Fast portable non-blocking network programming with Libevent by silentbicycle on Monday January 11, 2010 @10:33AM (#1045225)
Right. Once you set up a non-blocking event loop, it's much simpler when you can go async all the way down.
Re:Fast portable non-blocking network programming with Libevent by sophacles on Monday January 11, 2010 @10:58AM (#1045300)
Also for python is pyevent, which works pretty well. I have used it to much success -- some people don't like the minimalist style. Also, the maintainer only updates sporadically, but I've never had real problems with it. http://code.google.com/p/pyevent/
Re:Fast portable non-blocking network programming with Libevent by denik on Monday January 11, 2010 @11:32AM (#1045382)
gevent homepage is not available due to enom outage (suckers!) Here's a mirror: http://python-gevent.appspot.com