<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello</div><br><div><div>Le 4 juin 2010 à 16:30, Almir Karic a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">The same "problem" that you are describing can be solved with say<br><a href="http://wiki.nginx.org/NginxHttpProxyModule#proxy_next_upstream">http://wiki.nginx.org/NginxHttpProxyModule#proxy_next_upstream</a><span class="Apple-converted-space">&nbsp;</span>while<br>keeping one upstream block.</span></blockquote><br></div><div>In my case if I setup a single upstream like this for instance :</div><div><div><br></div></div><div>upstream guinicorn {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>server 192.168.0.171 max_fails=1 fail_timeout=10s;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>server 192.168.0.172 max_fails=1 fail_timeout=10s;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>server 192.168.0.173 max_fails=1 fail_timeout=10s;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>server 192.168.0.174 max_fails=1 fail_timeout=10s;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>server 192.168.0.175 max_fails=1 fail_timeout=10s;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>server 127.0.0.1 backup;</div><div>}</div><div><br></div><div>and then I use it for multiple app</div><div><br></div><div>------------------------------------</div><div>server {</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>location / {</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>proxy_pass <a href="http://gunicorn:3000">http://gunicorn:3000</a>;</div><div><span class="Apple-tab-span" style="white-space:pre">                proxy_next_upstream error timeout invalid_header http_500 http_502 http_504;</span></div><div><span class="Apple-tab-span" style="white-space:pre"></span><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div>}</div><div><br></div><div><div>server {</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>location / {</div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span>proxy_pass <a href="http://gunicorn:3001">http://gunicorn:3001</a>;</div><div><span class="Apple-tab-span" style="white-space: pre; ">                proxy_next_upstream error timeout invalid_header http_500 http_502 http_504;</span></div><div><span class="Apple-tab-span" style="white-space: pre; "></span><span class="Apple-tab-span" style="white-space: pre; ">        </span>}</div><div>}</div><div><br></div><div><div>server {</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span>location / {</div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span>proxy_pass <a href="http://gunicorn:3002">http://gunicorn:3002</a>;</div><div><span class="Apple-tab-span" style="white-space: pre; ">                proxy_next_upstream error timeout invalid_header http_500 http_502 http_504;</span></div><div><span class="Apple-tab-span" style="white-space: pre; "></span><span class="Apple-tab-span" style="white-space: pre; ">        </span>}</div><div>}</div><div><div>------------------------------------</div><div><br></div><div>if one of this app fails badly in five request all the upstream servers are set inoperative.</div><div>The behavior I noticed (few years ago, may be this has changed) is that all the app&nbsp;</div><div>using this upstream will be using the backup server. So if one app fails, the other fails to.</div><div><br></div><div>May be this behavior has changed, but now I create an upstream for each app and I never had the problem again.</div><div><br></div><div><br></div><div>xav</div><div><br></div></div></div></div><br></body></html>