2
votes

This is probably a fairly basic question. I'm learning about the basics of web app development and in this regard about concurrency and parallelism.

If I start my Flask web app with Gunicorn set to 1 worker:

gunicorn -w 1 server:app

Will this always mean that there's only one process running my app? Or is this not for certain and there are workers which might not only use threads, greenlets, ... but spawn an entire additional process of my app?

In case of the latter, does this apply to sync or gevent workers, too, or are those always one process?

1
you can verify your hypothesis by running top or htop to see how many processes are running your app but based on this limited example, yes, it will be one process - gold_cy

1 Answers

1
votes

This question has an answer in one of the posts on Gunicorn's issue tracker on GitHub:

Yes. However, you will see two processes running. One is the Gunicorn master process, which controls the worker processes. With the number of workers set to 1 you'll have only one worker process.

Source: https://github.com/benoitc/gunicorn/issues/2082#issuecomment-522343242