Hi Maxim,
The nginx reverse proxy and uWSGI runs on the same host. Each nginx reverse proxies are connected to only one single Instance of the uWSGI backend.
But in the uWSGI backend, I'm running 4 workers in total based on the configuration 2 workers can be handled by 1 VCPU. Essentially the Instance I run has 2 VCPUs hence It translates to 4 workers. The listen queue length of my backend is sufficiently high i.e. 4096 and I have set my somaxconn parameter to 32768. So I think everything with respect to the backend seems fine.
Only when I disable logging in nginx I could see this Issue happen. Once I enable it, my hosts never raised Timeout error at all. Also, note that this Issue happens more often when the server is in an Idle state and not when the server is in peak.
--
Om