Prevent cache from storing files multiple times in the proxy_temp dir
nginx-forum at nginx.us
Sat Oct 18 10:43:37 UTC 2014
Our nginx reverse proxy creates a temporary entry in the proxy_temp
directory if that file does not yet exists in the cache. So far so good but
if the file does not exists and the file will be requested 10 times at the
same time it creates 10 temporary files in the proxy_temp and fetches the
data 10 times from the proxied server. The result is high write IO and high
bandwidth for a single file.
I already tested "proxy_cache_lock on" and played with the directive
"proxy_cache_lock_timeout" which addresses the issue. The disadvantage is
that 1 connection will get the data but 9 are delayed because of the lock.
The optimal solution would be if all the 10 hypothetic connections will be
served from the same temporary cache file out of the proxy_temp.
Is there a good/better approach to solve this scenario?
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,254124,254124#msg-254124
More information about the nginx