Re: What do you think about Zed Shaw / Mongrel2's "SuperPoll"?

From: Willy Tarreau <w#1wt.eu>
Date: Fri, 5 Aug 2011 07:46:05 +0200


Hi Carlo,

On Thu, Aug 04, 2011 at 01:44:10PM -0700, carlo flores wrote:
> Hey Willy, all.
>
> We are playing with Mongrel2 and found this post from Zed interesting and --
> for myself -- surprising: http://sheddingbikes.com/posts/1280829388.html
>
> Have you had a chance to read, think about, or respond to it with regards to
> poll vs epoll in HAProxy versus the number of active and total connections?

No, I didn't know about this article, and I wouldn't trust it too much considering the tests were performed in the context of a server that makes haproxy a success :-)

The measures I've done indicate very different results from what is posted above. The guy seems to completely forget the cost of setting up the polling list, and processing the results :

I know for sure that epoll wins over poll with large numbers of fds. When some production servers runs at low CPU usage with more than 100k fds, it's a fact that it's not even possible with poll. I've experienced it in the past, and CPU was at 100% well before reaching these loads, simply because the poll list had to be rebuilt tens of thousands of times per second, and all the CPU was spent doing that instead of doing useful work. That's the reason why I think this guy's tests were incorrect.

Epoll is not easy to efficiently deal with, but you have to build your soft around it for it to be very efficient, not to use it as a drop-in for poll(), which I'm sure this guy did. Most likely his tests were done with an epoll loop which scans the whole fd list and performs the epoll_ctl(ADD/REMOVE), which totally voids the point of the O(1) polling.

In short, what I'd recommend is the following :

Note that FreeBSD's kqueue interface is much nicer than the level-triggered epoll interface. However I would consider it on par with the event-triggered one.

Regards,
Willy Received on 2011/08/05 07:46

This archive was generated by hypermail 2.2.0 : 2011/08/05 08:00 CEST