<div dir="ltr">HI,<div><span style="background-color:rgb(255,255,255)"><font color="#000000">when adding </font></span></div><div><span style="background-color:rgb(255,255,255)"><font color="#000000"><span style="font-family:Menlo;font-size:9pt">keepalive_timeout 0;</span></font></span></div><div><font color="#000000" face="arial, helvetica, sans-serif">to the main location it works fine.</font></div><div><font color="#000000" face="arial, helvetica, sans-serif">even if the mirrored location doesn't respond immediately the latency doesn't go up.</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">is this the solution for the issue or just a way to understand the issue?</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div><font color="#000000" face="arial, helvetica, sans-serif">Thanks,</font></div><div><font color="#000000" face="arial, helvetica, sans-serif"> Eylon Saadon</font></div></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 30, 2018 at 5:28 PM Roman Arutyunyan <<a href="mailto:arut@nginx.com">arut@nginx.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
On Thu, Aug 30, 2018 at 05:19:53PM +0300, Eylon Saadon wrote:<br>
> hi,<br>
> thanks for the quick response!<br>
> I'm not using sendfile or tcp_nopush.<br>
> just to make sure. I should disable the keepalive for the mirror location.<br>
> and do it like so?<br>
<br>
No, for the primary location. This will help us understand the reason<br>
why you have the delay.<br>
<br>
> server {<br>
> <br>
> resolver 8.8.8.8;<br>
> <br>
> listen 80;<br>
> <br>
> location / {<br>
> proxy_set_header Host $host;<br>
> proxy_pass <a href="http://server:9000" rel="noreferrer" target="_blank">http://server:9000</a>;<br>
> }<br>
> <br>
> location /mirror {<br>
> internal;<br>
> keepalive_timeout 0;<br>
> proxy_pass <a href="https://test_server" rel="noreferrer" target="_blank">https://test_server</a>$request_uri;<br>
> }<br>
> }<br>
> <br>
> <br>
> Thanks,<br>
> <br>
> eylon saadon<br>
> <br>
> <br>
> On Thu, Aug 30, 2018 at 4:52 PM Roman Arutyunyan <<a href="mailto:arut@nginx.com" target="_blank">arut@nginx.com</a>> wrote:<br>
> <br>
> > Hi,<br>
> ><br>
> > On Thu, Aug 30, 2018 at 04:34:29PM +0300, Eylon Saadon wrote:<br>
> > > Hi,<br>
> > > I'm using the mirror module in my "production" nginx in order to mirror<br>
> > > real traffic to a test envrionment.<br>
> > > I don't want this mirroring to affect the latency of the production<br>
> > > environment, but it looks like the nginx is waiting for the response from<br>
> > > the test environment.<br>
> > > is there a way to avoid this? I just want the request to get to the test<br>
> > > environment and let it process it. but it shouldn't wait fo r the<br>
> > response<br>
> > > from the test environment in order to respond to the request<br>
> ><br>
> > Usually a mirror subrequest does not affect the main request. However<br>
> > there<br>
> > are two issues with mirroring:<br>
> ><br>
> > - the next request on the same connection will not be processed until all<br>
> > mirror subrequests finish. Try disabling keepalive and see if it helps.<br>
> ><br>
> > - if you use sendfile and tcp_nopush, it's possible that the response is<br>
> > not<br>
> > pushed properly because of a mirror subrequest, which may result in a<br>
> > delay.<br>
> > Turn off sendfile and see if it helps.<br>
> ><br>
> > --<br>
> > Roman Arutyunyan<br>
> > _______________________________________________<br>
> > nginx mailing list<br>
> > <a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
> > <a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
> ><br>
> <br>
> <br>
> -- <br>
> Thanks,<br>
> Eylon Saadon<br>
<br>
> _______________________________________________<br>
> nginx mailing list<br>
> <a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
> <a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
<br>
<br>
-- <br>
Roman Arutyunyan<br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Thanks,<div> Eylon Saadon</div></div></div>