Google Chrome is testing larger cache sizes to increase performance

Google Chrome

Google is experimenting with increased storage for the browser cache to reduce the performance hit caused by the recently added partitioned cache feature.

Before Chrome 85, the browser used a single storage bucket to store cached resources, such as images, audio, video, and HTML content for all pages that you have previously visited. When Chrome opens a web page, it will check if requested resources are stored in the cache, and if they are, load it from the local disk rather than download it from a remote server.

Using a single shared storage bucket for all cached resources, though, opens up a range of side-channel attacks that could allow sites to perform malicious activity.

“This opens the browser to a side-channel attack where one site can detect if another site has loaded a resource by checking if it’s in the cache. That sounds innocuous, but it can be used for many nefarious deeds such as discovering what’s in your inbox, contacts, etc.,” Google Chrome engineers Josh Karlin and Shivani Sharma explain in a document on cache partitioning.

To prevent these side-channel attacks, Google added a new feature to Chrome 85 that partitions the browser’s disk cache so that each site utilizes its own cache that cannot be read by other sites.

Cache partitioning decreases performance

When Google tested this new feature, they found that it cause small performance hit, but it was outweighed by the security benefits.

“Early (canary/dev) results using top-frame-site show that the impact isn’t nearly as bad as feared. The cache hit rate drops by about 4% but changes to first contentful paint aren’t statistically significant and the overall fraction of bytes loaded from the cache only drops from 39.1% to 37.8%. This may change as we progress to beta and stable but it seems like an encouraging start,” the Google engineers stated.

This performance hit is caused by resources previously shared among all sites now having to be downloaded for every site that uses them.

To improve this feature’s performance, Google is experimenting with increased disk cache sizes to prevent resources from being evicted from the cache to quickly.

“Add code to enable experimentation of different http cache sizes. Now that cache will be partitioned, it makes sense to see if increasing the cache size helps offset some performance impact by lowering the eviction rate,” Sharma explained in a Chrome Gerrit post.

As part of this test, the browser’s performance will be measured at different disk cache sizes to see if increasing them to larger values positively impacts performance. During this test, Google plans on testing cache storage that is 2x, 2.5x, and 3x the normal cache size.

Portion of source code used in Chrome experiment
Portion of source code used in Chrome experiment

Google is hoping that increasing the disk cache size will reduce the number of times the browser has to remove older cached items as storage runs out. This increased storage would then potentially increase the number of cached items at one time and improve web browsing performance.

It is unknown if this change is being tested in Google Chrome Canary builds or internal builds.

Update 12/26/20: According to Eric Lawrence, Microsoft Edge program Manager for the web platform, Google does not test new feature in internal builds. Instead they conduct field trials in the Canary, Beta, and Dev builds to determine whether a tested feature achieves the desired results.

Lawrence told BleepingComputer that this particular field trial is not yet live as Sharma is likely waiting for approval from the metrics code owner, which this trial will be added to.

Original Article