Nginx Caching strategy
malayter at gmail.com
Thu Oct 14 05:50:11 MSD 2010
On Wed, Oct 13, 2010 at 9:17 AM, cachenewbie <nginx-forum at nginx.us> wrote:
> I think storing responses directly in disk makes it easy to store and
> retrieve from different process contexts. However, if the storage space
> is huge (in TB) and if the disk storage media is SSD, write avoidance is
> something that should be considered. In this case, small files can be
> stored in memory cache to speed up access to frequent webcontent and
> cachemanager can try to store big blocks to disks when evicting content
> from memory cache. Having memory cache and disk cache separated will
> make more sense in such a case. I was trying to figure out if Nginx
> supported that concept.
This is something the OS and filesystem layers can and should handle.
Coding such behavior into the application layer is a bad idea for
innumerable reasons (not the least of which is potability of the
application). Good SSD controllers also do memory caching, block
remapping, wear-leveling, and small-write coalescing internally,
allowing them to be used with traditional filesystems.
In short: buy good SSDs (a recent Intel or Sandforce-based drive is
good) and don't worry about it.
Do you have any real-world data that shows that small file writes in a
proxy caching scenario is a actually problem worth worrying about? As
Knuth once said, "premature optimization is the root of all evil."
More information about the nginx