ipkn/crow

Multi process

rj314 opened this issue · 1 comments

rj314 commented

I know Crow server supports multi-threading. However, the legacy code base that I would like to use Crow with is not thread-safe.
Given that, I am wondering how difficult it is to add multi-process capability to Crow (instead of creating a new thread for each incoming request, fork a new process).

Hello @rj314.
I'll start off by mentioning that this repository has been abandoned for about 4 years now, I suggest you use this repository instead.

With that being said. Crow does not create a new thread per request. it starts with an acceptor thread and a number of worker threads. each worker thread is then assigned a number of incoming connections by the acceptor thread in a round-robin way. Each thread has its own asio::io_context which is used to manage the connections assigned to it.
I'm not sure how you can transform this to multiple processes, but most (if not all) of your changes would be inside the crow::server class.