<div dir="ltr"><br><div class="gmail_extra"><font size="1"><b><span style="color:rgb(102,102,102)"></span></b><span style="color:rgb(102,102,102)"></span></font>On Mon, Jul 27, 2015 at 9:10 AM, Bhuvan Gupta <span dir="ltr"><<a href="mailto:bhuvangu@gmail.com" target="_blank">bhuvangu@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Hello all,</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">I was reading <code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif;white-space:pre-wrap;background-color:rgb(238,238,238)">Nginx</code> <a href="http://nginx.org/en/docs/http/ngx_http_upstream_module.html?&_ga=1.189051176.2090890265.1437394769#sticky_cookie" rel="nofollow" style="margin:0px;padding:0px;border:0px;text-decoration:none;color:rgb(12,101,165)" target="_blank">documentation</a> on persistence session using cookie and below is from documentation</p><blockquote style="margin:0px 0px 10px;padding:10px;border-width:0px 0px 0px 2px;border-left-style:solid;border-left-color:rgb(255,235,142);font-size:15px;quotes:none;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px;background-color:rgb(255,249,227)"><p style="margin:0px;padding:0px;border:0px;clear:both"></p><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">​​</div>A request that comes from a client not yet bound to a particular server is passed to the server selected by the configured balancing method. Further requests with this cookie will be passed to the designated server. <b style="margin:0px;padding:0px;border:0px">If the designated server cannot process a request</b>, <b style="margin:0px;padding:0px;border:0px">the new server is selected as if the client has not been bound yet</b>.<p></p></blockquote><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">The last line says that</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px"><b style="margin:0px;padding:0px;border:0px">If the designated server cannot process a request</b>.</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">What does it mean to say "the server cannot process a request."</p><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Question 1:<br>Does it mean the server was down ?<br>or does it mean server responded with some error code ?<br>or does it mean that it did not responded in a certain time interval ?<br>or does it mean that max number of connection limit is reached on that server ?</p></div></blockquote><div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">​It seems pretty clear to me that it describes whatever reason a server could have of not being able to handle a request.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Your points #1 and #3 cannot be differenciated from a client point of view. Your point #4 makes the connection being refused (or times out? then it joins the 2 first points).​<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">In thoses cases, the load balancer will try to find some machine accepting the request.<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">Your point #2 is edgy: what kind of error? If it is a processing error, the request has been, by definition, processed, thus there is no need to contact another server.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">​I suspect 5xx codes might consider the upstream being unavailable, while 4xx means the request processing has occurred.​</div><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><p style="margin:0px 0px 1em;padding:0px;border:0px;font-size:15px;clear:both;font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;line-height:19.5px">Question 2:<br>Let say there were 3 backend-server and we are using session persistence using cookie.<br>Now assume that 2 of the backed server goes down so niginx will route all request to 3rd server<br>Now 2 other server came back online, will niginx use the other 2 server to route the request even if request have the persistence cookie for 3rd server.</p></div></blockquote><div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153)">​It is explicitely said​ '​A request that comes from a client not yet bound to a particular server [...]'. If the 3rd server has been selected because it responds correctly, the client will be bound to it, thus it won't change when the other 2 servers come back online.<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline">That represents the added value of having a server-side cookie. On a basic load-balancing setup (no way to 'tie' a client to a server), the load-balancing would have resumed connecting the client to the server it is supposed to connect to (either following the load-balancing key or simply selectin the 'next' upstream based on the configured method).<br></div><div class="gmail_default" style="font-size:small;color:rgb(51,51,153);display:inline"><font size="1"><span style="color:rgb(102,102,102)">---<br></span><b><span style="color:rgb(102,102,102)">B. R.</span></b></font>​</div></div></div></div></div>