[PATCH] When cache file is expired, nginx can make a lot of upstream requests.
Maxim Dounin
mdounin at mdounin.ru
Thu Mar 26 00:30:55 UTC 2020
Hello!
On Wed, Mar 25, 2020 at 04:05:37PM +0900, Sangdeuk Kwon wrote:
> # HG changeset patch
> # User Sangdeuk Kwon <sangdeuk.kwon at 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/
More information about the nginx-devel
mailing list