[PATCH] When cache file is expired, nginx can make a lot of upstream requests.
Maxim Dounin
mdounin at mdounin.ru
Wed Apr 1 15:20:04 UTC 2020
Hello!
On Tue, Mar 31, 2020 at 01:59:31PM +0900, Sangdeuk Kwon wrote:
> Thank you for your explanation
>
> I have a question.
> Are there any directives for preventing multiple upstream and serving new
> content?
>
> expect case:
> 1st request: get new content from origin and serve new content.
> 2nd request: serve new content.
> 3rd request: serve new content.
>
> "proxy_cache_use stale updating" and "proxy_cache_background_update off"
> case:
> 1st request: get new content from origin and serve new content.
> 2nd request: serve stale content.
> finish 1st request's upstream.
> 3rd request: serve new content.
>
> "proxy_cache_use stale updating" and "proxy_cache_background_update on"
> case:
> 1st request: serve stale content and make subrequest for getting new
> content.
> 2nd request: serve stale content.
> finish 1st request's subrequest.
> 3rd request: serve new content.
As of now the answer is "no", you cannot configure nginx to
avoid multiple upstream requests when updating cache items and
avoid serving stale responses at the same time.
There were some attempts in the past to expand proxy_cache_lock to
updating cache items though. If you are interested, you may want
to check this patch:
http://mailman.nginx.org/pipermail/nginx-devel/2018-December/011710.html
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list