Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi process #400

Open
rj314 opened this issue Nov 24, 2021 · 1 comment
Open

Multi process #400

rj314 opened this issue Nov 24, 2021 · 1 comment

Comments

@rj314
Copy link

rj314 commented Nov 24, 2021

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).

@The-EDev
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants