From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 1C395BBB7 for ; Thu, 11 Sep 2008 16:04:41 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtgAAK/CyEhKfSwejWdsb2JhbACDEY8VPgEBAQEJAwgJDwWeRYZMAQKEBw X-IronPort-AV: E=Sophos;i="4.32,379,1217800800"; d="scan'208";a="16835023" Received: from yx-out-2324.google.com ([74.125.44.30]) by mail3-smtp-sop.national.inria.fr with ESMTP; 11 Sep 2008 16:04:40 +0200 Received: by yx-out-2324.google.com with SMTP id 3so128274yxj.3 for ; Thu, 11 Sep 2008 07:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=97t852uq31dSkJeYLUOG9pUrgfP1pR33EL1dxDiBAx8=; b=viKFz/lqEtgf+qDj2EUp3Kpg4sCQHlHfRRwSPfITMicS778BIRtyxBFMg3c0qNtgmu SpqH+EKluU/dMJEy49I0EWsUw+Aok84MKr+a/+iODQHiyzD9ikZyO/riyCt0GOEy40Z4 EhhMsH1E/qmA3glI5DIYFmdPEUU6Qo5Y1MP0s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=lrq7gIWjKhkbg9Ekb6Q/y2j4YxuaJLmjo4mgsuQhlbR6YQyLF78+b6Op1wt3x1bxlI efq0qW5P4J4r4OaQ7R2krEE+NJeN6hXmC5w7qfrk7VdkVHDxUECJgWyOF26LeVv1WsIa TeGe8af7kraAs7o8C+d0jpLQYIjgKIzrOgxH4= Received: by 10.142.47.6 with SMTP id u6mr943720wfu.300.1221141878079; Thu, 11 Sep 2008 07:04:38 -0700 (PDT) Received: by 10.143.35.6 with HTTP; Thu, 11 Sep 2008 07:04:38 -0700 (PDT) Message-ID: Date: Thu, 11 Sep 2008 10:04:38 -0400 From: "Markus Mottl" To: "Joel Reymont" Subject: Re: [Caml-list] ocamlnet and kernel poll Cc: "O'Caml Mailing List" In-Reply-To: <01677251-3A8D-4DCA-9E39-7D17FAC92645@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <01677251-3A8D-4DCA-9E39-7D17FAC92645@gmail.com> X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 ocamlnet:01 ocamlnet:01 descriptors:01 flags:01 flags:01 descriptors:01 ocaml:01 wrote:01 caml-list:01 descriptor:02 kernel:02 On Thu, Sep 11, 2008 at 8:43 AM, Joel Reymont 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