If I launch my Flask application through Gunicorn and set up several workflows - does one of the Flask applications run on each of the threads?

I wrote a bot telegram and it has a primitive cache in the form of a dictionary. The bot is integrated into the Flask application via webhuk My main question is the following - will every new thread created by Gunicorn create a new bot instance with its own cache?

Tell me if I think correctly and throw articles on the topic if there is.

    1 answer 1

    Gunicorn uses parallelization, but in the same thread (korutiny and all that). http://words.volant.is/articles/understanding-gunicorns-async-worker-concurrency-model/ Related article.

    This way, you can use a regular cache dictionary if you run the application under Gunicorn.

    • gunicorn can use multiple threads as well as multiple processes. Green threads are not the only way to simultaneously handle multiple requests in gunicorn and moreover it is not the default method. - jfs
    • @jfs write your answer - we will debate. - Deadkenny