An increasingly volatile browser cache

Sommaire
Caching is one of the basic rules of webperf. Caching saves bandwidth and reduces loading times when the same resource is called up a second time. At least, that’s the original plan… but it turns out that’s not always the case.
In fact, not all resources that are supposed to be served by the cache actually are. To better understand the problem, let’s take a look at the average lifetime of a resource in a cache. You’d think that a browser would cache data once and for all, but in practice this isn’t the case. Safari, for example, implements a feature called Intelligent Tracking Protection – the cache is double-keyed based on document origin and third-party origin; Chrome also partitions its cache. Thus, according to a Facebook study, only 42% of cached resources are more than 47 hours old, and only 25% are more than 260 hours old. This research by Yahoo, Facebook and, more recently, Paul Calvano, indicates that resources don’t live as long in the browser cache as we might think. And when we conduct the same experiment on mobile, we find that there’s a 50% chance that our cached resource is less than 12 hours old! In conclusion, resources don’t stay hidden for very long.

Why is cache so volatile?

Every browser has its own cache memory.
  • Internet Explorer: 8-50 MB
  • Firefox: 50 MB
  • Safari: no limit (?!)
  • Chrome: less than 80 MB (depending on available disk space)
  • Opera: 20 MB
When this limit is reached, the cache automatically deletes the oldest files to make room for new resources. As web pages get heavier and heavier, the lifespan of resources in a cache becomes shorter and shorter. For example, in October 2000, the average size of a web page was 89 kb (including images and scripts). Today, the average size is 2.6 MB, a 30-fold increase in 15 years!

What can be done about cache volatility?

To ensure that a website’s resources remain hidden, you can use LocalStorage. This allows data to be stored directly in the browser. Its storage capacity (5 MB for most browsers) is dedicated to a domain name. To date, 92.72% of browsers have deployed it:

navigateur localstorage

Unlike cache, local storage has no expiration date. Once the limit has been reached, no resource is automatically deleted. It’s no longer the browser that manages storage and eviction, it’s the site itself that determines which resources are to be removed from this storage space. The volatility we’ve just described underlines the importance of optimizing your site so as to reduce the weight of resources as much as possible, and thus lighten the cache. With this in mind, he explains a number of best practices for improving first-visit loading times: image compression, minification and concatenation of JS and CSS, and the use of a CDN (global or local).

Would you like to facilitate the application of these best practices and automate the optimization of your web performance?

Sommaire
Test your site's performance in 1 click

Published by

Share!

Discover other articles…

Illustration: three beams of light arrive at the entrance to a site; two pass through, whilst the third is stopped – just like authorised or blocked AI crawlers

GPTBot, ClaudeBot, PerplexityBot: three families of AI crawlers, three different approaches. How to identify them, verify them and decide which ones to allow through.

…
Illustration : une acheteuse avec un sac de shopping marche dans la neige vers une porte ouverte d'où jaillit une lumière orange chaleureuse, avec des cadeaux posés devant, comme un site prêt à accueillir ses visiteurs le jour du Black Friday

Black Friday is on 27 November and the code freeze is close. Eight things to check this week: key pages, FAQs, prices, crawlers, peak-day speed

…
E-commerce: getting your website ready

AI assistants already read e-commerce sites, and agents are starting to act on them. What changes for your site and the technical work to plan

…

Boost your site speed now with EdgeSpeed!