I implemented a TCP server using boost.asio which currently uses a single io_service
object on which I call the run
method f
We have same long-running tasks in our server (a legacy protocol with storages). So our server is running 200 threads to avoid blocking service (yes, 200 threads is running io_service::run
). Its not too great thing, but works well for now.
The only problem we had is asio::strand
which uses so-called "implementations" which gets locked when hadler is currently called. Solved this via increase this strands butckets and "deattaching" task via io_service::post
without strand wrap.
Some tasks may run seconds or even minutes and this does work without issues at the moment.