On 17 Oct 2014 at 10:54, Juan Carlos Franzoy wrote:
A long term dream of mine is for ASIO to become the standard event dispatch loop for all C++ programs, so other libraries simply hook into ASIO's dispatch and everything interoperates cleanly without lots of hassle and brittle boilerplate. I also feel a grievance against every single library firing up their own thread pools or worker threads when ASIO gives you that for free.
We tried to use ASIO as an event dispatch, but it failed to scale in multicore machines. Currently we are experimenting using one io_service per core and manually managing the load balance migrating sockets between io_services.
If this is on Linux, then yes I have found this too. ASIO uses std::mutex as its lock, and the spin count on pthread_mutex in glibc is too short for modern CPUs. My proposed concurrent_unordered_map, which can do safe concurrent erase, would solve the need for ASIO needing a central mutex on Linux.
Maybe ASIO has to manage only io (only io threads) and has to delegate to an external thread pool the execution of user handlers. Although I don't know if it is technically possible.
ASIO's present design is suboptimal in many regards. It's one of my biggest qualms in the present design being standardised as-is. I may, six months from now, be able to say in considerable detail what exactly to change if things pan out. Niall -- ned Productions Limited Consulting http://www.nedproductions.biz/ http://ie.linkedin.com/in/nialldouglas/