Nginx + Gunicorn not handling 1000 concurrent users

flaskgunicornnginx

I'm running a site with 2 cores on the machine, and nginx(2 processes) and gunicorn(5 workers) serving a flask app. I did a stress test using locust.io to similulate 500 users, and the site breaks while scaling past 450 users. I feel like that is a small amount of users and I don't need to get another machine, and that I must be doing something wrong to break that early. Any ideas?

Best Answer

I guess the problem could be on the backend system, if any, more than the frontend (Nginx) stack.

How many concurrent sessions your DB can handle (if any).

One very common situation is that your request handlers enter a wait state with the backend system and starts queuing.

Have you checked the backend system?

450 uses is not a big number itself but it depends on what the 450 users are doing. Are we talking about keepalived sessions? Active users? Doing what?

Related Topic