caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus.mottl@gmail.com>
To: rick@eltopia.com
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Re: async networking
Date: Wed, 8 Feb 2006 09:43:35 -0500	[thread overview]
Message-ID: <f8560b80602080643u6f6160bei9c5e2044d71a1d7@mail.gmail.com> (raw)
In-Reply-To: <1139372282.10092.10.camel@localhost.localdomain>

On 2/7/06, Rick Richardson <rick@eltopia.com> wrote:
> I technically don't need to officially reschedule.. since they will all
> be doing the same thing, I'll sleep the thread, then when data becomes
> available pass it the new fd and wake it up. A simple queue would be
> fine for that.

You had mentioned that you mostly care about performance in an
environment with low data volume and a high number of transactions
(connections).  Passing off data between threads requires a
context-switch, which is going to kill your performance if you have to
do that very often (as is the case here).

It would be better to attempt "straight-through processing" (STP): let
the thread that initially received the data execute the job, and only
if this would take too long (e.g. because it might block) should you
consider passing off the work to a helper thread.  In that case it
would be advisable to use two queues if you want to reduce the number
of locks required to access new jobs.  By using STP you can quite
likely improve performance by an order of magnitude for your kind of
problem.

We have implemented a library for STP and are probably going to
release it to the general public within the next couple of weeks
anyway, but the hints above might still be useful to you if you want
to implement a solution yourself (good exercise! ;).

Regards,
Markus

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


  reply	other threads:[~2006-02-08 14:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-05  8:52 Rick Richardson
2006-02-05 17:32 ` [Caml-list] " Gerd Stolpmann
2006-02-06 18:34   ` Bardur Arantsson
2006-02-07  4:55     ` [Caml-list] " skaller
2006-02-07 17:44       ` Bardur Arantsson
2006-02-07 18:44         ` [Caml-list] " Rick Richardson
2006-02-07 19:01         ` Gerd Stolpmann
2006-02-07 19:43           ` Bardur Arantsson
2006-02-07 20:30             ` [Caml-list] " Gerd Stolpmann
2006-02-07 20:51             ` Remi Vanicat
2006-02-07 21:29         ` Rick Richardson
2006-02-07 22:03           ` Jonathan Roewen
2006-02-08  4:18             ` Rick Richardson
2006-02-08 14:43               ` Markus Mottl [this message]
2006-02-08  4:29           ` skaller
2006-02-05 20:18 ` [Caml-list] " Pierre Etchemaïté

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=f8560b80602080643u6f6160bei9c5e2044d71a1d7@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=rick@eltopia.com \
    /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).