caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mike Lin <mikelin@MIT.EDU>
To: John Max Skaller <skaller@ozemail.com.au>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocaml-3.05: a performance experience
Date: 06 Aug 2002 09:24:01 -0400	[thread overview]
Message-ID: <1028640242.11692.161.camel@mlin> (raw)
In-Reply-To: <3D4F40DA.5040006@ozemail.com.au>

> Blocking IO using OS resources is very slow -- O(log N) is good.
> User space dispatching is typically very fast: O(1) [using a hashtable]
> 
> So if you're parsing XML being read over the internet,
> the push technology is superior -- if you can bypass
> the high level socket interface (which is non-trivial :-(

I'm still not sure I understand this. Pull parsers can be structured so
that they don't require blocking I/O. That was the point of all the CPS
stuff in Yaxpo, and what you call "control inversion" (which I'm pretty
sure is also CPS) in Felix.

The controlling system can control the I/O however it wants, but the
interface to the parser still looks like pull.

Do you consider 'select' and 'read' part of the "high level socket
interface" that should be bypassed? (I just want to clarify because
OCaml has even higher level interfaces)

> 	Absolutely! That is why Felix exists. To allow one to
> write 'pull' code, which does blocking reads of data, but have the
> code translated to 'push' code, where a thread is resumed by a
> dispatcher when the data is available.
> 
> 	For some applications like telephony, where the number
> of connections is rather large, event driven code is the ONLY option.
> Unix OS are typically incapable of handling millions of threads, a user
> space dispatcher has no trouble at all, even on a small Linux PC.
> The reason is: client level code 'knows' the encoding of messages
> and can sort out where to send it much faster than any generic
> OS facilities can: OS schedulers are designed to run arbitrary
> mixtures of programs, not millions of threads of the same application.

It would be wise not to eschew the OS scheduler entirely. There are a
number of limitations to this type of purely event-driven model under
heavy load. In particular, it assumes that a "thread" never blocks, but
in fact it may block in many cases that are not under the control of
your scheduler - page faults, garbage collection, and so forth. In such
cases you can squeeze some extra processing time out of the system by
having several OS threads.

If you haven't already, you should have a look at Matt Welsh's work with
SEDA (http://www.cs.berkeley.edu/~mdw/proj/sandstorm/). I'm not sure if
it already does or not, but if it doesn't, it would be very interesting
to have a way to build custom event queue managers into Felix's
scheduler.

-Mike

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2002-08-06 13:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-02  3:33 Alexander V. Voinov
2002-08-03 12:33 ` Gerd Stolpmann
2002-08-03 17:27   ` [Caml-list] OCAMLRUNPARAM=b David Fox
2002-08-04  2:50   ` [Caml-list] ocaml-3.05: a performance experience Alexander V. Voinov
2002-08-04 20:45     ` Gerd Stolpmann
2002-08-05 15:18       ` John Max Skaller
2002-08-05 16:24         ` Mike Lin
2002-08-05 16:53           ` Alexander V.Voinov
2002-08-06  3:22           ` John Max Skaller
2002-08-06 13:24             ` Mike Lin [this message]
2002-08-06 11:10           ` Noel Welsh
2002-08-06 12:56             ` Andreas Rossberg
2002-08-04 18:06 Damien Doligez

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=1028640242.11692.161.camel@mlin \
    --to=mikelin@mit.edu \
    --cc=caml-list@inria.fr \
    --cc=skaller@ozemail.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).