A change made in the Google Chrome browser in October has impacted the performance of the Google Fonts service for millions of websites.
The change is an update to Chrome’s internal cache system.
A browser’s cache system works by serving as a temporary storage system for images, CSS, and JavaScript files used by websites. Files stored in the cache are typically reused across multiple sites instead of having the browser re-download each file for every page/tab load.
But with the release of Chrome 86 in early October 2020, Google has overhauled how Chrome’s entire caching system works.
Instead of using one big cache for all websites, Google has “partitioned” the Chrome cache, which will now be storing resources on a per-website and per-resource basis.
While this is a big win for user security, preventing some forms of web attacks, this change has affected web services designed around the old cache system.
It’s now recommended to self-host custom fonts
One of these services is Google Fonts, a web portal that launched in 2010 and which hosts custom fonts.
Google Fonts allows website owners to load any fonts hosted on Google servers via a single line of JavaScript or CSS code.
When it launched in 2010, the idea behind Google Fonts was that as users navigated on the internet, their browsers would load Google Fonts in the browser cache, and users wouldn’t need to re-load custom fonts on each new website. This, in turn, would give websites a speed boost when loading new pages, as they already had the fonts in their cache.
However, in a blog post this week, Simon Wicki, a frontend developer from Berlin, pointed out that the new cache partitioning system that shipped with Chrome 86 has effectively made Google Fonts useless, as the new cache system will force users to re-download any fonts on each site they visit.
With the cache-reuse benefit out the window, Wicki now says it is more efficient if website owners download fonts from the Google Fonts website and host them on their own servers, instead of the old method of loading the fonts from Google servers (see image above).
As Wicki also pointed out, the idea of self-hosting custom fonts isn’t new and has been floating around since 2018 when several web developers have conducted studies and reached the same conclusion [1, 2, 3].
Even Google itself recommended the same thing in a Google I/O 2018 talk.
Either way, even if Google Fonts’ days as a fonts CDN appear to be at an end, the service will still remain up and running as one of the largest repositories of freely downloadable open license fonts on the internet.
According to data from the BuildWith web statistics service, Google Fonts are currently used on more than 42.7 million websites.
Besides Chrome, Safari also uses a cache partitioning system since 2013. Since cache partitioning systems have many security benefits, Mozilla has also expressed interest in adding one to Firefox. Edge, Vivaldi, Opera, Brave, and the other Chromium-based browsers are also expected to add support for cache partitioning in the coming months.