Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Proof memcache is faster than file system caching?

Is there any theory that says that a cache should be faster than a file system?

I think that since the file system also uses caching there is no scientific proof that we should move content from file system to a cache such as memcache when the concept of file system is somewhat loose -- like downloading a "file" could be the same as downloading a memcached object.

My concrete example is whether to host a template engine via memcache or file system. Does it matter?

like image 576
Niklas Rosencrantz Avatar asked Dec 17 '22 10:12

Niklas Rosencrantz


2 Answers

Your filesystem will probably be faster in many situations. E.g. when you need a cache for your "compiled templates", the filesystem will be faster.

And the filesystem caches (especially on linux) will make sure, that your cached templates - which are read often - are available in very short time. The kernel keeps them in an in-memory cache, and reads will be fast as hell.

memcached is a distributed key/value store. It has different use cases.

like image 64
Frunsi Avatar answered Jan 08 '23 14:01

Frunsi


Please read the memcached about page to understand why memcached exists. Your question doesn't make sense unless you have a magical clustered filesystem cache for your 100 front-end web servers.

like image 31
Dustin Avatar answered Jan 08 '23 15:01

Dustin