[PATCH] Cache: provide naive feedback loop for uncacheable URLs
Maxim Dounin
mdounin at mdounin.ru
Tue Apr 28 19:23:28 UTC 2015
Hello!
On Mon, Apr 27, 2015 at 04:38:47PM -0700, Piotr Sikora wrote:
> # HG changeset patch
> # User Piotr Sikora <piotr at cloudflare.com>
> # Date 1430177825 25200
> # Mon Apr 27 16:37:05 2015 -0700
> # Node ID 1e7878138228e3decb868f38eddc38937d55f403
> # Parent 96e22e4f1b03ff15a774c6ed34d74b897af32c55
> Cache: provide naive feedback loop for uncacheable URLs.
>
> The cache lock provides a mechanism that allows only one request
> for the same URL to be sent upstream at the same time. All other
> requests must wait until the lock is released and/or not needed.
>
> While this works as designed and protects upstream from requests
> stampede in case the response is cacheable, it results in a huge
> performance degradation for popular and uncacheable URLs, thanks
> to the artificial delay added to the upstream requests.
>
> To make things even worse, the lock acquisition is retried every
> 500ms and prone to lock starvation - there is no queue, so newly
> accepted requests can jump ahead and acquire the lock before any
> of the already pending requests have a chance to retry it, which
> can lead to huge spikes in the response times and even timeouts.
>
> This feedback loop provides a mechanism that allows requests for
> uncacheable URLs to immediately skip the cache lock.
I'm not really sure this is a right change. In particular, because
"uncacheable" is a property of a response, not URLs.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list