[Haskell-cafe] Optimizing a high-traffic network architecture
Einar Karttunen
ekarttun at cs.helsinki.fi
Thu Dec 15 22:08:11 EST 2005
On 15.12 17:14, John Meacham wrote:
> On Thu, Dec 15, 2005 at 02:02:02PM -0000, Simon Marlow wrote:
> > With 2k connections the overhead of select() is going to start to be a
> > problem. You would notice the system time going up. -threaded may help
> > with this, because it calls select() less often.
>
> we should be using /dev/poll on systems that support it. it cuts down on
> the overhead a whole lot. 'poll(2)' is also mostly portable and usually
> better than select since there is no arbitrary file descriptor limit and
> it doesn't have to traverse the whole bitset. a few #ifdefs should let
> us choose the optimum one available on any given system.
To matters nontrivial all the *nix variants use a different
more efficient replacement for poll.
Solaris has /dev/poll
*BSD (and OS X) has kqueue
Linux has epoll
Also on linux NPTL+blocking calls can actually be very fast
with a suitable scenario. An additional problem is that
these mechanisms depend on the version of the kernel
running on the machine... Thus e.g. not all linux machines
will have epoll.
- Einar Karttunen
More information about the Haskell-Cafe
mailing list