You want your website to go fast. One technology that contributes to site speed is caching. Caching is a set of software and hardware techniques that store data so that they are quickly available for future requests. In this article, we will explain what is the WordPress cache, how it can be implemented on many different levels, and how we take care of everything for you so you won’t have to worry about it.
What is caching?
In computing, there is this thing called “cache”, whereby a software or hardware component is used to temporarily store values and retrieve them faster in the future. Values such as MySQL queries, or compiled PHP bytecode as well as duplicate data, such as HTML and images. Pretty much everything, really.
By making copies of data and placing them in the “caching” component, we gain a significant performance advantage. Your visitors can retrieve cached content much faster than uncached. Cached content can be retrieved faster by your visitors than uncached. Caching components are usually memory, but can be anything that can be faster than conventional storage. But how much performance improvement can you gain?
It all depends on how much data you can cache but generally speaking, performance improvements at the magnitude of one whole second, are not uncommon.
What can be cached?
There are several levels, depending on how far you want to go in optimising your website using caching.
The first way is to cache the HTML page itself. There are many WordPress cache plugins like WP Rocket and W3 Total Cache that do that and much more. These plugins cache the result of the HTML output saving time for future requests. Additionally, every plugin gives you a cache invalidation mechanism so you can serve uncached content when wanted.
Another technique, is to “minify” HTML, that is, to make it smaller. This gives you a couple of kilobytes per page, but it adds up over time.
You will need access to the Dashboard, or a way to install plugins to WordPress in order to do that.
OpCaching is a technique whereby PHP takes the source PHP files and compiles them into an intermediary form, called bytecode. Bytecode is like a computer’s machine code, but it refers to machine code that is executed by a “virtual machine” (this case, PHP’s) rather than by a real one. Since it is machine code and resides in memory, it can be executed far quicker than having the PHP interpreter parse a command at a time and execute it.
Caching, at that level, stores these bytecode data into memory, so that your application can be executed faster.
You need to have access to the PHP configuration file in order to have PHP OpCache enabled.
Host your website with Pressidium
60-DAY MONEY BACK GUARANTEE
PHP Object Cache
This is caching that is done on the language’s OOP level. PHP is an object-oriented language, which means it uses the concept of “objects” to describe logic, data, and ideas. As your application runs, these objects are constantly being created and destroyed (dynamically, by a subsystem called the garbage collector). The process of creation and initialisation of these objects takes time. So object caching solves this by caching the objects themselves.
This is implemented via plugins such as Memcached and the assorted ones for Redis. Redis is a powerful in-memory data structure store, that can be used as a database. Memcached is a distributed object-caching system. Both of them are excellent choices for doing caching at that level.
You will need to have access to PHP’s configuration in order to enable PHP Object caching. You will also need access to a Redis or Memcached instance.
MySQL Query Caching
This is the same idea but it is applied at a database level. The database returns a set of data according to the query that was entered. If you can cache the results of these queries, then the next time someone uses that query they will get the data much faster because they would reside cached in memory.
For that, you will need to have access to the database server.
Reference: MySQL 8.0 Query Cache
In order for all of these to be properly setup and maintained, a lot of things are required. Technical knowledge, time, and even money, if you lack experience. But we can help with all of that.
How we solve everything with Pressidium’s Multilayer Caching.
The answer is simple. We have implemented caching everywhere: on all layers of WordPress.
For HTML output we implement two layers of caching, hot and warm. These layers are part of our adaptive cache engine. Our engine can also profile your site and enforce the most efficient caching rules. But, we’ll go into more details about this in another article. So the Hot cache is data that reside in-memory and can be accessed quickly. The Warm Cache is data that reside in state-of-the-art SSD disks. This increases overall cache-hit ratios and results in your site performing significantly better over conventional storage.
For our enterprise clients, we have built an object caching system using the excellent in-memory data structure store Redis. Finally, MySQL Query caching. This is enabled by default and monitored constantly by our DevOps. MySQL Query Caching can give you valuable information regarding your website’s performance.
It is important to note that all of these are implemented in our Platform’s backend, and not through some WordPress cache plugin. This means that a) we use external servers for storage, so we don’t burden your webserver’s resources and b) we store data in memory that is faster to access than disk.
Whatever your caching needs and budget, we can deliver.
Host your WordPress Website with Pressidium!