Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] When cache file is expired, nginx can make a lot of upstream requests.

Maxim Dounin
March 25, 2020 08:32PM
Hello!

On Wed, Mar 25, 2020 at 04:05:37PM +0900, Sangdeuk Kwon wrote:

> # HG changeset patch
> # User Sangdeuk Kwon <sangdeuk.kwon@quantil.com>
> # Date 1585118845 -32400
> # Wed Mar 25 15:47:25 2020 +0900
> # Node ID fe5988cefe615bb0f2a8936221c8464a6664916e
> # Parent 0cb942c1c1aa98118076e72e0b89940e85e6291c
> When cache file is expired, nginx can make a lot of upstream requests.
>
> In cache miss case, nginx makes only one upstream request
> if "proxy_cache_lock" is "on".
> When cache file is expired, nginx can make a lot of upstream requests
> even though "proxy_cache_lock" is "on".

That's expected behaviour. Citing the "proxy_cache_lock"
directive description in the documentation
(http://nginx.org/r/proxy_cache_lock):

: When enabled, only one request at a time will be allowed to
: populate a new cache element identified according to the
: proxy_cache_key directive by passing a request to a proxied
: server.

Note "a new cache element" part. To limit load on backends when
updating existing cache elements, "proxy_cache_use_stale updating"
can be used. See http://nginx.org/r/proxy_cache_use_stale for
details.

> If origin's content is changed, this simultaneous upstream requests
> can make "too long header" error log.

And this claim seems to be incorrect and, even if it is correct,
irrelevant to the expected behaviour described above.

Summing the above, it is completely unclear from the description
what your patch tries to do. And the code seems to be completely
wrong, too, but it's hard to tell without understanding what it
is expected to do in the first place.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] When cache file is expired, nginx can make a lot of upstream requests.

Sangdeuk Kwon 40 March 25, 2020 03:06AM

Re: [PATCH] When cache file is expired, nginx can make a lot of upstream requests.

Maxim Dounin 12 March 25, 2020 08:32PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 76
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready