New issue
Advanced search Search tips

Issue 893318 link

Starred by 2 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Task



Sign in to add a comment

Consider increasing WebView cache size

Project Member Reported by torne@chromium.org, Oct 8

Issue description

WebView's disk cache is currently hardcoded to 20MB - we should consider increasing it since that's pretty small on modern devices and has led to problems like issue 890973.

Some things to think:

1) There are new APIs on O (see https://developer.android.com/reference/android/os/storage/StorageManager#getCacheQuotaBytes(java.util.UUID) for example) which provide suggestions for apps on how much cache space they can use, sized dynamically according to how often the app is used. We could roll out a UMA metric to see what values this has in the wild, and if it's typically much larger than 20MB, we could consider setting WebView's cache on O+ to some percentage of the app's total allowed cache size. We'd probably want to make sure the minimum size was still 20MB to avoid reducing it unexpectedly for any existing apps.

2) Does Chrome already have a UMA metric for available disk space? That might be interesting to check if so, to see whether that might be helpful to decide on a cache size dynamically for pre-O versions that don't have the quota APIs (though we could just leave it as-is there, also).
 
I know we have SimpleCache.Http.MaxCacheSizeOnInit which has clear spikes caused by PreferredCacheSizeInternal(). We can see that for 1.58% of chrome starts there is less than 8 MiB of free space. For 25% of users the amount of free space is less than 800 MiB. And so on. Reversing this function is not my favorite activity, but it can be done :)
Maybe Chrome should also be using those new APIs on O :)
Project Member

Comment 3 by bugdroid1@chromium.org, Dec 3

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4a0206d93d9ff03f88e0c6f98f12d1a490eb5109

commit 4a0206d93d9ff03f88e0c6f98f12d1a490eb5109
Author: Nate Fischer <ntfschr@chromium.org>
Date: Mon Dec 03 20:18:13 2018

AW: refactor cache size into a getter method.

No change to behavior, this only moves the value into a getter method
for both code paths.

This moves the cache size to a centrally-determined spot, since we may
want to create more complex logic for the value we set.

R=changwan@chromium.org

Bug: 893318,887538
Test: None
Change-Id: I0e22928bc37a247f165e3913b1e7007fa0d7a1f3
Reviewed-on: https://chromium-review.googlesource.com/c/1357331
Reviewed-by: Changwan Ryu <changwan@chromium.org>
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#613212}
[modify] https://crrev.com/4a0206d93d9ff03f88e0c6f98f12d1a490eb5109/android_webview/browser/aw_content_browser_client.cc
[modify] https://crrev.com/4a0206d93d9ff03f88e0c6f98f12d1a490eb5109/android_webview/browser/net/aw_url_request_context_getter.cc
[modify] https://crrev.com/4a0206d93d9ff03f88e0c6f98f12d1a490eb5109/android_webview/browser/net_helpers.cc
[modify] https://crrev.com/4a0206d93d9ff03f88e0c6f98f12d1a490eb5109/android_webview/browser/net_helpers.h

Sign in to add a comment