proxy_connect_timeout maximum

Maxim Dounin mdounin at
Sun Aug 31 01:30:59 UTC 2014


On Fri, Aug 29, 2014 at 02:07:05PM -0400, lspasam wrote:

> Hello,
> I am receiving "upstream timed out (110: Connection timed out) while
> connecting to upstream, client" errors. They are comet calls and I wonder if
> increasing the proxy_connect_timeout will help.   i have increased

Unlikely.  The default is 60 seconds, and it's enough for TCP 
3-way handshake even in case of very distant servers.  If a 
handshake can't complete within 60 seconds, it means that there is 
something wrong with your backend server - e.g. the server is 
overloaded and can't accept new connections.

> proxy_send_timeout and proxy_read_timeout to 6000 and have turned off
> proxy_buffering.  The docs say that the proxy_connect_timeout cannot
> "usually" exceed 75s.  All my searches regarding nginx and comet return
> config files that have proxy_connect_timeout values exceeding 75s.  Is there
> a max value for this?

Maximum value for proxy_connect_timeout is determined by OS 
settings.  Under traditional BSD it's 75s, and on FreeBSD it can 
be changed using the net.inet.tcp.keepinit sysctl.  On modern 
Linuxes the default seems to be 20s, and should be possible to 
change it by setting retry count in net.ipv4.tcp_syn_retries.

As previously noted though, it's highly unlikely that changing this 
will help.  You should look into what happens with your backend 

Maxim Dounin

More information about the nginx mailing list