Boost logo

Boost :

From: Bardur Arantsson (spam_at_[hidden])
Date: 2005-12-15 14:29:12


Arkadiy Vertleyb wrote:
> "Thore Karlsen" <sid_at_[hidden]> wrote
>
>
>>>What I did was to have the main thread accept incomming requests, and put
>>>them in the queue, whereas a number of worker threads was taking these
>>>requests from the queue, and execute them. I don't see how this model
>
> can
>
>>>be absolutely inferior in all possible contexts.
>>
>>How are you reading and writing from multiple sockets simultaneously in
>>your main thread?
>
>
> I was not. I was reading/writig from the worker threads. The main thread
> was used only to accept connections.
>

Thus limiting your #simultaneous connections to the number of threads in
your thread pool. You can do better by doing all the parsing, request
splitting, etc. in a async-using main acceptor thread and handing off
smaller bits of work to the threads in the pool. That way you can
exploit the fact that some threads may finish some parts of a given
request early, and may be available to serve other connections.

-- 
Bardur Arantsson
<bardurREMOVE_at_[hidden]>
<bardurREMOVE_at_[hidden]>
- Peg, we've been married for 17 years now, can't we just be
friends?
                                  Al Bundy / Married With Children

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk