Caching: Memory or Disk

Caching Removes Weight!

Choices, Choices.

A small disclaimer: I’m going to assume you have a caching plugin installed at this point and you’re wanting to know if you should choose disk based caching or memory based caching. I’m also going to assume that you don’t have rockstar command line skills and that servers really aren’t your thing…so I won’t be giving you anything to put in a command line nor will I dive deep into hardware configuration. Nothing too deep.

Caching is a huge deal. All the popular sites do it, and the reasoning behind it is simple: it increases page load time and decreases server load. The less load, the more servers can serve content ultimately leading to fewer physical machines and lower operating costs (sometimes). It’s a good thing, really.

If you’re using shared hosting, caching is a must.

Disk Caching

At first, I was clueless. Disk (Advanced) appeared good the first time I installed W3 Total Cache (W3TC). I didn’t think about the difference in hardware at the moment nor was memory caching an option. It just didn’t seem relevant. I don’t know why…hardware is half of my real job.

Disk caching has its pros and cons:

Pros:

  • Works on all types of hosting, shared and private
  • Increases page speed enough for some
  • Lightens the load on the server application (Apache and the like)

Cons:

  • Disk caching is caching files on a hard drive; the slowest part of a computer. Server drives aren’t solid state either, those drives spin.
  • Increased drive I/O isn’t the best thing in the world (Drives fail. Not if, when.)
  • Isn’t incredibly fast

Disk caching is the easiest caching and for the inexperienced user, probably the best option. It requires almost zero configuration. It’s a set and forget method, and it’s fast enough for most people. The biggest downside is that it’s caching on the disk. Hard drives, even the 15K (that’s fancy talk for 15,000 RPM) drives in my NAS servers, are the slowest part of a computer.

Memory Caching

Memory caching (mem caching) works slightly different. Programs like APC and Memcached cache in memory rather than on the disk. Memory is fast. Very fast. When you remove moving parts from the equation, everything speeds up. Your data never has to leave the motherboard, travel down some cable, hit a controller, wait to be written…you get it? Though mem caching is better, it’s not perfect either.

Pros:

  • Faster than disk caching
  • Significant page speed increase if configured properly
  • More efficient on hardware (no moving parts; RAM lasts longer than hard drives)

Cons:

  • Not easy to configure
  • Requires some maintenance
  • Can consume large quantities of memory causing your site to time out

Though the biggest plus is page speed increase, the biggest con is that successful mem caching requires a good bit of RAM, or some seriously modified configuration files. If you don’t have the RAM, and you attempt to use something like APC or Memcached, you might find your server unresponsive. It’s not fun, and not easy to fix.

Conclusion

Caching, memory or disk, is crucial to site performance. If you don’t cache, you risk slow page load times which ultimately affect SEO as well as your pageviews. People aren’t patient, and I promise, our content is no exception.

Good luck! If you have any questions, hit the comments.