First things first, let’s start with Speed
Nowadays speed is a critical factor for the success of any website as it is directly linked to Google rankings and customer satisfaction. To put some numbers on just how intimate the relationship between site speed and profitability is, it turns out that 1 second delay in page response can result in a 7% reduction in conversions.
Before we dive into the topic of smart invalidation and how it benefits websites’ loading times, we firstly need to establish what makes caching so useful in the speed optimisation process.
What is caching and why everyone uses it
Technologically speaking, whenever a user tries to access your website, their browser sends requests to your server involving HTML and PHP files, scripts, images and fonts. After the server responds, the browser assembles this info into a fully functioning webpage. This process can take up to several seconds, just enough to immensely reduce your chances of engaging that user. And this is where the concept of caching comes in.
My favourite example of how impactful caching can be for website speed optimisation comes from Peter Chester who asked the audience at one of his speeches ‘What’s 3,485,250 divided by 23,235?’. After quite a few silent moments, someone was able to work out the answer and shout it out (it’s 150 by the way). Right after, Peter asked the question again and this time around everyone was able to immediately call out the number. Applied to the context of your website, the basic idea of caching is to do the time-consuming calculations once, and then (swiftly!) serve the already available answer.
For instance, NitroPack creates cached versions for each one of your site’s pages per device (mobile, tablet and desktop) - you can think of these as ‘snapshots’. Whenever a user tries to access the website, they immediately get served the snapshot, instead of going through the complex process of requests again. This way, a page loading time becomes a fraction of what it Technologically speaking, whenever a user tries to access your website, their browser sends requests to your server involving HTML and PHP files, scripts, images and fonts. would normally be without the readily available cached version.
So what happens whenever you make a change on your website?
That’s an excellent question. Since the cached snapshots are technically static HTML files, they cannot update themselves. It’s much like taking a photo of your dog right after playing outside in the rain and trying to compare it to a picture of him after a bath. They simply won’t match. Hence, a new snapshot needs to be made that replaces the old one.
One way to make this happen is by taking new snapshots of your content frequently. This, however, will increase the load on your application. So on the surface it appears that there is a dilemma that website owners face when it comes to caching. On the one hand, you have the option of lower application load and faster response time, achieved through caching content for longer periods. And on the other hand, you would want to serve fresh content as soon as you publish it online.
What is invalidation anyway?
NitroPack’s functionality, that comes into play whenever a new snapshot needs to be taken after you make an edit on your website, is cache invalidation. Cache invalidation actually resolves the issue above and allows you to have it all. Essentially, what happens when you use cache invalidation is that as soon as the application data is updated, the web representation is automatically invalidated as out-of-date so the next time a client requests the data, they get the new updated version.
Let’s make it smart
Hence, through invalidation NitroPack makes sure your site visitors see your latest content by detecting any changes made to pages and automatically creating a new cached version. But does this mean, that your page speed drops whenever a change is made since the old cache has to be purged in order to be replaced with the new snapshot?
Actually no! Our Smart Invalidation feature allows the cache to be updated in the background, while serving the previous cached version of the page to real-time visitors. This process happens automatically whenever an update is detected and usually takes just seconds (a minute tops) to complete. This means that you never serve unoptimized (slow) pages to your website visitors.
Final Words on Cache Invalidation
In short, cache invalidation is an extremely valuable tool for website optimization that guarantees you serve fresh content without compromising on speed. Phil Karlton famously said ‘There are only two hard things in Computer Science: cache invalidation and naming things.’ Luckily, with NitroPack you wouldn’t have to worry about how difficult cache invalidation is - we provide it pre-configured and ready to use asap.
Let us know if you have any questions about cache invalidation (or anything website speed related for that matter) in the comments below and we will make sure to give you an answer :)
If you want to get the best page speed results you have seen for your website download NitroPack now!