Caching is a fundamental technique for optimizing the performance of websites. It helps reduce the amount of time required to load a web page by storing a copy of the page's content in memory or on disk. This makes it possible to serve the page faster, without having to execute the code and run the database queries required to generate the page each time it is requested.

There are two main types of caching that are commonly used in WordPress caching plugins: MemCached and disk-based caching. In this article, we will compare the benefits and performance of both, to help you determine which type of caching is best for your WordPress site.

Memory-Based Caching (MemCached)

MemCached is an in-memory caching system that is used to store data in the server's memory (RAM). This makes it possible to retrieve data very quickly, as the data is stored in a location that can be accessed quickly by the server. The benefits of using MemCached for caching in WordPress sites include:

  • Faster Load Times: As the data is stored in memory, it can be retrieved very quickly. This means that web pages can be served faster, which can help to improve the user experience and reduce bounce rates.

  • Scalability: MemCached is highly scalable, which means that it can handle large amounts of traffic without a significant impact on performance.

  • Reduced Server Load: By caching data in memory, the server is not required to execute the code required to generate the page each time it is requested. This can help to reduce the load on the server, which can help to improve overall site and server performance.

However, there are also some drawbacks to using MemCached for caching in WordPress sites. These include:

  • Cost: MemCached requires a significant amount of memory to be effective, which can be expensive.

  • Limited Storage: The amount of data that can be stored in memory is limited, which means that older data may need to be removed to make room for new data. Some scripts may also run out of memory more often, leading to errors and interrupted processes.

In conclusion, MemCached is the fastest and most recommended caching solution, but only for hosting accounts and servers that have sufficient memory (RAM) available. Considering that the benefits of a fast site and satisfied users outweigh the cost factors, it's usually reasonable to upgrade to a higher plan or larger server to adapt to the requirements of your site and MemCached.

The same applies to other memory-based caching systems, such as Redis, but since our servers currently run MemCached only, we haven't mentioned Redis and others.

Disk-Based Caching

Disk-based caching involves storing cached data on disk, rather than in memory. This type of caching is typically multiple times slower than MemCached, as data must be retrieved from disk each time it is requested. However, there are also several benefits to using disk-based caching, including:

  • Cost-Effective: Disk-based caching is typically more cost-effective than MemCached, as it does not require a significant amount of memory.

  • Large Storage: Disk-based caching can store a large amount of data, which means that older data does not need to be removed to make room for new data.

  • Compatibility: Disk-based caching is compatible with a wider range of servers, which means that it can be used on a wider range of WordPress sites.

However, there are also some drawbacks to using disk-based caching, including:

  • Slower Load Times: As data must be retrieved from disk each time it is requested, web pages may take longer to load.

  • Increased Server Load: As the server must execute the code required to generate the page each time it is requested, the load on the server may be increased.

  • Shorter Disk Life-Span: Over time disk-based caching can write and rewrite a considerable amount of data to the disk, which can wear out SSDs (Solid-State Drives) much faster. This can reduce their performance and shorten their lifespan, possibly leading to weaker performance and downtime. After all, storage disks should be used for storage, while memory (RAM - Random Access Memory) is by definition designed for caching.

Conclusion

Both MemCached and disk-based caching have their own unique benefits and drawbacks. MemCached offers faster load times and scalability, but can be expensive and has limited storage. Disk-based caching is more cost-effective and has larger storage, but is slower, can shorten the lifespan of hardware and increases server load. To determine which type of caching is best for your WordPress site, you will need to consider your specific requirements, including the amount of traffic you expect, the amount of storage you need, and the level of performance you require.

In our experience, MemCached has always delivered the best results and we would highly recommend using it whenever possible.

Recommended WordPress Plugins

There are plenty of caching plugins for WordPress available, but only some of them are efficient and support memory-based caching (e.g. MemCached or Redis).

Our recommendations are:

Both of them should give you good results, but one can perform slightly better than the other, depending on various factors. You can give both of them a try (separately) and then decide which one is best for your site.

We also have articles to help you with the setup:

Please note that these are third-party plugins. If you have any questions or issues, please contact the plugin developers or use their support forums. You can also contact our technical support department and we'll try to help you on a best-effort basis.

Prerequisite Check for MemCached

Before you can use MemCached, you'll need to assure that the MemCached server and the PHP extensions are available on the server and enabled for your account. This step is outlined in a separate article: How to enable the MemCached PHP extensions using the CloudLinux PHP Selector

Updated by SP on 03/05/2023

Was this answer helpful? 0 Users Found This Useful (0 Votes)