Multiple nginx instances share same proxy cache storage
mdounin at mdounin.ru
Tue Aug 5 00:49:04 UTC 2014
On Mon, Aug 04, 2014 at 07:42:20PM -0400, badtzhou wrote:
> I am thinking about setting up multiple nginx instances share single proxy
> cache storage using NAS, NFS or some kind of distributed file system. Cache
> key will be the same for all nginx instances.
> Will this theory work? What kind of problem will it cause(locking, cached
> corruption or missing metadata in the memory)?
As soon as a cache is loaded, nginx relies on it's memory data to
manage cache (keep it under the specified size, remove inactive
items and so on). As a result it won't be happy if you'll try to run
multiple nginx instances working with the same cache directory.
It can tolerate multiple instances working with the same cache for
a short period of time (e.g., during binary upgrade). But running
nginx this way intentionally is a bad idea.
Besides, using NFS (as well as other NASes) for nginx cache is a
bad idea due to blocking file operations.
More information about the nginx