Caching is an effective way of reducing loading times. But it’s often difficult to apply to web pages because of the customization involved (item counter in the shopping cart, login banner, etc.).
Faced with this problem, over the past 4 years our webperf experts have been looking at different ways to improve caching.
Here’s a quick overview of the different caching solutions they’ve made available on Fasterize.
Caching static resources
The classic caching solution! It needs no introduction. It applies to all static resources and pages.
The Fasterize engine respects the HTTP Cache-Control header specified by the origin. If this is missing or incorrect, it can be replaced from the dashboard. The engine allows fine-tuning of caching by choosing whether the resource can be cached by the browser and/or by a CDN.
We apply a segmentation of cached pages.
This means that each cached page has different cached versions: depending on the browser, the terminal or a specific cookie (we use the value of a cookie in our cache key).
Where to configure classic caching from your Fasterize dashboard?
In configuration > caching
NB. If you opt for a CDN, static pages and resources will be served from it.
Caching dynamic pages
Caching static resources is one thing. Caching dynamic web pages is quite another.
In this section, we’ll take a look at how to cache web pages that contain customized parts (referred to here as dynamic pages).
We’ve noticed two things about this type of page:
-
- Dynamic pages are not completely dynamic
Often, a page is only dynamic because a few areas of the page are customized. The rest of the page, on the other hand, is common to all users.
- Dynamic pages are not completely dynamic
- Dynamic pages are not always dynamic
You’ve probably noticed it too: most of the time, non-cacheable dynamic pages are identical from one user to the next. Pages are only personalized when the user performs a particular action.Let’s take the example of an e-commerce site: the page is identical from one navigation to the next until the customer has filled the shopping cart. This means that the page can be the same 90% of the time, or customized according to the user session the remaining 10% of the time.In a previous study, we found that 30% of responses to dynamic pages were identical!
In this context, it’s a pity not to cache these pages, which are not always and/or not completely dynamic.
As a result, our team of experts has deployed 3 advanced caching techniques on Fasterize:
Smart Cache
Smart Cache caches the static part of a dynamic page.
We identify the dynamic and static parts of a web page. The static parts are then cached, while the dynamic parts are loaded asynchronously at a later stage (a bit like ajaxifying your pages!).
To set up Smart Cache, specific parameters are required to distinguish dynamic parts from static parts.
Where to configure Smart Cache from your Fasterize dashbord?
Always in configuration > caching
Cookie Less Cache
We started from the observation that many identical “dynamic” pages were being served to anonymous users of a site. Indeed, as long as a user hasn’t received a cookie, the page content doesn’t change from another user without a cookie.
We have therefore developed the cookie less cache or cache for users without a cookie.
This enables us to distinguish between users who are “anonymous” to the site (i.e. without cookies) and users who are known to the site (with cookies).
We cache pages served to anonymous users and then serve them from the same cache to subsequent anonymous users. Users identified by a cookie will receive the (personalized) page from the original server.
Where to configure Cookie Less Cache from your Fasterize dashboard?
Go to configuration > rules
Check “Cache non-cacheable pages for anonymous users”.
There’s an important difference to understand between Smart Cache and Cookie Less cache: the former requires fine-tuned configuration, which today requires custom settings (selection of dynamic blocks). The latter can be activated automatically without any configuration.
Dynamic Cache
At Fasterize, we optimize HTML code on the fly. So, when we saw that 30% of responses to dynamic pages were identical, we decided to hide these identical pages, so as not to continually reapply the same optimizations… To do this, we configured the engine so that when a page is optimized, it keeps a copy for one minute (this copy is associated with the hash of the original response).
So before optimizing, the engine checks that it hasn’t already optimized the page in the previous minute. If it has, the engine serves the already optimized version and avoids further optimization. This reduces optimization time on the page by around 60ms, and takes the load off the engine.
Which cache to choose?
These different cache typologies regularly lead to the question “Which cache should I activate?”
Of course, it all depends on your pages. Here’s the order of priority we recommend you adopt:
Is it possible to use the classic cache? If not, is it possible to set Smart Cache? If not, can you activate Cookie Less Cache?
If Cookie Less Cache is not active (the request has a cookie), Dynamic Cache will automatically be used by our engine.
Future improvements to the Fasterize cache
Of course, we’re not stopping here.
In the coming months, we’ll be making further improvements to the existing system.
These include
-
- ESI management:
You’re already familiar with ESI: this is HTML markup used to assemble a dynamic page. This means that different blocks of a page can be cached or not. ESIs are used by Varnish and certain CDNs, for example.
ESI instructions will soon be taken into account by Fasterize and can be configured directly from our console.
Find out more about the difference between ESI and Smart Cache >>
- ESI management:
-
- Cache Warmer:
This involves pre-filling the cache from a sitemap. In this way, it’s not a user who receives the uncached page on the first visit, but our engine. So it’s not a user who heats up the cache, but Fasterize.
This improves website performance for all users, and at the same time increases the number of HITs (number of times the page is served from the cache).
- Cache Warmer:
Reminder: cache flush
You can flush caches directly from the Fasterize admin console or via our API.
You can also flush resources associated with a given configuration, domain or URL.
Now you know all about our caching methods! But we’ll be sure to surprise you as we roll out new features, so that your websites are always at the cutting edge of performance.
In the meantime, don’t hesitate to contact us to evaluate the benefits of Fasterize for your website!
Request a webperf diagnostic of your site