Version française
Home     About     Download     Resources     Contact us    
Browse thread
ocamlnet and kernel poll
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Markus Mottl <markus.mottl@g...>
Subject: Re: [Caml-list] ocamlnet and kernel poll
On Thu, Sep 11, 2008 at 8:43 AM, Joel Reymont <joelr1@gmail.com> wrote:
> Suppose I want to build a server that runs on top of ocamlnet and handles
> 10k+ connections.
>
> ocamlnet seems to use select exclusively.
>
> Any suggestions on how to add kernel poll? Is this possible even?

The Core-library that we developed at Jane Street, and which is also
in Godi, contains a module "Linux_ext", which has a fully-featured
interface to epoll (besides lots of other Linux-specific goodies).

There you just call "Epoll.create" to get a file descriptor on which
to listen for I/O-events.  Then you only need to add other file
descriptors you want to monitor with "Epoll.add", specifying flags for
the kind of events you want to wait for.  "Epoll.modify" and
"Epoll.del" modify event flags of and remove monitored descriptors
respectively.  "Epoll.wait" allows you to wait for received events
(similar to "select").

Note, however, that "select" is usually more efficient for small (=
tens) numbers of descriptors!

Regards,
Markus

-- 
Markus Mottl http://www.ocaml.info markus.mottl@gmail.com