service handles only one socket per core
I am writing a server application using Boost Asio:
Issue: All Clients are connected to the server (number of clients > number of server cores); io_service handles only one connection/socket per thread while data from other sockets are not processed until one of the processed connections completes.
I would expect that data from all connected sockets gets processed by the io_service thread pool at a same time?
What is the expected behavior? Your io_service
can only invoke n
handlers if you have n
threads invoking io_service::run()
. If the number of outstanding asynchronous operations is greater than n
, their handlers will wait in the io_service
queue until a thread is free to invoke them.
下一篇: 服务每个核心只处理一个套接字