Firefox is getting a new cache back-end

Martin Brinkmann
Jul 10, 2013
Firefox
|
8

The majority of web browsers use a cache, usually located on the hard drive, that is used to store files that are downloaded when connections to websites and services are made. The idea behind the cache is to speed up the loading time of consecutive visits to the page or domain by loading resources from the local hard drive if they have not changed in the meantime.

That is great for static contents like a website's logo, the CSS style sheet and even some page elements that do not change when you switch to another location on the site.

Two Firefox engineers have been working on a new cache back-end for the Firefox web browser for the last two months. The project goals were to make it resilient against crashes and kills of the Firefox process, and to get rid of any user interface freezes or hangs that are caching related.

A blog post highlights the progress the team made over the past two months. What is clear is that it made good progress with initial tests showing performance improvements under most tested cases but not all.

A non-scientific test displayed on the blog shows that the new back-end reduces the full load and first paint time in three of the four cases on a microSD card that was used for testing, and in no case on Solid State Drives. While this may sound disappointing to some, it merely means that the engineers have to find ways around those limitations.

Testing with a microSD card:

First-visit load
Full load First paint
mozilla-central 16s 7s
new back-end 12s 4.5s
new back-end and separate threads for open/read/write 10.5s 3.5s
Reload, already cached and warmed
Full load First paint
mozilla-central 7s 700ms
new back-end 5.5s 500ms
new back-end and separate thread for open/read/write 5.5s 500ms
Type URL and go, cached and warmed
Full load First paint
mozilla-central 900ms 900ms
new back-end 400ms 400ms
Type URL and go, cached but not warmed
Full load First paint
mozilla-central 5s 4.5s
new back-end ~28s 5-28s
new back-end and separate threads for open/read/write *) ~26s 5-26s

Testing on an SSD disk:

Type URL and go, cached and warmed
Full load First paint
mozilla-central 220ms 230ms
new back-end 310ms 320ms
Type URL and go, cached but not warmed
Full load First paint
mozilla-central 600ms 600ms
new back-end 1100ms 1100ms

The first visit load time was for instance reduced by 4 seconds on the microSD card test, a reload by 1.5 seconds and the loading of the url from the browser's address bar dropped from 900ms to 400ms in the test if it was cached and warmed before.

The test highlights some issues though, especially in regards to Solid State Drives which were quick to load but not as quick as the current cache implementation.

What may be interesting to users who work on systems with slow storage is that the new UI eliminates all freeze or hang symptoms that may be experienced currently on those systems.

The goal however is to improve the loading and painting time for all usage cases.

A test build for all supported operating systems has been posted on the blog as well. You can use the build in conjunction with about:timeline to get detailed information about page loading times and such. Note that you need special builds of Firefox to use the extension.

Closing Words

This is definitely something that will improve the user experience further once it has been optimized in a way that it is offering benefits to all users regardless of storage device they use for the cache.

Advertisement

Tutorials & Tips


Previous Post: «
Next Post: «

Comments

  1. Honza Bambas said on September 9, 2013 at 4:25 pm
    Reply

    Hi all, I’ve just found this post in reaction to my article on the new HTTP cache for Firefox.

    To make few things clear:
    – I want to confirm that we are solving all UI hangs and freezes caused by the current HTTP cache, it is very significantly felt when testing with a slow microSD card on an otherwise very fast machine
    – we are not removing memory cache, it is still there, as it was before, just the memory management is now different (smarter, hopefully), see http://www.janbambas.cz/new-firefox-http-cache-backend-story-continues/#comment-1803:

    “My “memory cache” approach is different. I decided that it would be good to have a pool of stuff that is used often kept in memory to prevent frequent reload from disk. This pool can be understood as a “write-back cache” for the disk cache as well as a pool to keep data we don’t want to persist. Disk, memory and private cached content all share this one pool’s quota. When this quota is overreached less used and oldest content is purged from this memory pool to free up resources.”

    – there is an improvement on slow drives, but ssd and alike seems to be affected (in a positive way) as well ; we definitely plan on improvements, although not in the first stage but rather incrementally, see the vol 2. post on the new cache at http://www.janbambas.cz/new-firefox-http-cache-backend-story-continues/ and the result tables

    Cheers,
    Honza Bambas

    1. Martin Brinkmann said on September 9, 2013 at 5:14 pm
      Reply

      Honza, thanks for leaving a comment. I’m really looking forward to this and will monitor the progress you are making to see how beneficial it will be in the end.

  2. Cattleya said on July 11, 2013 at 3:00 am
    Reply

    But what I don’t like is: “Consider eliminating memory cache. ”
    https://wiki.mozilla.org/Necko/Cache/Plans#Primary_Design_Goals

    They want to remove this feature: about:config -> browser.cache.memory.enable ?

    Not good at all, I’m currently set browser.cache.disk.enable to false to disable disk cache and force Firefox use RAM cache, this reduce disk read/write times and make page load faster, I don’t want to use RAMDisk just to force Firefox use RAM cache :(

  3. Kneyfield said on July 11, 2013 at 1:35 am
    Reply

    “the new UI eliminates all freeze or hang symptoms”

    YES!!! This has been one of my major annoyances and it got me to use Opera as my main browser in the past. After their Opera 15 debacle I’m back using Firefox as my default again and this is the best news ever. I don’t even care about some slower access times in the ms range when the upside is that huge!

  4. Marc said on July 10, 2013 at 5:27 pm
    Reply

    Finally!!

    1. Marc said on July 10, 2013 at 5:42 pm
      Reply

      Should it be expected a greater performance improvement in non SSD drives or in drives alike?

      1. Martin Brinkmann said on July 10, 2013 at 5:55 pm
        Reply

        Well, currently you get better performance on slow drives most of the time. It is however likely that improvements will be made before it gets deployed

  5. Compuitguy said on July 10, 2013 at 3:36 pm
    Reply

    a great thing about this is that it will solve this bug

    Cache lost if Mozilla crashes
    https://bugzilla.mozilla.org/show_bug.cgi?id=105843

    which got my vote a long time ago

    and knew from the bug page that it will be solved

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.