mirror delay

Roman Arutyunyan arut at nginx.com
Thu Aug 30 14:28:01 UTC 2018


Hi,

On Thu, Aug 30, 2018 at 05:19:53PM +0300, Eylon Saadon wrote:
> hi,
> thanks for the quick response!
> I'm not using sendfile or tcp_nopush.
> just to make sure. I should disable the keepalive for the mirror location.
> and do it like so?

No, for the primary location.  This will help us understand the reason
why you have the delay.

> server {
> 
>   resolver 8.8.8.8;
> 
>   listen 80;
> 
>   location / {
>     proxy_set_header Host $host;
>     proxy_pass http://server:9000;
>   }
> 
>   location /mirror {
>     internal;
>     keepalive_timeout 0;
>     proxy_pass https://test_server$request_uri;
>   }
> }
> 
> 
> Thanks,
> 
>     eylon saadon
> 
> 
> On Thu, Aug 30, 2018 at 4:52 PM Roman Arutyunyan <arut at nginx.com> wrote:
> 
> > Hi,
> >
> > On Thu, Aug 30, 2018 at 04:34:29PM +0300, Eylon Saadon wrote:
> > > Hi,
> > > I'm using the mirror module in my "production" nginx in order to mirror
> > > real traffic to a test envrionment.
> > > I don't want this mirroring to affect the latency of the production
> > > environment, but it looks like the nginx is waiting for the response from
> > > the test environment.
> > > is there a way to avoid this? I just want the request to get to the test
> > > environment and let it process it. but it shouldn't wait fo r the
> > response
> > > from the test environment in order to respond to the request
> >
> > Usually a mirror subrequest does not affect the main request.  However
> > there
> > are two issues with mirroring:
> >
> > - the next request on the same connection will not be processed until all
> > mirror subrequests finish.  Try disabling keepalive and see if it helps.
> >
> > - if you use sendfile and tcp_nopush, it's possible that the response is
> > not
> > pushed properly because of a mirror subrequest, which may result in a
> > delay.
> > Turn off sendfile and see if it helps.
> >
> > --
> > Roman Arutyunyan
> > _______________________________________________
> > nginx mailing list
> > nginx at nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
> >
> 
> 
> -- 
> Thanks,
>       Eylon Saadon

> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx


-- 
Roman Arutyunyan


More information about the nginx mailing list