Investigate using the simple cache backend

Bug #1430349 reported by Chris Coulson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Oxide
Triaged
High
Unassigned

Bug Description

We currently use the default blockfile cache backend in Chromium, which is what desktop Chrome uses. Chrome on Android uses a different backend (the simple backend). See the design documents:

http://www.chromium.org/developers/design-documents/network-stack/disk-cache
http://www.chromium.org/developers/design-documents/network-stack/disk-cache/very-simple-backend

I noticed that the eviction algorithm for the blockfile backend doesn't begin until the application has been running for 10 minutes. I wonder if this means that it never runs on the device (assuming most users don't use an app continuously for more than 10 minutes and it gets killed by the lifecycle management whilst it's in the background).

Rather than fixing this, it might be worth investigating switching the backend to the simple backend. Ideally we would use the same backend on the device and desktop, so it should work well on the desktop too.

There are 2 consumers of the disk cache at the moment - the network cache (created in oxide::BrowserContextIOData::CreateMainRequestContext) and the application cache (created in content::AppCacheDiskCache::Init). For the latter, it looks like the build can define APPCACHE_USE_SIMPLE_CACHE to switch the backend.

We'd also need to make sure that the old cache is cleaned up on upgrade - that will probably require additional run-once code in Oxide

Related branches

Revision history for this message
Chris Coulson (chrisccoulson) wrote :

Actually, there are 3 consumers - there's the GPU shader cache too. But I'm going to just disable this (the Android Chrome WebView already does too). It doesn't work well if an application doesn't specify a data path - Chromium ends up just sticking the shader cache in the current working directory.

Changed in oxide:
importance: Undecided → High
status: New → Triaged
assignee: nobody → Olivier Tilloy (osomon)
Olivier Tilloy (osomon)
Changed in oxide:
status: Triaged → In Progress
Revision history for this message
Olivier Tilloy (osomon) wrote :

The blockfile backend actually doesn’t start trimming old entries until 5 minutes have passed (see kTrimDelay in src/net/disk_cache/blockfile/backend_impl.cc). Still, 5 minutes is a lot for mobile web apps, and they may never get a chance to clean up their cache and reclaim disk space.

In comparison, I can confirm that the simple backend doesn’t have this logic to delay eviction of old entries, so space is reclaimed right away (tested on desktop with the branch linked to this bug which enables the simple backend for oxide).

I haven’t benchmarked performance of the two backends. Given that chrome on android uses the simple backend, it should at least be suitable for mobile. It also seems to work well on desktop in my tests, I’ll push them a bit further.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Done for the network cache. I’m keeping the bug open to track a similar change for the application cache.

Olivier Tilloy (osomon)
Changed in oxide:
status: In Progress → Triaged
assignee: Olivier Tilloy (osomon) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.