Browser cache size decision

1,496 views
Skip to first unread message

Michael

unread,
Apr 7, 2011, 6:59:30 PM4/7/11
to Chromium-discuss
I am wondering the reason for the browser cache size. Nowadays the
disk size and memory size is huge. Current browsers use 20-80MB as the
size for the disk cache size (data from here:
http://www.stevesouders.com/blog/2010/04/26/call-to-improve-browser-caching/)
Is there any rationale behind the choice of the cache size?

This is also related to mobile browsers. The default cache size is
much smaller on smartphones. (6MB for Froyo. This number is from
Android Froyo source code, path: FROYO/frameworks/base/core/java/
android/webkit/CacheManager.java, "private static long CACHE_THRESHOLD
= 6 * 1024 * 1024;") 6MB is really small comparing to current flash
memory storage 8/16G. Is there any reason for the default browser
cache size on smartphones?

Torne (Richard Coles)

unread,
Apr 8, 2011, 5:40:15 AM4/8/11
to wangz...@gmail.com, Chromium-discuss
On 7 April 2011 23:59, Michael <wangz...@gmail.com> wrote:
> I am wondering the reason for the browser cache size. Nowadays the
> disk size and memory size is huge. Current browsers use 20-80MB as the
> size for the disk cache size (data from here:
> http://www.stevesouders.com/blog/2010/04/26/call-to-improve-browser-caching/)
> Is there any rationale behind the choice of the cache size?

Your data is from a blog post that's a year old; the last comment
there links to a much more recent discussion of how Chrome caches at
http://gent.ilcore.com/2011/02/chromes-10-caches.html - the cache is
much bigger now.

> This is also related to mobile browsers. The default cache size is
> much smaller on smartphones. (6MB for Froyo. This number is from
> Android Froyo source code, path: FROYO/frameworks/base/core/java/
> android/webkit/CacheManager.java, "private static long CACHE_THRESHOLD
> = 6 * 1024 * 1024;") 6MB is really small comparing to current flash
> memory storage 8/16G. Is there any reason for the default browser
> cache size on smartphones?

This is the wrong place to ask about the Android browser, which is not
Chromium-based.

--
Torne (Richard Coles)
to...@google.com

Michael

unread,
Apr 8, 2011, 5:21:23 PM4/8/11
to Chromium-discuss
Thanks for the pointer!

I have 2 further question:
1. How do the disk cache and memory cache work together and
communicate with each other (if there is any)? There is a disk-cache
document (http://dev.chromium.org/developers/design-documents/network-
stack/disk-cache), but it seems not to mention the relation with
memory cache.

2. what's the decision rationale behind those cache size number?

I took a look at the source codes and list the numbers and source
files below in case someone else has similar questions.
1. The max disk cache size allowed seems close to 2GB.
in http://src.chromium.org/viewvc/chrome/trunk/src/net/disk_cache/backend_impl.cc::SetMaxSize(int
max_bytes)
if (max_bytes >= kint32max - kint32max / 10)
max_bytes = kint32max - kint32max / 10 - 1;

kint32max is defined as (( int32) 0x7FFFFFFF) in base/basictypes.h

2. default max disk cache size is 300+MB. Using "chrome://net-
internals/httpcache", the default max disk cache size is
335544320Bytes

3. memory cache is limited to 32MB (per process as mentioned in Tony's
blog).
The original default cache capacity is set to 8MB.
(http://src.chromium.org/viewvc/chrome/trunk/src/third_party/WebKit/
WebCore/loader/cache/MemoryCache.cpp)
If the memory is larger than 1GB, the capacity will be adjusted to
32MB.
else if the memory is larger than 512MB, the capacity will be adjusted
to 16MB.
else the capacity remains 8MB
(http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/
renderer_host/web_cache_manager.cc)


On Apr 8, 4:40 am, "Torne (Richard Coles)" <to...@google.com> wrote:
> On 7 April 2011 23:59, Michael <wangzhen...@gmail.com> wrote:
>
> > I am wondering the reason for the browser cache size. Nowadays the
> > disk size and memory size is huge. Current browsers use 20-80MB as the
> > size for the disk cache size (data from here:
> >http://www.stevesouders.com/blog/2010/04/26/call-to-improve-browser-c...)
> > Is there any rationale behind the choice of the cache size?
>
> Your data is from a blog post that's a year old; the last comment
> there links to a much more recent discussion of how Chrome caches athttp://gent.ilcore.com/2011/02/chromes-10-caches.html- the cache is
Reply all
Reply to author
Forward
0 new messages