Server-Side Cache or caching plugins?

When you load a page powered by WordPress, if you have no cache, the server generates the HTML of the page before sending it to the browser.

Generating the HTML needs time because WordPress has to execute PHP and ask database queries to build the page.

Using a caching plugin or Server-Side Cache, after the first visit, the cached version of the page is stored as a pure HTML file. After the cache is created, the server will send to the browser directly an HTML file, without the need to spend time again to generate the page.

It only needs time to understand which HTML file is the right one.

In the case of server-side cache, the server can know in a faster way which HTML file is the right one.

In the case of caching plugins, in some cases, WordPress needs to execute a few lines of PHP code to detect the right HTML file.

I say in some cases because there are many caching plugins that after activating the cache, they write a few lines of code in .htaccess if your server has Apache (e.g. WP Fastest Cache). In that case, no PHP will run.

 

So, is it better server-side cache or caching plugins?

 

I will list the advantages and disadvantages of both of them.

 

Advantages of Server-Side cache.

The server detects in a faster way which HTML file has to be sent to the browser.

If the website is visited many times per second, it can manage the situation.

Disadvantages of Server-Side cache.

If you change something in one of your blog posts, usually, you need to clear all the cache of your website if you want to see your changes.

In any case, managing the cache only from your server, it may be a nightmare when you change something on your website.

 

Advantages of caching plugins.

Caching plugins know very well the WordPress environment, and if they are good plugins, they can manage the cache without you need to manually delete the cache after you change something on your website.

For example, if you modify a blog post, your caching plugin if it’s s a good caching plugin, and you have set it up properly, it will clear and generate again the cache of the blog page.

Moreover, caching plugins have some options to optimize the HTTP requests, but let’s not take it into account, I want to speak only about the cache.

Disadvantages of caching plugins.

Some caching plugins execute a few lines of PHP code to detect the right HTML file that has to be sent to the browser. This kind of caching plugin may give you problems if your website is visited many times per second, because just a few lines of PHP may be critical in very hard situations.

 

Final conclusion and suggestions.

Nobody says that you can’t have the advantages of the Server-Side Cache and at the same time managing the cache in a more flexible way using a caching plugin.

For me, the best solution is to have a Server-Side Cache with an expiration time of few seconds and manage the long-time cache with a caching plugin.

By doing so, your website will be protected by the Server-Side Cache when it has many visits per second, but you will not become crazy when you change something in a blog post, because after a few seconds you will see your changes.

The cache generated by a plugin can live for months until you don’t change the page, and when you do it, the plugin will clear the cache and regenerate it again for you.

In normal situations, a plugin is able to detect the HTML file in not more than a couple of milliseconds compared with Server-Side Cache. A couple of milliseconds are nothing compared with the flexibility a caching plugin can offer.

The situation can be very different in the case of very high trafficked websites. In these cases having a Server-Side Cache that manages all the cache can make an important difference in terms of performance.

FAQ

Why some servers don’t allow caching plugins?

They want to sell their service or they have no idea what it means to work on a website changing many times the content. Or they offer a system to manage the cache similarly to caching plugins. In this last case, you don’t need anymore a caching plugin.

Why do many people say Server-Side Cache is better and you should not use caching plugins?

Probably they never change anything on their website. In any case, I also suggest using a Server-Side Cache but only when it has an expiration time of few seconds.

I think Server-Side Cache with a very short expiration time together with caching plugins is the best solution in many cases.

About caching plugins, be just care that it’s a good caching plugin. Many of them don’t execute PHP to chose the HTML file, I would choose one of them when you have no need for more flexibility.

In some situations, if your website has really many visits, Serve-Side Cache can make an important difference.

But you should always evaluate the situation

If you want to further improve the cache management on your WordPress site, I suggest you Update Page Cache.