On Sun, Dec 15, 2013 at 05:01:25AM -0500, Larry wrote:
I don’t quite understand what I could get from caching with proxy_cache vs
serving static files directly.
Everywhere people tend to say that it is better to cache, but isn’t caching
the same as serving directly from static file ?
Say that I serve home.html from a plain static html file, would I get any
benefit to use reverse proxy + cache to serve it ?
Caching is useful when you have some resource which is costly to
generate (e.g., dynamic pages or remote resources). If you are
serving static files which are already present on the same server,
in most cases there are no reasons to use cache. In some rare
cases it may be useful though, e.g., if you have some faster
storage for cache.
Proxy cache is for storing the response of an upstream HTTP server
whose requests you’re proxying, so that you don’t have to ask the
potentially slow(er) upstream server the next time an identical
request comes in.
Serving static files from local disk is, well, for on-disk local assets.
They’re different concepts. Don’t confuse them. Just recognise
whichever one you’re doing, and use the appropriate technique.
On Thu, Dec 19, 2013 at 09:48:45AM -0500, Larry wrote:
Now I get it right
@Maxim : when you say faster memory storage, doesn’t nginx get the result
cached by the os itself ? And so in the ram ?
What could be faster than that ?
Consider you have 100T of data on rotating disks, 32G of memory,
and 256G of SSD available. In such a case, using SSD for a cache
may be beneficial - not because something is faster than RAM, but
because you don’t have enough RAM to cache everything.