Search code examples
performancecachingfilesystemsmemcached

Which is faster/better for caching, File System or Memcached?


I don't think it's clear to me yet, is it faster to read things from a file or from memcached? Why?


Solution

  • Memcached is faster, but the memory is limited. HDD is huge, but I/O is slow compared to memory. You should put the hottest things to memcached, and all the others can go to cache files.
    (Or man up and invest some money into more memory like these guys :)

    For some benchmarks see: Cache Performance Comparison (File, Memcached, Query Cache, APC)

    In theory:

    Read 1 MB sequentially from memory       250,000 ns
    Disk seek                             10,000,000 ns
    

    http://www.cs.cornell.edu/projects/ladis2009/talks/dean-keynote-ladis2009.pdf