<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Error handling of &amp;quot;Connection refused&amp;quot; conditions</title>
<description>I am using nginx to distribute http load across three upstream application servers. It actually works really well in normal usage, but when we restart one of the upstream servers for maintenance (such as for an OS update), nginx tends to hang incoming requests for some time (30 seconds or more). When a node is brought offline, the nginx error logs show a few messages like this:
upstream prematurely closed connection while reading response header from upstream
Followed by many messages like this (these last basically as long as the node is offline):
kevent() reported that connect() failed (61: Connection refused) while connecting to upstream
This seems ok to me, since the upstream server did go away. What should I expect to see of incoming http requests when this happens? Shouldn't nginx route requests to the remaining application servers, making the outage invisible to users? If it's expected to hang some requests when this happens, what timeout could be adjusted to minimize that duration?
Thanks,
- .Dustin
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx</description><link>http://forum.nginx.org/read.php?2,227729,227729#msg-227729</link><lastBuildDate>Tue, 21 May 2013 23:04:22 -0400</lastBuildDate>
<generator>Phorum 5.2.16</generator>
<item>
<guid>http://forum.nginx.org/read.php?2,227729,227737#msg-227737</guid>
<title>Re: Error handling of &quot;Connection refused&quot; conditions</title><link>http://forum.nginx.org/read.php?2,227729,227737#msg-227737</link><description><![CDATA[&gt; Is it considered good practice to reduce proxy_connect_timeout to some<br />&gt; small value if responsiveness during an outage is desired?<br /><br />It depends on the nature of the (backend) software and the network<br />infrastucture/latency - the closer the servers (network-wise) and the<br />higher throughput of the application the lower you can/should set it.<br /><br />There is also a general observation/standard or apdex (Application<br />Performance Index) that average web-user starts to become &quot;unsatisfied&quot; if<br />the request takes more than 1-2 seconds so using the default 60 seconds (in<br />case of some backend failure) to deliver the content makes no sense - the<br />user will sooner hit refresh / just close the browsers (go to another site)<br />or fall in panic than wait for anything to load.<br /><br /><br />On the other hand making nginx immideatly close and switch to another<br />backend isnt always the (best) solution - especially if the backends do some<br />long running computations and/or accept only limited number of connections.<br />This way quickly cycling through all backends won't serve a good response at<br />all what matters if you have an extra caching layer above (to fetch a valid<br />object (html/image etc)) or some sort of transactions (like payment systems)<br />which just take time and each request is important.<br /><br /><br />I usually set it to 2-3 seconds.<br />That way I can also indicate if the backends perform well enough and react<br />if a new bottleneck arises - the application code, underlaying<br />DBs/filesystems start to get too slow.<br /><br /><br />rr<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Reinis Rozitis</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 20 Jun 2012 17:00:00 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,227729,227736#msg-227736</guid>
<title>Re: Error handling of &quot;Connection refused&quot; conditions</title><link>http://forum.nginx.org/read.php?2,227729,227736#msg-227736</link><description><![CDATA[This is how an affected service is configured. We have our proxy_read_timeout set high, because some requests can legitimately take that long to return. Any other timeouts would be the default; presumably 60 seconds.<br /><br />upstream pool012 {<br />server 172.16.1.223:80;<br />server 172.16.1.224:80;<br />server 172.16.1.225:80;<br />server 172.16.1.226:80;<br />server 172.16.1.227:80;<br />}<br /><br />keepalive_timeout 65;<br /><br />server {<br />listen 172.16.6.103:80;<br />server_name application012.domain.com;<br /><br />error_log logs/application012.error.log ;<br /><br />location / {<br />proxy_pass http://pool012;<br />proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;<br />proxy_redirect off;<br />proxy_read_timeout 930s;<br />}<br />}<br /><br /><br />Is it considered good practice to reduce proxy_connect_timeout to some small value if responsiveness during an outage is desired?<br /><br />- .Dustin<br /><br />On Jun 20, 2012, at 2:04 PM, Reinis Rozitis wrote:<br /><br />&gt;&gt; I am using nginx to distribute http load across three upstream application servers. It actually works really well in normal usage, but when we restart one of the upstream servers for maintenance (such as for an OS update), nginx tends to hang incoming requests for some time (30 seconds or more). When a node is brought offline, the nginx error logs show a few messages like this:<br />&gt;<br />&gt;<br />&gt; You should probably post the relevant parts of your configuration since there are quite few parameters to tune nginx for a better responsiveness.<br />&gt;<br />&gt; To name a few: proxy_connect_timeout, proxy_read_timeout, proxy_send_timeout which by default are 60 seconds (what could explain your &quot;hanging&quot; requests), lowering those allows 'proxy_next_upstream' (by default - timeout and error) kick in sooner so the backend changes/restarts are seemless and don't really affect the end-users so much.<br />&gt;<br />&gt; rr<br />&gt; _______________________________________________<br />&gt; nginx mailing list<br />&gt; nginx@nginx.org<br />&gt; http://mailman.nginx.org/mailman/listinfo/nginx<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Dustin Wenz</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 20 Jun 2012 15:42:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,227729,227735#msg-227735</guid>
<title>Re: Error handling of &quot;Connection refused&quot; conditions</title><link>http://forum.nginx.org/read.php?2,227729,227735#msg-227735</link><description><![CDATA[&gt; I am using nginx to distribute http load across three upstream application<br />&gt; servers. It actually works really well in normal usage, but when we<br />&gt; restart one of the upstream servers for maintenance (such as for an OS<br />&gt; update), nginx tends to hang incoming requests for some time (30 seconds<br />&gt; or more). When a node is brought offline, the nginx error logs show a few<br />&gt; messages like this:<br /><br /><br />You should probably post the relevant parts of your configuration since<br />there are quite few parameters to tune nginx for a better responsiveness.<br /><br />To name a few: proxy_connect_timeout, proxy_read_timeout, proxy_send_timeout<br />which by default are 60 seconds (what could explain your &quot;hanging&quot;<br />requests), lowering those allows 'proxy_next_upstream' (by default - timeout<br />and error) kick in sooner so the backend changes/restarts are seemless and<br />don't really affect the end-users so much.<br /><br />rr<br /><br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Reinis Rozitis</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 20 Jun 2012 15:06:01 -0400</pubDate></item>
<item>
<guid>http://forum.nginx.org/read.php?2,227729,227729#msg-227729</guid>
<title>Error handling of &quot;Connection refused&quot; conditions</title><link>http://forum.nginx.org/read.php?2,227729,227729#msg-227729</link><description><![CDATA[I am using nginx to distribute http load across three upstream application servers. It actually works really well in normal usage, but when we restart one of the upstream servers for maintenance (such as for an OS update), nginx tends to hang incoming requests for some time (30 seconds or more). When a node is brought offline, the nginx error logs show a few messages like this:<br /><br />upstream prematurely closed connection while reading response header from upstream<br /><br />Followed by many messages like this (these last basically as long as the node is offline):<br /><br />kevent() reported that connect() failed (61: Connection refused) while connecting to upstream<br /><br />This seems ok to me, since the upstream server did go away. What should I expect to see of incoming http requests when this happens? Shouldn't nginx route requests to the remaining application servers, making the outage invisible to users? If it's expected to hang some requests when this happens, what timeout could be adjusted to minimize that duration?<br /><br />Thanks,<br /><br />- .Dustin<br />_______________________________________________<br />nginx mailing list<br />nginx@nginx.org<br />http://mailman.nginx.org/mailman/listinfo/nginx]]></description>
<dc:creator>Dustin Wenz</dc:creator>
<category>Nginx Mailing List - English</category><pubDate>Wed, 20 Jun 2012 13:28:00 -0400</pubDate></item>
</channel>
</rss>