Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Török Edwin" <edwintorok@gmail.com>
To: "Jérémie Dimino" <jeremie@dimino.org>
Cc: Dario Teixeira <darioteixeira@yahoo.com>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] scalable web apps
Date: Mon, 26 Jul 2010 11:19:20 +0300	[thread overview]
Message-ID: <20100726111920.22882a95@deb0> (raw)
In-Reply-To: <20100726075901.GA5561@aurora>

On Mon, 26 Jul 2010 09:59:01 +0200
Jérémie Dimino <jeremie@dimino.org> wrote:

> On Mon, Jul 26, 2010 at 10:29:04AM +0300, Török Edwin wrote:
> > Lwt's Lwt_preemptive seems to allow one to use 'preemptive
> > threads' (which I assume are just usual OCaml threads).
> > So would it be possible to put the file I/O on Lwt_preemptive.detach
> > threads?
> 
> Yes.
> 
> > Has anyone tried to measure the performance of doing that?
> 
> Yes, i tried it some time ago with two small C programs which were
> just reading a file on the disk. One doing read operations in a
> simple loop, and one launching a thread for each read operation (or
> reusing the same thread). The threaded version was about 100 times
> slower than the non-threaded one.
> 
> BTW it is planed to add some kind of asynchronous file I/O support in
> Lwt by using mmap and mincore.

How about using linux's AIO and eventfd?

Manpage of eventfd says:
"When used in the kernel, an eventfd file descriptor can provide a
kernel-userspace bridge  allowing,  for  example, functionalities like
KAIO (kernel AIO) to signal to a file descriptor that some operation is
complete.

A  key point about an eventfd file descriptor is that it can be
monitored just like any other file descriptor using select(2),
poll(2), or epoll(7).  This means that an application can
simultaneously monitor the readiness of  "tra‐ ditional"  files
and  the  readiness  of other kernel mechanisms that support the
eventfd interface."

And looks like libaio-ocaml has support for eventfd in AIO:
val fd : context -> Unix.file_descr
  (** return eventfd associated with the context *)

I think there could be a Lwt_unix.read_aio that is just
like Lwt_unix.read, except it checks the eventfd descriptor for being
readable instead of the original fd, and use Aio.read instead of usual
read, etc.

Best regards,
--Edwin


  reply	other threads:[~2010-07-26  8:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-24  7:49 Joel Reymont
2010-07-24  8:57 ` Sylvain Le Gall
2010-07-24 10:55 ` [Caml-list] " William Le Ferrand
2010-07-25 13:52 ` Dario Teixeira
2010-07-25 19:19   ` Joel Reymont
2010-07-26  7:29   ` Török Edwin
2010-07-26  7:59     ` Jérémie Dimino
2010-07-26  8:19       ` Török Edwin [this message]
2010-07-27  6:46         ` Jérémie Dimino
2010-07-26 11:27       ` Dario Teixeira
2010-07-26 19:57       ` Jake Donham
2010-07-26 20:02         ` Török Edwin
2010-07-27  6:55         ` Jérémie Dimino
2010-07-26  9:11   ` Sylvain Le Gall
2010-07-26 11:10     ` [Caml-list] " Dario Teixeira
2010-07-26 12:58       ` Sylvain Le Gall
2010-07-26 13:20         ` [Caml-list] " William Le Ferrand
2010-07-25 19:46 ` [Caml-list] " Richard Jones
2010-07-25 21:45   ` Dario Teixeira
2010-07-25 21:56     ` Joel Reymont
2010-07-25 22:03       ` Gabriel Kerneis
2010-07-25 22:24       ` Dario Teixeira
2010-07-26  7:34       ` Richard Jones
2010-07-26 11:20         ` Dario Teixeira
2010-07-26 16:50           ` Florent Monnier
2010-07-26 17:10             ` Sylvain Le Gall
2010-07-26 17:21               ` [Caml-list] " Gabriel Kerneis
2010-07-26 17:37                 ` Sylvain Le Gall
2010-07-25 22:44     ` [Caml-list] " Yoann Padioleau
2010-07-26  9:08       ` Sylvain Le Gall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100726111920.22882a95@deb0 \
    --to=edwintorok@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=darioteixeira@yahoo.com \
    --cc=jeremie@dimino.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox