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

后端 未结 7 1237
花落未央
花落未央 2021-02-01 16:54

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

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-01 17:19

    In fact, it is not as simple as that reading from memory is much faster than reading from HDD. As you known, Memcached is based on tcp connection, if you make connection each time you want to get sth or set sth to memcached server(that is most of programmers do), it proberly performs poorly than using file cache. You should use static Memcached object, and reuse the object. Secondly, the modern OS's will cached files that are frequently used, that makes file caches might be faster than memcaches which are actualy TCP connections.

提交回复
热议问题