Boost Users :
Subject: [Boost-users] [asio] io_service performance
From: Rusty Koonce (jrkoonce_at_[hidden])
Date: 2009-05-21 20:52:41
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.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net