I am running a compute-heavy Flask app behind gunicorn. Requests are handled by Nginx that passes them onto gunicorn and the Flask app:
gunicorn -access-logfile - wsgi --bind 127.0.0.1:5002 --workers 2 --threads 8
Each request takes about 1 second to process (CPU-heavy). If two requests arrive in close succession, I would like the second request to "wait", while the first is being processed. But instead it seems that both requests get slower as the CPU attempts to process both in parallel.
Is there a way to force the app to process incoming requests sequentially?
Thank you!