Closed Bug 547842 Opened 14 years ago Closed 8 years ago

Out of process network cache

Categories

(Core :: Networking: Cache, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: taras.mozilla, Unassigned)

Details

I was watching a presentation on Transcendent Memory(http://oss.oracle.com/projects/tmem/) and I realized that their trick may be beneficial to Mozilla.
 
I propose putting our network, image, etc caches into a separate process. Whenever something needs a cached item, it can COPY it out of that process. Since nothing directly refers to memory in the cache process, this allows us to safely kill the process to quickly free up RAM in OOM situations.
The point of the image cache is to very quickly get the decoded data, and share it with all other consumers of that data (because the data is big).  Would copying it work reasonably in terms of that?

For the network cache, this might be reasonable.

Note that I'd expect evicting the entire image cache to already be pretty doable in OOM cases.  Not sure about necko's memory cache.
(In reply to comment #1)
> The point of the image cache is to very quickly get the decoded data, and share
> it with all other consumers of that data (because the data is big).  Would
> copying it work reasonably in terms of that?

I hope so. Chris Jones suggested adding the image cache and even moving image decoding into this process.

> 
> For the network cache, this might be reasonable.
> 
> Note that I'd expect evicting the entire image cache to already be pretty
> doable in OOM cases.  Not sure about necko's memory cache.

The problem with having large caches within the main address space is that free()ing the data is likely to not return the freed memory back to the OS due to malloc() fragmentation. That's the primary motivation behind moving cache into own process.
But having an out-of-process cache that doesn't actually share memory across multiple users of the same cache entry means that your memory usage ends up a lot higher to start with, right?
(In reply to comment #3)
> But having an out-of-process cache that doesn't actually share memory across
> multiple users of the same cache entry means that your memory usage ends up a
> lot higher to start with, right?

I'm not sure that it would be significantly higher. Are we currently planning to share bitmaps(or other significant chunks of memory) between processes? If so one could still share items that are in use outside of the cache process.
Copying from another process would be alright for the image cache in terms of speed, I suspect, but would double our memory usage.

I had no particular plans to share the image cache between processes, mostly because I don't expect most sites share images, and I do expect us to segment processes roughly by site.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.