Re: [asio-users] Performance aspects of boost::asio
Brought to you by:
chris_kohlhoff
From: <ste...@gm...> - 2008-09-26 13:53:21
|
On Thu, 2008-09-25 at 19:41 +0200, Alex Ott wrote: > Hello > > >>>>> "sdn" == stefan demharter@gmx net writes: > sdn> Hi, we've done some tests to check the performance of boost::asio > sdn> with synchronous operations and asynchronous operations. > > sdn> In synchronous mode one thread is responsible for one connection. > sdn> Our enviroment can handle a large number of threads per program. > sdn> Therefore this shouldn't be a problem at all. > > streambuf is pretty expensive - > http://alexott.blogspot.com/2007/11/some-tips-for-boostasio.html Streambuf was used both in sync and async version of the server, so this shouldn't be the cause of worse performance in async-mode. > Instead of one connection per thread it could be more useful to use several > acceptor threads in async mode + thread pool with worker threads. Or have > several dispatcher threads that will run many fully asynchronous connections > > Please see my small articles at http://xtalk.msk.su/~ott/en/cpp/BoostAsioProxy.html Regarding your "acceptor async mode + thread pool"-pattern: if I understand you correctly only accept() should be handled by reactor threads and further blocking socket-operations, blocking i/o and so on should be done within the worker threads. Thus you should get the benefits of an easier code flow and better performance than with fully async mode. But there is still a question left: When should fully async mode be used and when does it reach its full potential? Only in the case you want to handle many connections with only a handful threads and without blocking i/o? Regards Stefan |