Fwd: Proposal : Making Local Storage quota value configurable

49 views
Skip to first unread message

santosh mahto

unread,
Oct 15, 2015, 12:16:21 AM10/15/15
to stora...@chromium.org

Hi chromium-dev, blink-dev

In chromium the value of local storage quota per origin is hard coded to 10 *1024 * 1024 (10MB)
               const size_t kPerStorageAreaQuota = 10 * 1024 * 1024; 

In our case(low end device)  we want to limit the quota per origin due to storage limitation to avoid overflow.
So I would like to make it configurable ( either by content api or comamnd line arg) if agreed upon.

So I  would like to know view upon this proposal.


Michael Nordman

unread,
Oct 15, 2015, 8:26:40 PM10/15/15
to santosh mahto, stora...@chromium.org
It's already smallish, you want to make it smaller? What did you have in mind, a flag to set it down to 5M from 10M per origin? 

I think there is blink/content api to selectively allow/disallow access to localstorage for a particular origin (WebContentSettingsClient::allowStorage()). Chrome has that wired up to the it's CookieSetting:: IsSettingCookieAllowed. Would allowing all but a select few work for you?

Logic to evict stale unused data might hlep. Coalescing the <n> sqlite databases into a single leveldb could get rid of some overhead too, each empty localstorge db takes around 3K bytes. Would a cap on total available for use system wide make sense for your use case?  These would be larger changes though.


Santosh

unread,
Oct 16, 2015, 12:01:45 AM10/16/15
to storage-dev, santosh...@gmail.com, mich...@chromium.org
The idea here is to make quota per origin value configurable, I mean we can set value using command line arg or may be using some content API.
What my concern is with 10M/5M, its not hard to  overflow the disk(use http://www.filldisk.com/) space in DESKTOP even. So low end devices could
be very easy target where these scenario are not guaranteed to be gracefully handled. 

If it could be set using command line/ content Api to some value( decided based on device storage capacity) then we can provide protection & stability to 
low end device to large extent.

I can provide the patch  if agreement happens on this.

Michael Nordman

unread,
Oct 16, 2015, 9:28:36 PM10/16/15
to Santosh, storage-dev, santosh mahto
So the use case is general purpose web browser on a device with limited resources. How much storage is on the device? I don't think changing the limit from 10 to 5 really solves the problem. Limits based on eTLD might be a better way to address the filldisk.com issue specifically. With proactive eviction of lru data, we could put a configurable upper bound on how much space is used for localStorage in aggregate.

Chris Palmer

unread,
Oct 19, 2015, 12:50:19 PM10/19/15
to mich...@chromium.org, Santosh, storage-dev, santosh mahto
On Fri, Oct 16, 2015 at 6:28 PM, Michael Nordman <mich...@chromium.org> wrote:

So the use case is general purpose web browser on a device with limited resources. How much storage is on the device? I don't think changing the limit from 10 to 5 really solves the problem. Limits based on eTLD might be a better way to address the filldisk.com issue specifically. With proactive eviction of lru data, we could put a configurable upper bound on how much space is used for localStorage in aggregate.

I agree with michaeln.

Santosh

unread,
Nov 23, 2015, 4:22:43 AM11/23/15
to storage-dev, mich...@chromium.org, sam...@cisco.com, santosh...@gmail.com
I  was planning to implement local storage parameter configurable and also handle the lightweight LRU cleanup. 
I could see some issue related to disk overflow, So I need to know that if any work has been done in this area or not.
And it would be great if I would be prior informed of any design decision, policy, etc.

As an Implementation I am going by  overriding LocalStorageDatabaseAdapter  to create new database adapter which will take care of  validation and cleanup. XXLocalStorageDatabaseAdapter will keep track of current usage by db files.
I will upon design doc for review once ready.

Thanks
santosh

Michael Nordman

unread,
Nov 25, 2015, 5:08:56 PM11/25/15
to Santosh, storage-dev, santosh mahto
Hi Santosh,

If you're interested in contributing code, great!

Nothing's actively going on that you don't see in the tree or in CLs under review. I'm not sure I follow the reasoning behind putting this logic in the 'adapter' class, that class is pure shimware and is lacking knowlege of more than one origin's data?

> And it would be great if I would be prior informed of any design decision, policy, etc.

One thing to be mindful of is the latent desire to replace the backing store for local storage. Currently, each origin's data is kept in a separate sqlite db. The latent desire is...
1) to consolidate the multitude of dbs into one (more space efficient)
2) to switch from sqlite to leveldb (to reduce our dependency of that lib)
... making it more like session storage which uses a single leveldb per storage partition.

Logic to prune based on dates and storage pressure should be agnostic with regard to the backing store. So heads up... the LocalStrorageAdapter class might not be the best place for it since that class sole purpose in life is to abstract away the differences between local vs session storage backends.
Reply all
Reply to author
Forward
0 new messages