Preferred Caching

September 12, 2012 8:06 am | 9 Comments

In Clearing Browser Data I mentioned Internet Explorer’s “Preserve Favorites website data” option. It first appeared in Internet Explorer 8’s Delete Browsing History dialog:

This is a great idea. I advocated this to all browser makers at Velocity 2009 under the name “preferred caching”. My anecdotal experience is that even though I visit a website regularly, its static resources aren’t always in my cache. This could be explained by the resources not having the proper caching headers, but I’ve seen this happen for websites that I know use far future expiration dates. The browser disk cache is shared across all websites, therefore one website with lots of big resources can push another website’s resources from cache. Even though I have preferred websites, there’s no way for me to guarantee their resources are given a higher priority when it comes to caching. And yet:

A key factor for getting web apps to perform like desktop and native apps is ensuring that their static content is immediately available on the client.

A web app (especially a mobile web app) can’t startup quickly if it has to download its images, scripts, and stylesheets over the Internet. It can’t even afford to do lightweight Conditional GET requests to verify resource freshness. A fast web app has to have all its static content stored locally, ready to be served as soon as the user needs it.

Application cache and localStorage are ways to solve this problem, but users only see the benefits if/when their preferred websites adopt these new(ish) technologies. And there’s no guarantee a favorite website will ever make the necessary changes. Application cache is hard to work with and has lots of gotchas. Some browser makers warn that localStorage is bad for performance.

The beauty of “Preserve Favorites website data” is that the user can opt in without having to wait for the website owner to get on board. This doesn’t solve all the problems: if a website starts using new resources then the user will have to undergo the delay of waiting for them to download. But at least the user knows that the unchanged resources for their preferred websites will always be loaded without having to incur network delays.

Let’s play with it

I found very little documentation on “Preserve Favorites website data”. Perhaps it’s self-explanatory, but I find that nothing works as expected when it comes to the Web. So I did a little testing. I used the Clear Browser test to explore what actually was and wasn’t cleared. The first step was to save https://stevesouders.com/ as a Favorite. I then ran the test withOUT selecting “Preserve Favorites website data” – everything was deleted as expected:

  • IE 8 & 9: cookies & disk cache ARE cleared (appcache isn’t supported; localStorage isn’t cleared likely due to a UI bug)
  • IE 10: cookies, disk cache, & appcache ARE cleared (localStorage isn’t cleared likely due to a UI bug)

Then I ran the test again but this time I DID select “Preserve Favorites website data” (which tells IE to NOT clear anything for stevesouders.com) and saw just one surprise for IE 10:

  • IE 8 & 9: cookies & disk cache ARE NOT cleared (correct)
  • IE 10: cookies & disk cache ARE NOT cleared (correct), but appcache IS cleared (unexpected)

Why would appcache get cleared for a Favorite site when “Preserve Favorites website data” is selected? That seems like a bug. Regardless, for more popular persistent data (cookies & disk cache) this setting leaves them in the cache allowing for a faster startup next time the user visits their preferred sites.

It’s likely to be a long time before we see other browsers adopt this feature. To figure out whether they should it’d be helpful to get your answers to these two questions:

  1. How many of you using Internet Explorer select “Preserve Favorites website data” when you clear your cache?
  2. For non-IE users, would you use this feature if it was available in your browser?

 

9 Responses to Preferred Caching

  1. I don’t use IE, but I would probably only use this setting if it were offered in mobile browsers. On a desktop or tablet used over wifi I’m not as concerned about speed – its mobile networks where I really notice an impact.

    Caveat: since most of my desktop usage is testing I generally have caching turned off completely by default, so I’m not really a good rep of that user set.

    Cheers,

  2. *Yes*, I’d use this. Jennifer is right though, if you have a very fast internet connection at home (e.g. 50 Mbps down/5Mbps up), it has less impact.

    For mobile browsers and on slower internet connections, the potential impact is *enormous*.

    P.S.: that’s one weird/tricky anti-spam question! :D

  3. I’m glad your into the cache subject!
    mI build various HTML apps and I find it very annoying that when I need to clear my cache I loose all settings… This is just plain wrong.

    Appcache and localStorage and plain old disk cache are very different things. Suppose you have a website and you want to clear your cache. Do you expect your wiki or CMS or board to be wiped out if content and reverted to plain vanilla settings? No. You expect fully replaceable data to be simply refreshed.

    And so first of all appcache should be replaced only on specific demand at least for favs. All bookmarked (especially those on main/dial screen) should be treated as apps that where installed in the browser. And you don’t want to reinstall apps when some other app is to big to fit in.

    There should be warnings on low app cache, different for low localStorage and so on. Users should be able to see how much space does their apps take and remove something if they want.

    Separating simple websites, favs and more or less in-browser apps should be crucial to browser makers.

  4. “Preserve Favorites website data” has caused a few problems for us. If someone has added the site of our application to their favorites, then javascript, for example cache will not be cleared and they are are running old code. After someone swears that they have cleared the cache several times, I make them look at the screen again, possibly showing them a screen shot with that box circled.

  5. The way that IE has implemented this feature seems bass akwards to me. Shouldn’t this instead be part of the cache clearing logic? If resource X has been requested from the cache 50 times, and resource Y has only been requested once, then if all other factors are the same (namely age) then clear resource Y.

    Regular people should never have to think about what a cache is, how to clear it, or why they would even want to do so.

  6. As a web app developer, I echo BrianK’s comments. The ‘Preserve’ checkbox is on by default in IE, and most people don’t know about it and don’t bother to un-check it. QA tells me they’ve cleared the cache, but they haven’t. You have those conversations a few times, then you send a note to everyone explaining how the darn thing works.

  7. Here’s what I don’t get. What in the world would any USER which is what your business is based on USERS want to fill his entire disk cache and his entire unused memory with web applications for. I for one think its the app developers and company’s that are paying their salaries that are causing all the problems people are endlessly complaining about with their online experience. They way HTML5 and all the rest of the crap you guys are trying to develop apps for really works is as a complete shutdown on a slight underpowered machine after the USER has hit up 4 or 5 websites that have loaded up the system resources with so much crap they wind up having to reboot the computer 15 times and clear all there cache storage every time they close their browser to get anything else to work. Me personally I have a nice little AMDx4 laptop with a 4250 RadeonHD card that I can do a pretty decent amount of gaming on and still after I hit up 10 or 15 pages of all those superduper HTML5/CSS5 websites I even gotta clean that thing out before I cant even load up a text editor to reconfigure my macros with new settings my freind told me about I just spent 30 mins trying to find. Lay off the fricking astonomical calculations, vector redering, and 64bit layering techniques on the fricking web guys yall are killing us AND our machines! If your web page does show up on your customers screen with 250 miliseconds of the request being sent most everytime somebody clicks your link you’re losing money. If the person never visists your webpage because they got frustrated trying to get it to load up after they just loaded 10 other guys pretty graffics, you are losing money. If your site pops up and gives the person what they need when they want it, you make money. Look at the homepage for Google.com. That thing pops up right now. not ten minutes from now with 40 pictures of dancing bunnies with fairy fire dancy in their foot steps. It comes up right now. When you leave that site your whole computer doesn’t freeze for 20 secs trying to unload all the lost pointers and memory leaks from code not working correctly and dumping all the 2000 objects the website dropped on you. Keep it simple maybe one almost cool graffic on the home page and save they web apps for the credit card info and ordering process or the driver sweep or the system configuration check or whater they might actually need to purchase one of your products. You will be happier, your QAs will be happier, your CUSTOMERS will love your site and that translates to your BOSS or CLIENT being happier. We all want that right?

  8. This reminds me of:
    http://www.mnot.net/blog/2011/08/28/better_browser_caching

    I.e., I’d like to see browsers’ cache replacement algorithms consider whole sites as “buckets”, to improve the chance of a cohesive experience when browsing an often-used site.

    Using information like favourites as a heuristic to the algorithm is helpful too, of course.

  9. I don’t use Internet Explorer. If it was available and working properly in Firefox or Chrome, I would use it.

    However, it would be more useful if I could select the 20 or so specific websites I use frequently rather than the hundreds of websites in my favourites. Perhaps a “never purge” checkbox in my favourites would be helpful.

    Another option is to be able to set a purging priority for each website, with a user-defined default priority for websites not listed.