Re: [boost] Asio multithreaded http server

berserker_r <berserker_r@hotmail.com> wrote:
Asio samples lacks a multithreaded server implementation: where can I find an example/tutorial about that?
There isn't one included yet in Boost.Asio, but you can have a look at these programs: http://asio.cvs.sourceforge.net/asio/asio/src/tests/performance/
I need to write a multithreaded http server: I'm running multiple calls to io_service::run from a pool of threads but it looks that if my session object takes a lot of time to generate the http response the server block any accept operation until the session has finished...
It's a bit hard to say what might be wrong without knowing some more details. Can you post a small bit of code or pseudocode showing how the session and acceptor work? Thanks. Cheers, Chris

http://asio.cvs.sourceforge.net/asio/asio/src/tests/performance/
I had a look at that sample, but I fall in the same problem... Btw let's take "server.cpp" as sample and suppose that "session::handle_read" takes a very long time to generate the response: how can I change the server code in order to be free to accept new connections in the meanwhile? Actually the server looks to be "locked" to accept new connections until the current session has finished its work even calling io_service::run from multiple threads. Thanks
participants (2)
-
berserker_r
-
Christopher Kohlhoff