[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Number of threads



On Mon, 19 Mar 2001, Jean-Baptiste Vignaud wrote:

> I'm trying to bench my webmail written in a tux module.
>
> I'v noted that only 10 threads are launched by default; is there a way
> to increase this number, so that tux can accept more connections ? My
> bench machine is a 1CPU pentium3

it's not 10 threads really, but 1 'fast' worker thread and 8 'cachemiss'
worker threads. The cachemiss threads do not execute userspace code. So in
fact you can have only one userspace request pending at a time, unless you
are using POSTPONE_REQ and CONTINUE_REQ.

see the demo3.c module how POSTPONE_REQ and CONTINUE_REQ is used to hand
off requests to helper threads. TUX has no policy how userspace should
handle its workflow - you can do it from a single module by only using
TUX's primitives, or you can offload complex work to helper
threads/processes. (you can start helper threads from the TUXAPI_init()
function too, this way you have no fork() overhead, only context-switch
overhead.)

If you are using helper processes then you have to pass the request's file
descriptor from the fast thread into the helper process - this is either
done by per-request fork()-ing [this has high overhead], or by passing
file descriptors over unix domain sockets, via sendmsg() control messages.

If you are using pthreads helper threads then all files of the fast thread
are shared by your helper threads too - this is perhaps the easiest
solution on the short term.

	Ingo





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []