I do not use nginx but in general, this kind of problem comes when upstream
terminates the request before it has been handled correctly. I see that you
use worker-reload-mercy which will trigger such events if you reload while
a request is being processed and processing time >= 60s.

I hope this helps,
Mathieu

Le lun. 27 avr. 2020 à 15:18, Sandeep Balagopal <
sandeepbalagopa...@gmail.com> a écrit :

> I have a Django project configured with uwsgi and Nginx. The issue is that
> I am getting lot of 502 Bad gateway. The nginx error log says (104:
> Connection reset by peer) while reading response header from upstream.
> Looks like uwsgi is not able to give response for some of the requests.
> Below is my uwsgi configuration. Could the issue be due to the bad uwsgi
> configuration ? I have an ec2 t3.medium instance it has two vCPUs. These
> 502 gateways increase when the site load increases. Sometimes the processor
> is 100%, that is when the we get more of this error. I am thinking of
> upgrading the server to t3.xlarge which has 4 vCPUs. But how to make sure
> the issue is with the server performance ? Please check the uwsgi
> configuration and see if there is any issue with the configuration.
>
> [uwsgi]
>  master          = true
>  socket          = /tmp/uwsgi.sock
>  chmod-socket    = 666
>  chdir           = <dir_path>
>  wsgi-file       = <wsgi.py path>
>  processes       = 16
>  threads         = 8
>  cpu-affinity    = 1
>  max-worker-lifetime = 3600
>  max-requests = 1000
>  reload-on-rss = 2048
>  worker-reload-mercy = 60
>  virtualenv      = <ven_path>
>  vacuum          = true
>  enable-threads  = true
>  daemonize= <log_path>
>  stats= <stats_path>
>  buffer-size = 65535
>
> _______________________________________________
> uWSGI mailing list
> uWSGI@lists.unbit.it
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
>


-- 
Mathieu Lacage <mathieu.lac...@alcmeon.com>
_______________________________________________
uWSGI mailing list
uWSGI@lists.unbit.it
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to