<https://bugzilla.mozilla.org/show_bug.cgi?id=569709#c37>
Please read that, and feel free to express what you think. I'm going
to hold off on backing anything out unless someone comes up with a
good justification on why we should do that.
--
Ehsan
<http://ehsanakhgari.org/>
The cache which we ship as part of Firefox 3.6 can store a maximum of
8192 entries, which means that it takes 128KB of memory (at 16 bytes
per entry) to store the disk cache entry map in memory.
With my patch landed, we have bumped the maximum entry count to
256000, which means that it takes 4000KB of memory to store the disk
cache entry map in memory.
But not all users have to pay that cost starting at today's nightly.
The way that the code works is that when you first start the browser
with an empty cache, only 512 entries are allocated. When you need to
store the 513th entry, we make the available entries buffer two times
bigger, and you will pay more memory cost as your cache grows in
entries.
Speaking of the benefit that this brings to our users, based on a
study which I performed in
<https://bugzilla.mozilla.org/show_bug.cgi?id=569709#c11> (which is
not perfect or representative of any real use case by any means, but
was the best I could come up with), on average a website stores 697KB
of cached items in our disk cache. This means that on Firefox 3.6,
our cache is by default only big enough to store about 73 full
websites, but now it can handle five times that many.
And also, the 8192 maximum entry count limit would mean that in
practice, for many users, we didn't even use out 50MB capacity,
because we could run out of allowed entry counts way before the 50MB
cache would be filled.
--
Ehsan
<http://ehsanakhgari.org/>
> With my patch landed, we have bumped the maximum entry count to
> 256000, which means that it takes 4000KB of memory to store the disk
> cache entry map in memory.
At first glance, that seems like a lot of overhead to me. It would be
nice to know how that compares to data structures with similar
capabilities (maybe something in JS or jemalloc, but doesn't have to be
in Mozilla).
Justin
Specifically, it's 16 bytes per entry. So 4 words. It's noticeable
overhead, sure, but doesn't seem gigantic, necessarily...
-Boris
Also compare keeping 16 bytes in memory, compared to downloading a
network resource from the other side of the world because we purged it
from the cache.
Though we should look at if it makes sense to look at if we can improve
things. Byron Milligan is looking at this and many other cache related
things this summer.
/ Jonas
> Though we should look at if it makes sense to look at if we can improve things. Byron Milligan is looking at this and many other cache related things this summer.
That's awesome! Is there a wiki page holding a list of things into which he is looking?
cheers,
mike
It's still very early in this project so we don't even have a plan
beyond "we need to measure!". Once plans formulate I'll make sure they
end up in wiki format.
/ Jonas