Boost logo

Boost :

From: Thore Karlsen (sid_at_[hidden])
Date: 2005-12-15 14:41:32


On Thu, 15 Dec 2005 14:31:51 -0500, Stefan Seefeld
<seefeld_at_[hidden]> wrote:

>>>>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.

>> So in that case you are handling one connection per thread, which does
>> not scale well.

>I'm sorry, but your conclusion seems wrong. If a dispatcher thread
>puts requests into a queue for worker threads to consume, it's most
>definitely *not* a thread-per-connection design, but a thread pool.
>
>It would be a thread-per-connection if threads were created
>as a result of new connection requests being put into the queue. But
>that he (apparently) isn't doing.

You seem to be reading this differently than I am. To me it looks like
he's saying that he has one thread that accepts connections, and then he
passes the socket to a worker thread where he does all the synchronous
reading and writing to service the client.

He may have the threads already standing by when he accepts new
connections, but since he's doing synchronous I/O he can't service more
than one connection at a time from a thread. Thus the number of
connections he can handle is limited by the number of threads he has,
which is why there's a scalability problem.

-- 
Be seeing you.

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