[asio] io_service performance
First, I'm a noob to the mailing list -- you all need a "search" option on the archives... perhaps it's there, but I didn't see it. I gave up on my O(N) search after making it through the last 3 or 4 months of archives. :) My question is rather simple... Is it better to have a single io_service with multiple threads sharing it calling poll()/poll_one(), or have each thread own its own io_service and calling run()? I saw the HTTP example that did the latter -- each thread owned its own io_service and called run(). My worry there would be if one handler takes a long time to execute it essentially blocks all others behind it. But it seems a single io_service with multiple threads calling poll() or poll_one() would prevent one expensive handler from holding up processing of others behind it (but there could be much more contention on the handler queue). Without a better understanding of the underlying architecture, I'm not sure which way would yield the best performance as traffic scales up on the server. Thanks! -Rusty
On Fri, 22 May 2009 02:52:41 +0200, Rusty Koonce
[...]Is it better to have a single io_service with multiple threads sharing it calling poll()/poll_one(), or have each thread own its own io_service and calling run()?
See http://thread.gmane.org/gmane.comp.lib.boost.asio.user/1300 (no definite answers but various opinions :). Boris
participants (2)
-
Boris Schaeling
-
Rusty Koonce