In this article I’ll quickly review why having no form of database caching to reduce duplicate database queries on your website applications, can cause a problematic level of resource usage.
What is caching?
You probably are already familiar with the common form of web-browser caching, even if you’re not, you’re reaping the rewards of this as you surf the Internet. For instance if you’ve been to the InMotionHosting.com site before, our logo image can become cached on your local computer. Then the next time you visit our website, so long as that logo hasn’t changed, your web-browser will just try to load the image locally instead of trying to pull it from our server again.
The same concept can also be applied to software that you run on a server, for instance WordPress which is a very popular CMS (Content Management System), pulls its post data from a database. So in some cases it can cause a lot of server usage continually pulling that same post data out of the database again and again.
Why use caching?
By implementing a caching plugin for WordPress, the post content from the database can be cached in a ready to serve HTML page. The difference this can make on a websites resource usage can be exponentially very large. A website running with no form of database caching in extreme cases can lead to an account suspension so ensuring you have caching enabled can be critical.
As an example lets say that your WordPress website takes 2 seconds of CPU time to load the front page for every visitor. If you had 1,000 visitors throughout the day request your front page, that would be over 33 minutes of CPU time. Now if you instead cached the front page on the server into an HTML page, and then simply handed off that ready to go HTML page to each of the 1,000 visitors, you would basically have the 2 seconds of CPU time to generate the page, and then very negligible usage outside of that so long as you didn’t have a lot of plugins enabled which can’t be cached.
Enabling caching
In order to actually cache your website to help reduce duplicate database queries, this would need to typically be manually coded in if you’re using custom coded software.
If you are using WordPress and are a bit of an advanced user you can read about optimizing WordPress with W3 Total Cache plugin. If you’re a more basic user than optimizing WordPress with WP Super Cache plugin would probably be better.