Mobile cache file sizes

July 12, 2010 10:07 am | 8 Comments

Mobile is big, but knowledge about how to make a mobile web site fast is lacking. The state of mobile web performance is in a similar place as desktop was six years ago when I started my performance deep dive. How many of us are happy with the speed of web pages on mobile? (I’m not.) How many of us know the top 10 best practices for building high performance mobile web sites? (I don’t.)

I’ve been focusing more on mobile in order to help build this set of best practices. Browserscope is a valuable resource since it measures all browsers, both mobile and desktop. The Network category for popular mobile browsers shows information about max connections per hostname, parallel script loading, redirect caching, and more. Since Browserscope’s data is crowdsourced it’s easy to get coverage on a wide variety of mobile devices. The table below shows the results from Browserscope for some popular mobile devices.

One thing I’ve wanted to measure on mobile is the browser’s cache. Caching on mobile devices is a cause for concern. In my experience a page I visited just a few minutes ago doesn’t seem to be cached when I visit it again. A few months ago I started creating tests for measuring the browser’s cache.

That’s why I was especially excited to see Ryan Grove’s post on Mobile Browser Cache Limits. I noticed his results were quite different from mine, so I commented on his blog post and invited him to contact me. Which he did! It’s great to find someone to collaborate with, especially when designing tests like this where another pair of eyes is a big help.

Ryan and I created a new test design. He’s deployed his under the name cachetest on GitHub. My implementation is called Max Cache File Size. I’m hosting it so you can run it immediately. I’ve integrated it with Browserscope as a User Test. Anyone who runs my hosted version has the option to post their results (anonymously) to Browserscope and contribute to building a repository for script cache sizes for all browsers.

Here’s a link to the Max Cache File Size results on Browserscope. A summary of the results with some other findings follows:

Browser Max Cached
Script Size
Same Session
Cache Cross
Lock/Unlock
Cache Cross
Power Cycle
Android 2.1 4 MB yes yes
Android 2.2 2 MB yes yes
iPad 4 MB yes no
iPhone 3 4 MB yes no
iPhone 4 4 MB yes no
Palm Pre 1 MB yes yes

My Max Cache File Size test measures the largest script that’s cached in the same session (going from one page to another page). Many mobile devices reach the maximum size tested – 4MB. It’s interesting to see that in the recent upgrade from Android 2.1 to 2.2, the maximum cached script size drops from 4MB to 2MB. The Palm Pre registers at 320kB – much smaller than the others but large enough to handle many real world situations. Note that these sizes are the script’s uncompressed size.

Knowing the cache size that applies during a single session is valuable, but users often revisit pages after locking and unlocking their device, and some users might even power cycle their device between visits. Ryan and I manually tested a few devices under these scenarios – the results are shown in the previous table. Although results are mixed for the power cycling case, the cached items persist across lock/unlock. For me personally, this is the more typical case. (I only power cycle when I’m on the plane or need to reset the device.)

These results show that the 15 kB and 25 kB size limit warnings for a single resource are no longer a concern for mobile devices. However, even though the test went as high as 4 MB (uncompressed), I dearly hope you’re not even close to that size. (I saw similar results for stylesheets, but removed them from the automated test because stylesheets over ~1 MB cause problems on the iPhone.)

It’s great to have this data, and have it verified by different sources. But this is only testing the maximum size of a single script and stylesheet that can be cached. I believe the bigger issue for mobile is the maximum cache size. A few months ago I wrote a Call to improve browser caching. I wrote that in the context of desktop browsers, where I have visibility into the browser’s cache and available disk space. I think the size of mobile caches is even smaller. If you have information about the size of the browser cache on mobile devices, or tests to determine that, please share them in the comments below.

Finally, please run the Max Cache File Size test and add more data to the results.

Many thanks to Ryan Grove for working on this caching test – check out his updated post: Mobile Browser Cache Limits, Revisited. And thanks to Lindsey Simon for making Browserscope such a great framework for crowdsourcing browser performance data.

8 Responses to Mobile cache file sizes

  1. Nice post. Seems like there is only one browser that does link pre-fetching.

    Pre-fetching data opportunistically (through faster/cheaper networks aka WiFi) could yield a big performance improvement for mobile browsing. There is also the advantage of using less cellular data and thus reducing operator costs as well as avoiding slower wireless links.

  2. I tried the test on my BlackBerry Bold 9700 (running the 5.0 OS), and I get a “HTTP Error 413: Request Entity Too Large” when I click “Run the Test.” Can you put a smaller initial size? I think the BlackBerry may have a 128k limit for a request.

  3. I also tried Opera Mini 5 on both my BlackBerry Bold 9700 and iPod Touch (running iOS 4). Both stalled out on the page where “2048 kB WAS read from cache” and “Automatically testing 4096 kB…”, so neither could post results back. Not sure if the test could timeout on a page to allow reporting back to browserscope?

  4. Hi Steve.
    Can you update your post with the link to the test via url shortener (like bit.ly), otherwise it’s really painful to type full url on mobile :)

  5. Sent results from iPad, Nokia E90 native browser and Opera Mobile from Nokia E90 :)

  6. Great review, this is a concern that involves every smart phone users. Technically speaking, almost all of us.

  7. Abhinav,

    Link prefetching is a great idea, until the moment that the browser pre-fetches the “click here to complete purchase” link that you didn’t want to click.

  8. I ran some tests concerning mobile cacheability.
    I noticed that Iphone has only a memory cache which is cleared frequently. Others devices (Android 1.5 and >, WP7, Bada 1.0 &1.2, BB6) seems to well cached ressources even if cache size is small.
    You can find results here : http://www.winktoolkit.org/blog/204/