Spending a significant amount of time waiting for a website to load is one of the things that annoy many internet users. Because many of us are in a hurry, it can be very frustrating to wait for a long time just to obtain the information we need.
This is why many website owners are doing everything they can to speed up the page loading times of their website. By improving their site’s page loading times, they can satisfy the needs of their visitors and at the same time make their website more search engine-friendly.
If you’re wondering how you can improve the speed with which your website is being shown to your visitors, this article will discuss a simple yet effective method to help you reach your goal. This method is called ‘caching’.
What is caching?
Caching refers to the process of storing file copies in a temporary storage location or cache. This allows you to access and reuse previously retrieved data more quickly and efficiently.
Typically this is done in your browser, to keep snippets of code / images from sites you regularly visit, so they don’t have to be served again from the original web server.
How it works
To cache data, a portion of the computer’s random access memory (RAM) is set aside to be used as the cache. When an application attempts to read data from a storage system, such as a database for example, it will check if the required information has been already recorded in the cache. If the data is already there, the application will use it immediately. As a result, the application won’t have to access the database, which is slower, to get the data it needs.
On the other hand, when there’s no data saved on the cache, the application will read and retrieve the data it needs from the main source and record it into the cache. When the application is run again and it requires the same data, it can easily obtain it from the cache.
Where it is used
Caching can be used in many different ways. It can be applied in various computing technology and applications, including operating systems, content delivery networks (CDNs) and domain name servers (DNSs), web applications, gaming and databases. It can also be used in media sharing and social networking.
For the purpose of this article, we’re looking more specifically at web caching.
Why use caching?
As a website owner, there are many reasons why you should utilise caching. Here are some of them:
- It helps reduce bandwidth consumption, which helps reduce network traffic and congestion. Less to request, less bandwidth needed,
- It minimises access latency – those annoying lags you get on the web sometimes.
- It reduces the workload of the remote web server.
- It allows web visitors to access your site even when the remote server is unavailable by providing a cached copy of your site. This is how a lot of CDN and DNS providers work – for example we use a tool called CloudFlare on many of our sites, which has an ‘always online’ setting that essentially copies a ‘flat’ version of your site (viewable but not fully functioning) onto nearby servers, meaning it can always be at least viewed than showing an error (aka ‘404’) page.
Types of web caching
As discussed earlier, caching can be utilised in many different applications. However, we’re going to focus on web caching so that you’ll know how to improve the loading time of your website. There are two types of web caching: browser caching and server caching.
1. Browser caching
When you visit a website for the first time, your web browser will download various resources; not just the content of the page you’re seeing. These include stylesheets, images, fonts and JavaScript files. This way, your browser doesn’t have to retrieve the same resources the next time you visit the same website.
This is the most common form, as unless you tell them not too, ALL browsers will cache frequently visited sites.
Whilst on the whole this is super useful, it can cause issues sometimes if a site your frequently visit (e.g. your own website) has had recent changes. Your browser may not necessarily kick in all of the changes, or on occasion, show a jumbled mix of code.
2. Server Caching
With server caching, instead of processing every request, a website server stores the results of each page request and serves them when the same request is made. There are two types of server caching methods: object caches and full page caches. Object caches store only a small amount of data, whereas full page caches store the contents of an entire page for faster page loading and viewing.
Essentially, server caching creates a flattened version of the web page, rather than computing and then rendering each page. This is particularly prevalent with Content Managed (CMS) websites such as WordPress, where the site actually consists of different templates (header, footer, page body, project etc) which are produced ‘on-the-fly’ via database requests.
3. CDN Caching
It’s very common these days to make use of Content Delivery Networks (aka CDNs) to use high powered, distributed servers to serve the site files to your nearest geographical location. Platforms such as YouTube and Vimeo do this very effectively to provide video streaming; a typical web server is not generally configured to offer this (it requires a lot of computing power) which is why we recommend hosting videos on a streaming platform such as these and embedding on the site, than directly streamed from the site server.
On the whole, this all works seamlessly, but with so many stages in the mix, the server, CDN and browser caches can, on occasion, get a little mixed up!
This is why we schedule site and CDN caches to clear periodically – either when performing an action such as updating a page, or every few hours.
WordPress caching best practices
If you’re using WordPress to manage the content of your website, here’s how you can use caching to your full advantage.
1. Using plug-ins
Don’t use more than one caching plug-in with your WordPress website. Instead of speeding your site up, it could make it much slower. There are several caching plug-ins available for WordPress but the one we highly recommend is WP Rocket or WP Fastest Cache.
Tests show that WP Rocket can improve page loading speeds by up to 69 per cent. In addition, this plug-in is also user-friendly. It features an easy-to-use dashboard and provides users with enough options and settings so that they can cache their websites however they want to. Also, it will start caching your website once you activate it.
Another advantage of using WP Rocket or WP Fastest Cache is that it is compatible with most CDN providers.
Whether you’re using a CDN service that is bundled with your hosting plan or you choose a specific CDN on your own, you can be sure that you’ll be able to make the most of this plug-in to speed up your website.
They can also help prevent large media files from slowing down your site. With LazyLoading features, videos and images won’t load until a web visitor has scrolled down to the part where these media files are located on the page. In addition, the optional ‘minification’ features that allows you to reduce the size of not only image files but also JavaScript, CSS and HTML files.
2. Using your host’s caching
If your website runs on managed WordPress hosting environments, you can use your host’s caching system to improve your site’s loading times. Caching systems used by hosting companies are very effective because they run at a much lower level. They are also particularly efficient because they are specifically designed to work with WordPress.
3. Efficient coding
Always write efficient code every time. Apart from knowing how WordPress works internally before writing code, you should know how to use transients properly. Transients are an object caching mechanism that expires after a certain amount of time. You can use transients to cache parts of your website that don’t change very much such as your header and footer.
How to clear your cache
Google Chrome
https://support.google.com/accounts/answer/32050
Mozilla Firefox
https://support.mozilla.org/en-US/kb/how-clear-firefox-cache
Microsoft Edge
https://clear-my-cache.com/windows/microsoft-edge.html
Apple Safari
https://www.businessinsider.com/how-to-clear-cache-on-safari-browser?r=US&IR=T
Apple iOS Safari
https://support.apple.com/en-gb/HT201265
Android
https://support.google.com/accounts/answer/32050
Conclusion
Because internet users these days can be very impatient, you should try to reduce the amount of time your website needs to load properly. Caching is a technology that helps with this. What’s good about caching is that it helps speed up your site without needing many resources.
When used properly, caching can significantly help improve the performance of your website. Not only will it speed up page loading times but it can also reduce the strain on your server. As such, if you’re not caching your web pages, now is a great time to start.