How many instances of the Gunicorn application creates

I am new to this and don't understand how Gunicorn + Flask works.

When I run Gunicorn with 4 workers, does it create 4 instances of my Flask application or creates 4 processes that process web requests from Nginx and one instance of the Flask application?

If I make a simple implementation of a memory cache (like a dictionary) in my application, will gunicorn create more than one application instance and therefore more than one cache instance?

+4
source share
1 answer

This will create 4 arrow workers to deal with one flash application. If you run 4 instances of a flash application (for example, with a docker), you will need to start shooting 4 times. Then, to handle all of these flags, you will need the Nginx server in front of it, acting as a load balancer.

For example, if one user performs a registration procedure, which takes a lot of time due to several database queries, you still have another worker to send the request to the flask instance.

, Flask WSGI , stardard. Gunicorn , , Werkzeug Develpment, . , Gunicorn - . Flask .

+5

Source: https://habr.com/ru/post/1624934/


All Articles