mirror delay

Roman Arutyunyan arut at nginx.com
Thu Aug 30 13:52:27 UTC 2018


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

More information about the nginx mailing list