[PATCH] Upstream: fix the cache duration calculation

Florent Le Coz florent.lecoz at smartjog.com
Thu Nov 14 15:33:55 UTC 2013


We have a "chain" of nginx servers, like this:
A (nginx) -> B (nginx) -> C (anything)

B being A’s upstream, and C being B’s upstream

We ran into an issue where the files were being cached for a too long 
duration.  For example if we want to cache our files in this chain for 
10 seconds, it could happen that the file actually exist for up to 30 
seconds, because when B retrieves the file from C, even if it’s almost 
expired on C, B will cache it for 10 seconds. Same thing if A retrieves 
the file cached by B.

To fix this issue, nginx needs to properly take into account the Age 
header provided by its upstream. This is what the attached patch does.

A subsequent patch will by provided soon, where the Age provided by 
nginx actually indicates the age of the file in nginx’s cache, instead 
of the age that was provided by its upstream.


Florent Le Coz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_cache_duration_calculation.patch
Type: text/x-patch
Size: 9081 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20131114/49338d15/attachment.bin>

More information about the nginx-devel mailing list