Use WordPress cache to speed up your site
Every time a visitor comes to your WordPress website, by default, WordPress will create the page requested. Taking advantage of a WordPress cache plugin, you can create a static copy of your pages to speed things up.
With a WordPress caching plugin you can reduce your account's resource usage, allowing you to run more WordPress sites on a single account. While at the sime time, your visitors can enjoy a faster browsing experience.
What is caching?
To serve a page, the server needs to send some HTML code back to the web-browser of a visitor for them to view. A CMS like WordPress, uses a server-side language called PHP to first put together all the pieces of your web page.
For every visitor, a PHP script will run, pull info from your WordPress database, and spit back the HTML code.
A WordPress caching plugin will make a copy of the HTML code, then serve that to the next visitor, saving time.
WordPress without caching
This is the output from running the top command in batch mode while requesting the front page of my WordPress site 5 times, and then one post from the site 5 times. I've highlighted each completed request in yellow:
0:00.22 0:00.17 0:00.23 0:00.24 0:00.21 0:00.25 0:00.26 0:00.16 0:00.24 0:00.09 0:02.07
The 11th column shows the CPU time used to fulfill each PHP request when hitting my WordPress site repeatedly.
For 10 requests it took 2 seconds of CPU time. With hundreds, or thousands of requets, this can add up.
WordPress with caching
Here are the same 10 requests from above, this time with a WordPress cache plugin installed and running:
0:00.29 0:00.18 0:00.47
Now my WordPress site is only using .47 seconds of CPU time instead of 2 seconds to serve the same 10 requests.
With a WordPress cache, only 2 PHP scripts ran, one to generate the front page, and one for the additional post. Every refresh I did of the page after that, the server just handed me the HTML copy that WordPress cached.
WordPress caching saves time
On average my WordPress site with minimal plugins installed used .2 seconds of CPU time, so if I do the math.
|WordPress without cache plugin||WordPress with cache plugin|
|CPU time||Requests||Total CPU time||CPU time||Requests||Total CPU time|
|.2||100||20 seconds||.2||100||.2 seconds|
|.2||500||100 seconds||.2||500||.2 seconds|
|.2||5,000||16.6 minutes||.2||5,000||.2 seconds|
|.2||15,000||50 minutes||.2||15,000||.2 seconds|
It's important to note that this is on a bare WordPress website with only one minimal WordPress plugin installed. If you happen to be running an intensive WordPress plugin, your CPU time per single page could be much higher.
This is why it's important to run a WordPress caching plugin, especially in a shared environment. If you suddenly have a surge in traffic to a few of your pages, it could quickly cause a lot of resources to be used needlessly.
W3 Total Cache
The W3 Total Cache plugin for WordPress is a highly customizable caching plugin and is typically used in more advanced scenarios where you might be interested in utilizing a CDN (Content Delivery Network) or other more advanced features.
As you can see from the screenshot on the left, there are quite a few options to control. So if you aren't interesting in configuring all of those, you might be interested in using a more simple caching plugin.
WP Super Cache
The WP Super Cache plugin for WordPress is a very easy to setup caching plugin that still has a good amount of features, but is normally used in more basic caching scenarios.
Again as you can tell from the screen shot on the left, there are a decent amount of options for you to configure, but far less than W3 Total Cache.
WP Fastest Cache
The WP Fastest Cache plugin for WordPress is a newer less robust caching plugin. However it is very simple to setup and configure correctly and still does a great job at reducing usage.
As you can see from the screenshot on the left, this is one of the most stripped down and basic WordPress caching plugins. It still does a great job though!