I have a very basic question. It seems like I don't get it, or I simply need a confirmation.
Let's say I set up a flask app and let it run using gunicorn
.
I use --wokers=2
and --threads=2
, so I can serve 4
requests on parallel.
Now let's say a client does 4 parallel requests, which will do a requests.get
in the flask app, which needs 5 seconds to get a response (in theory). I fifth client call will need to wait for one of the 4 others to be finshed, before it's even started in the backend (and will take another 5 seconds for execution).
Now my question: When I switch to --worker-class gevent
, will it help getting more parallel requests without adaping the code? If I understand it correctly, I need to properly use async library calls to get advantage of gevent, and to get a maximum parallel request execution of 1000 for example, right? Am I right by saying: If the code continues to simply do requests.get
(or a sleep or whatever) without using async client libs, it the fifth request will still be blocked?
Thank you! (I've never worked with asnycio and coroutines, so I'm sorry)