Open
Bug 1144175
Opened 10 years ago
Updated 2 years ago
Cache could implement back pressure when streaming Fetch pipe data to disk
Categories
(Core :: Storage: Cache API, defect, P3)
Core
Storage: Cache API
Tracking
()
NEW
People
(Reporter: bkelly, Unassigned)
References
Details
Bug 1110814 is implementing a simple push mechanism for streaming piped data from Fetch() over to the parent process. Right now there is no back-pressure mechanism. I think this is fine for most cases, but we might want to implement back-pressure in the future. The problem case I am considering is:
1) On a memory constrained firefox OS device with slow flash storage.
2) Run Cache.put('dvd.iso', fetch('dvd.iso')) on a fast local network. dvd.iso is quite large.
3) The network loads dvd.iso faster than we can write to disk.
4) Because we have no back pressure dvd.iso ends up being buffered in the parent process.
5) Parent process OOMs rebooting the device.
My idea for addressing this is a "soft" window mechanism:
a) Wrap the pipe reader stream on the parent side so CachePushStreamParent knows how much data has been read and when reads occur.
b) Combine this with how much is written in the parent to understand current size of pipe.
c) When pipe size exceeds a limit X, then send a message to child process to pause reading.
d) Buffers sent while "paused" are still written to pipe since we don't have a synchronous way to stop them from being sent while the pause message is in flight.
e) When enough is read from the pipe to drop below limit Y, then send a message to resume reading in the Child.
So the parent memory buffer would likely exceed limit X, but we could stop it from being unbounded until OOM.
Obviously not suggesting we do this now. Its something to consider later once we have better usage data for Cache.
Updated•6 years ago
|
Priority: -- → P3
Assignee | ||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
Updated•5 years ago
|
Component: DOM: Core & HTML → Storage: Cache API
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•