I am writing a server application using Boost Asio:
- Server: Running io_service.run() from pool of threads (one thread per core), accepting connections & reading data from sockets is done asynchronously.
- Client: Each client connects and sends a heavy file (~500MB) to the server.
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_servicecan only invokenhandlers if you haventhreads invokingio_service::run(). If the number of outstanding asynchronous operations is greater thann, their handlers will wait in theio_servicequeue until a thread is free to invoke them.