I am trying out Quart with Hypercorn in Python 3.8. From what I understand, Quart is typically used for single threaded applications. But I see that Hypercorn has a --workers
option to run the app.
workers w, --workers The number of workers to spawn and use.
How can a single threaded app benefit from using multiple workers?
Advertisement
Answer
Each worker is a separate process which means that there are multiple Quart copies running when the worker option is used. This allows the connections to be distributed over the multiple processes, and hence gives more performance. Note that this trades off the ability to share data in memory, as each Quart copy is now independent.