Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx proxy hangs in a while when idle

We are using nginx proxy_pass feature for bridging RESTful calls to a backend app, and use nginx web socket proxy for the same system at eh same time. Sometimes (guess when the system has no client request for a while) the nginx freezes any request till we restart it and then anything works well. What is the problem? DO I have to change keep-alive settings? I have turned off buffer and cache feature for proxy in nginx.conf.

like image 619
Kamyar Avatar asked Jul 09 '15 07:07

Kamyar


1 Answers

I found the problem. By checking nginx error log and a bit a hackery sniff and guess, I found out that the web socket connections usually disconnect and reconnect (mobile devices) and the nginx peer tries to keep the connection alive, and then maximum connection limit reaches. I just decreased timeouts and increased max connections.

like image 92
Kamyar Avatar answered Oct 16 '22 17:10

Kamyar