
Arkadiy Vertleyb wrote:
"Peter Dimov" <pdimov@mmltd.net> wrote
The "thread per connection" model _is_ inferior on all existing platforms. If asio doesn't encourage its use, I consider this a feature.
I am not sure what exactly the definition of "thread per connection" model is, but I assume this means a new thread is _created_ for every connection (?)
Right.
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.
That is usually referred to as 'Thread Pool', and it is usually considered the 'best' strategy among the multi-threaded ones, in particular due to its scalability. Regards, Stefan