<p>As with most performance related questions, the answer is "it depends". :)</p>

<p>Apps like Redis and Memcache store their key => value stores in memory as opposed to disk-based file caching.</p>

<p>Accessing data from memory is usually orders of magnitude faster than accessing data from disk.</p>

<p>All of these fall under "<a href="https://craftcms.stackexchange.com/a/13383/57">General purpose data caching</a>" and Craft will use them internally for its own operations and plugins can certainly make use of them as well.</p>

<p>If you have a plugin that makes extensive use of data caching and/or you've got a heavily trafficked site, then you will likely see some tangible performance benefits.</p>

<p>If you're just doing a basic stock Craft install on a low trafficked site, then you likely won't see much of a difference at all.</p>

CC BY-SA 3.0
2016-05-10T20:34:23.590Z
2016-05-10T20:34:23.590Z
2017-04-13T12:50:59.930Z
Brad Bell
<p>How many servers do you have? </p>

<p>Redis and Memcached are most beneficial/intended for a multiple server setup so if you only have one server, there's probably other/betters thing to worry about. (Best speed increase I've found so far: PHP 7.)</p>

<p>As Brad points out, it all depends on your content, traffic, concurrent users, etc. </p>

<p>It goes without saying having enough ram so you're not swapping can have a huge benefit. Just because those files are stored on disk doesn't mean PHP itself is actually hitting the disk for each request.</p>

<p>SSDs are also now coming standard with a lot of the better hosting plans. SSDs can rival in-memory access times. Just changing your hosting can have a big impact on your app's performance.</p>

<p>If you go down the deamon route, Redis seems more modern and is the newest contender in this space.  I haven't extensively used Redis or memached with Craft but I have a client with WP on a dedicated server. We tried memcached awhile back and it was actually slower than without it. It's not hard to see why: there's going to be overhead reading/writing to either daemon—after all they communicate via socket or TCP/IP—and whether that solves your particular performance problem is up for debate.</p>

<p>memcached hasn't really evolved much as of late. While memcached is strictly a key/value store, Redis is intended to store object structures better. </p>

<p><code>tmpfs</code> could be an alternative as well. It's basically a ram disk and is built into most Linux distros. It's pretty easy to setup and like everything else it has some caveats (making sure it comes back up on reboot, having enough space so you don't swap to begin with, clearing etc).</p>

<p>Some further reading:</p>

<ul>
<li><a href="https://stackoverflow.com/questions/2393783/php-tmpfs-vs-memcached">temps vs memcached</a></li>
<li><a href="https://stackoverflow.com/a/11257333">memcached vs redis</a></li>
</ul>

CC BY-SA 3.0
2016-05-16T19:10:05.680Z
Right - if we go with Redis, it'll be on its own VPS.
Tim Kelty
CC BY-SA 3.0
2016-05-11T14:52:56.357Z
2016-05-11T14:52:56.357Z
2017-05-23T12:38:53.957Z
RitterKnight
<p>Here you can find an interesting benchmarking between Redis (remote or local) and Python Disk caching. The answer from Didier Spezia is good enough to understand the results.
<a href="https://stackoverflow.com/a/12871072/8520235">https://stackoverflow.com/a/12871072/8520235</a></p>
<p>Enough RAM and disk caching are always better solutions for reasonable amounts of data.
Any local, not to say remote, Redis solution includes network roundtrips, that these days are slower than Linux disk caching or even SSD disk access.</p>

CC BY-SA 4.0
2021-04-03T07:00:02.997Z
2021-04-03T07:00:02.997Z
coterobarros
<p>Redis and Memcache are both Key value pair storage, their key =&gt; value stores in memory as opposed to disk-based file caching that make is faster to access compare with accessing data from disk</p>
<p>Few Interesting properties of Redis:</p>
<blockquote>
<ol>
<li><p>Redis can be accessed by all the processes of your applications, possibly running on several nodes (something local memory cannot achieve).</p>
</li>
<li><p>Redis memory storage is quite efficient, and done in a separate process. If the application runs on a platform whose memory is garbage collected (node.js, java, etc ...), it allows handling a much bigger memory cache/store. In practice, very large heaps do not perform well with garbage collected languages.</p>
</li>
<li><p>Redis can persist the data on disk if needed.</p>
</li>
<li><p>Redis is a bit more than a simple cache: it provides various data structures, various item eviction policies, blocking queues, pub/sub, atomicity, Lua scripting, etc ...</p>
</li>
<li><p>Redis can replicate its activity with a master/slave mechanism in order to implement high-availability.</p>
</li>
</ol>
</blockquote>

CC BY-SA 4.0
2018-08-18T07:53:38.347Z
2018-08-18T17:53:46.783Z
2020-06-17T08:56:27.903Z
Amitesh Bharti
<p>I'm wondering what kind of performance increase, and in what situations, I might expect from using Redis or Memcache over the default file-based caching.</p>

<p>I know template caching always comes from the DB, so I'm not sure what else I can expect to be cached from Craft itself, and how that might impact site performance.</p>

<cache><performance><redis>
Expected performance benefit of using a non-file CacheMethod (Redis, Memcache)
# Expected performance benefit of using a non-file CacheMethod (Redis, Memcache)

(Asked by: username_0 on 2016-05-10)

I'm wondering what kind of performance increase, and in what situations, I might expect from using Redis or Memcache over the default file-based caching.

I know template caching always comes from the DB, so I'm not sure what else I can expect to be cached from Craft itself, and how that might impact site performance.

**Tags:** cache, performance, redis


---

## 4 answers

### Answer by username_1 on 2016-05-10. Score: 3 | Accepted answer

As with most performance related questions, the answer is "it depends". :)

Apps like Redis and Memcache store their key => value stores in memory as opposed to disk-based file caching.

Accessing data from memory is usually orders of magnitude faster than accessing data from disk.

All of these fall under "[General purpose data caching](https://craftcms.stackexchange.com/a/13383/57)" and Craft will use them internally for its own operations and plugins can certainly make use of them as well.

If you have a plugin that makes extensive use of data caching and/or you've got a heavily trafficked site, then you will likely see some tangible performance benefits.

If you're just doing a basic stock Craft install on a low trafficked site, then you likely won't see much of a difference at all.


---

### Answer by username_2 on 2016-05-11. Score: 3

How many servers do you have?

Redis and Memcached are most beneficial/intended for a multiple server setup so if you only have one server, there's probably other/betters thing to worry about. (Best speed increase I've found so far: PHP 7.)

As Brad points out, it all depends on your content, traffic, concurrent users, etc.

It goes without saying having enough ram so you're not swapping can have a huge benefit. Just because those files are stored on disk doesn't mean PHP itself is actually hitting the disk for each request.

SSDs are also now coming standard with a lot of the better hosting plans. SSDs can rival in-memory access times. Just changing your hosting can have a big impact on your app's performance.

If you go down the deamon route, Redis seems more modern and is the newest contender in this space. I haven't extensively used Redis or memached with Craft but I have a client with WP on a dedicated server. We tried memcached awhile back and it was actually slower than without it. It's not hard to see why: there's going to be overhead reading/writing to either daemon—after all they communicate via socket or TCP/IP—and whether that solves your particular performance problem is up for debate.

memcached hasn't really evolved much as of late. While memcached is strictly a key/value store, Redis is intended to store object structures better.

`tmpfs` could be an alternative as well. It's basically a ram disk and is built into most Linux distros. It's pretty easy to setup and like everything else it has some caveats (making sure it comes back up on reboot, having enough space so you don't swap to begin with, clearing etc).

Some further reading:

* [temps vs memcached](https://stackoverflow.com/questions/2393783/php-tmpfs-vs-memcached)
* [memcached vs redis](https://stackoverflow.com/a/11257333)

> **Comments:**
> **username_0**: Right - if we go with Redis, it'll be on its own VPS.  

---

### Answer by username_3 on 2021-04-03. Score: 2

Here you can find an interesting benchmarking between Redis (remote or local) and Python Disk caching. The answer from Didier Spezia is good enough to understand the results.
<https://stackoverflow.com/a/12871072/8520235>

Enough RAM and disk caching are always better solutions for reasonable amounts of data.
Any local, not to say remote, Redis solution includes network roundtrips, that these days are slower than Linux disk caching or even SSD disk access.


---

### Answer by username_4 on 2018-08-18. Score: 1

Redis and Memcache are both Key value pair storage, their key => value stores in memory as opposed to disk-based file caching that make is faster to access compare with accessing data from disk

Few Interesting properties of Redis:

> 1. Redis can be accessed by all the processes of your applications, possibly running on several nodes (something local memory cannot achieve).
> 2. Redis memory storage is quite efficient, and done in a separate process. If the application runs on a platform whose memory is garbage collected (node.js, java, etc ...), it allows handling a much bigger memory cache/store. In practice, very large heaps do not perform well with garbage collected languages.
> 3. Redis can persist the data on disk if needed.
> 4. Redis is a bit more than a simple cache: it provides various data structures, various item eviction policies, blocking queues, pub/sub, atomicity, Lua scripting, etc ...
> 5. Redis can replicate its activity with a master/slave mechanism in order to implement high-availability.


---

