Browse thread
async networking
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2006-02-08 (14:43) |
From: | Markus Mottl <markus.mottl@g...> |
Subject: | Re: [Caml-list] Re: async networking |
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