Caching is used both to speed up and to scale websites. HTML caching, sometimes also referred to as full page caching, can be implemented on different levels in your hosting stack and application. The most efficient HTML cache is the shared cache that is closest to the website visitor.
A browser is a private cache, whereas for example a CDN node or a webserver usually holds a shared cache. Servebolt provides several different ways of using HTML caching, either natively with Servebolt’s Nginx, by using Cloudflare Business or preferably by adding Accelerated Domains. Accelerated Domains will provide a bunch of additional benefits in addition to just the HTML caching.
Speed cannot solely be based on HTML caching, for your dynamic requests the uncached performance is very important and a determining factor when it comes to overall performance – especially on websites that are not much visited.
Static caching and how to enable HTML cache
To cache HTML, you must enable HTML caching for the relevant site in the Servebolt Control Panel. Servebolt’s HTML cache is a safe, easy and predictable cache and works for any type of site running on Servebolt, including Magento, WordPress, WooCommerce and Drupal.
Risks with Caching
HTML caching needs to be done in a safe way. Developers need to know how caching works, and bypass cache for the correct requests to prevent caching private content.
There is always a risk of delivering a wrongly cached page to the wrong person. In a semi-famous incident in Norway the tax authorities delivered the cached version of the tax return of a 36 year old male from Oslo, to several hundred thousand of other Norwegian visitors that tried checking their own tax returns.
The most important thing when you enable HTML caching is to make sure to test your website from multiple sources, and ensure that it responds with cached and uncached versions, like you expect it to.
Caching for Scaling
To be able to handle large amounts of traffic, HTML caching can be activated – and it will help with scaling. This protects the site from going down because of sudden traffic peaks and ensures that the site is speedy even if it has many simultaneous visitors.
A site with working HTML caching activated can handle many times the traffic of a site with no caching. When your site is linked by a major news site, you have to be ready to deliver thousands of page views per minute (called the Slashdot effect).
Without HTML caching the requests will end up in a queue, resulting in a site that responds slower and ultimately breaks. Full-page caching is often used to speed up sites, which it does, but you will not be able to cache all pages. For this and many other reasons, you should only use full page caching to scale your site, not to speed it up.
Give us your feedback on this article
Servebolt has launched Accelerated Domains!
Accelerated Domains is a service that greatly improves and optimizes your site on these four areas: Performance, Scalability, Security and the Carbon footprint of your website.