Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(417)

Issue 896643002: [DOMStorage] Rate limiting writes to disk. (Closed)

Created:
5 years, 10 months ago by michaeln
Modified:
5 years, 10 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[DOMStorage] Rate limiting writes to disk. Given access patterns that are just wrong, local & session storage can write many gigabytes per day or keep the disk perpetually spun up. To avoid excessive IO, we apply limits to the amount of data being written and the frequency of writes to address both kinds of 'bad' behaviors. TBR=rvargas BUG=176727 Committed: https://crrev.com/770daec923bb61392afbf9ca16ee0dad147e154f Cr-Commit-Position: refs/heads/master@{#317424}

Patch Set 1 #

Total comments: 16

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : adjust purging logic #

Patch Set 7 : added tests, switched to floats #

Patch Set 8 : uma histogram for commit delay #

Patch Set 9 : defer commits during startup #

Patch Set 10 : switched to UMA_HISTOGRAM_LONG_TIMES #

Total comments: 6

Patch Set 11 : massaged to use IsBrowserStartingUp() #

Patch Set 12 : refactored to add an isolated PostCommitTask() #

Patch Set 13 : UMA counts of LocalStorage.CommitDeferredDuringStartup #

Total comments: 7

Patch Set 14 : #

Patch Set 15 : code review comments #

Total comments: 14

Patch Set 16 : compute process uptime #

Patch Set 17 : review comments #

Patch Set 18 : TimeDelta.multiply_by(dbl) #

Total comments: 1

Patch Set 19 : #

Patch Set 20 : backed out IsBrowserStartingUp for now #

Total comments: 2

Patch Set 21 : #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+245 lines, -48 lines) Patch
M base/time/time.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +8 lines, -0 lines 6 comments Download
M base/time/time_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +9 lines, -0 lines 0 comments Download
M content/browser/dom_storage/dom_storage_area.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 chunks +38 lines, -0 lines 0 comments Download
M content/browser/dom_storage/dom_storage_area.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 10 chunks +93 lines, -32 lines 0 comments Download
M content/browser/dom_storage/dom_storage_area_unittest.cc View 1 2 3 4 5 6 1 chunk +47 lines, -0 lines 0 comments Download
M content/browser/dom_storage/dom_storage_namespace.cc View 1 2 3 4 5 2 chunks +12 lines, -5 lines 0 comments Download
M content/common/dom_storage/dom_storage_map.h View 1 chunk +2 lines, -0 lines 0 comments Download
M content/common/dom_storage/dom_storage_map.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +10 lines, -11 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 7 chunks +26 lines, -0 lines 0 comments Download

Messages

Total messages: 42 (6 generated)
michaeln
need to add some tests still
5 years, 10 months ago (2015-02-03 00:24:16 UTC) #2
cmumford
You should run "git cl format" and then "git cl lint". https://codereview.chromium.org/896643002/diff/1/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): ...
5 years, 10 months ago (2015-02-03 00:45:25 UTC) #3
cmumford
On 2015/02/03 00:45:25, cmumford wrote: > You should run "git cl format" and then "git ...
5 years, 10 months ago (2015-02-03 16:35:40 UTC) #4
michaeln
still haven't written any tests but fixed up the style and switched to using base::TimeTicks ...
5 years, 10 months ago (2015-02-03 19:59:15 UTC) #5
cmumford
Looking good - just waiting for the tests... https://codereview.chromium.org/896643002/diff/1/content/browser/dom_storage/dom_storage_area.h File content/browser/dom_storage/dom_storage_area.h (right): https://codereview.chromium.org/896643002/diff/1/content/browser/dom_storage/dom_storage_area.h#newcode119 content/browser/dom_storage/dom_storage_area.h:119: base::TimeDelta ...
5 years, 10 months ago (2015-02-04 18:43:54 UTC) #6
michaeln
Snapshot 6 alters logic around purging to treat areas with uncommitted changes differently. Before any ...
5 years, 10 months ago (2015-02-04 21:43:11 UTC) #7
michaeln
ptal
5 years, 10 months ago (2015-02-11 03:15:07 UTC) #8
cmumford
https://codereview.chromium.org/896643002/diff/180001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): https://codereview.chromium.org/896643002/diff/180001/content/browser/dom_storage/dom_storage_area.cc#newcode33 content/browser/dom_storage/dom_storage_area.cc:33: static const int kCommitDefaultDelay = 5; What is best ...
5 years, 10 months ago (2015-02-11 22:52:27 UTC) #9
michaeln
i'm going to massage it a little to rely on bool IsStartupComplete() like we talked ...
5 years, 10 months ago (2015-02-11 23:30:28 UTC) #10
michaeln
ptal > i'm going to massage it a little to rely on bool IsStartupComplete() like ...
5 years, 10 months ago (2015-02-12 00:26:20 UTC) #11
cmumford
lgtm
5 years, 10 months ago (2015-02-12 21:58:04 UTC) #12
cmumford
https://codereview.chromium.org/896643002/diff/240001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): https://codereview.chromium.org/896643002/diff/240001/content/browser/dom_storage/dom_storage_area.cc#newcode419 content/browser/dom_storage/dom_storage_area.cc:419: UMA_HISTOGRAM_BOOLEAN("LocalStorage.CommitDeferredDuringStartup", true); Do you want to do this, or ...
5 years, 10 months ago (2015-02-12 22:21:53 UTC) #14
michaeln
@alexei, ptal at the histograms
5 years, 10 months ago (2015-02-12 22:30:26 UTC) #16
Alexei Svitkine (slow)
https://codereview.chromium.org/896643002/diff/240001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): https://codereview.chromium.org/896643002/diff/240001/content/browser/dom_storage/dom_storage_area.cc#newcode419 content/browser/dom_storage/dom_storage_area.cc:419: UMA_HISTOGRAM_BOOLEAN("LocalStorage.CommitDeferredDuringStartup", true); On 2015/02/12 22:21:53, cmumford wrote: > Do ...
5 years, 10 months ago (2015-02-13 16:02:35 UTC) #17
michaeln
https://codereview.chromium.org/896643002/diff/240001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): https://codereview.chromium.org/896643002/diff/240001/content/browser/dom_storage/dom_storage_area.cc#newcode419 content/browser/dom_storage/dom_storage_area.cc:419: UMA_HISTOGRAM_BOOLEAN("LocalStorage.CommitDeferredDuringStartup", true); On 2015/02/13 16:02:35, Alexei Svitkine wrote: > ...
5 years, 10 months ago (2015-02-14 00:24:45 UTC) #18
Alexei Svitkine (slow)
https://codereview.chromium.org/896643002/diff/280001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): https://codereview.chromium.org/896643002/diff/280001/content/browser/dom_storage/dom_storage_area.cc#newcode33 content/browser/dom_storage/dom_storage_area.cc:33: static const int kCommitDefaultDelaySecs = 5; Nit: Move these ...
5 years, 10 months ago (2015-02-17 01:05:20 UTC) #19
michaeln
https://codereview.chromium.org/896643002/diff/280001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): https://codereview.chromium.org/896643002/diff/280001/content/browser/dom_storage/dom_storage_area.cc#newcode47 content/browser/dom_storage/dom_storage_area.cc:47: bool IsBrowserStartingUp() { On 2015/02/17 01:05:20, Alexei Svitkine wrote: ...
5 years, 10 months ago (2015-02-17 19:36:51 UTC) #20
michaeln
ptal i'm looking into adding floating pt operators to TimeDelta seperately https://codereview.chromium.org/896643002/diff/280001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): ...
5 years, 10 months ago (2015-02-19 01:19:20 UTC) #21
michaeln
https://codereview.chromium.org/896643002/diff/280001/content/browser/dom_storage/dom_storage_area.cc File content/browser/dom_storage/dom_storage_area.cc (right): https://codereview.chromium.org/896643002/diff/280001/content/browser/dom_storage/dom_storage_area.cc#newcode47 content/browser/dom_storage/dom_storage_area.cc:47: bool IsBrowserStartingUp() { On 2015/02/17 19:36:51, michaeln wrote: > ...
5 years, 10 months ago (2015-02-19 01:20:03 UTC) #22
michaeln
https://codereview.chromium.org/896643002/diff/340001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/896643002/diff/340001/base/time/time.h#newcode182 base/time/time.h:182: TimeDelta multiply_by(double a) const { Done adding an operator*(dbl) ...
5 years, 10 months ago (2015-02-19 02:04:39 UTC) #23
michaeln
I have a couple unittests to take a look at. DOMStorageAreaTest.BackingDatabaseOpened DOMStorageAreaTest.DeleteOrigin
5 years, 10 months ago (2015-02-19 04:01:52 UTC) #24
michaeln
ptal I'm backing out the explicit delay during startup part of this CL and will ...
5 years, 10 months ago (2015-02-20 01:23:47 UTC) #25
Alexei Svitkine (slow)
LGTM % comments https://codereview.chromium.org/896643002/diff/380001/content/browser/dom_storage/dom_storage_area.h File content/browser/dom_storage/dom_storage_area.h (right): https://codereview.chromium.org/896643002/diff/380001/content/browser/dom_storage/dom_storage_area.h#newcode125 content/browser/dom_storage/dom_storage_area.h:125: }; nit: DISALLOW_COPY_AND_ASSIGN https://codereview.chromium.org/896643002/diff/380001/content/browser/dom_storage/dom_storage_area.h#newcode170 content/browser/dom_storage/dom_storage_area.h:170: }; ...
5 years, 10 months ago (2015-02-20 15:01:37 UTC) #26
michaeln
@rvargas, ptal a base/time.h
5 years, 10 months ago (2015-02-20 19:41:34 UTC) #28
cmumford
lgtm
5 years, 10 months ago (2015-02-20 19:50:42 UTC) #30
michaeln
@rvargas, tbr'ing you about the small additions to base/time.h
5 years, 10 months ago (2015-02-20 21:17:16 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896643002/400001
5 years, 10 months ago (2015-02-20 21:18:22 UTC) #33
rvargas (doing something else)
https://codereview.chromium.org/896643002/diff/400001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/896643002/diff/400001/base/time/time.h#newcode161 base/time/time.h:161: // Computations with ints, note that we only allow ...
5 years, 10 months ago (2015-02-20 21:49:43 UTC) #34
michaeln
https://codereview.chromium.org/896643002/diff/400001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/896643002/diff/400001/base/time/time.h#newcode161 base/time/time.h:161: // Computations with ints, note that we only allow ...
5 years, 10 months ago (2015-02-20 22:18:04 UTC) #35
commit-bot: I haz the power
Committed patchset #21 (id:400001)
5 years, 10 months ago (2015-02-20 22:22:46 UTC) #36
commit-bot: I haz the power
Patchset 21 (id:??) landed as https://crrev.com/770daec923bb61392afbf9ca16ee0dad147e154f Cr-Commit-Position: refs/heads/master@{#317424}
5 years, 10 months ago (2015-02-20 22:23:37 UTC) #37
michaeln
> i initially tried it with operators but adding an operator*(dbl) makes usages > with ...
5 years, 10 months ago (2015-02-20 22:31:38 UTC) #38
rvargas (doing something else)
https://codereview.chromium.org/896643002/diff/400001/base/time/time.h File base/time/time.h (right): https://codereview.chromium.org/896643002/diff/400001/base/time/time.h#newcode161 base/time/time.h:161: // Computations with ints, note that we only allow ...
5 years, 10 months ago (2015-02-20 22:44:56 UTC) #39
rvargas (doing something else)
On 2015/02/20 22:31:38, michaeln wrote: > > i initially tried it with operators but adding ...
5 years, 10 months ago (2015-02-20 22:51:36 UTC) #40
michaeln
On 2015/02/20 22:44:56, rvargas wrote: > https://codereview.chromium.org/896643002/diff/400001/base/time/time.h > File base/time/time.h (right): > > https://codereview.chromium.org/896643002/diff/400001/base/time/time.h#newcode161 > ...
5 years, 10 months ago (2015-02-20 23:06:06 UTC) #41
michaeln
5 years, 10 months ago (2015-02-20 23:56:55 UTC) #42
Message was sent while issue was closed.
> > hmmm, how about 
> >   template<typename T>
> >   TimeDelta operator*(T a) const {
> >     return TimeDelta(delta_ * a);
> >   }
> > 
> > It extends the allowed types, but in practice we are saying that we are ok
> with
> > things that the compiler can multiply with delta_, no?
> 
> I'll give that a try!

see https://codereview.chromium.org/945143002/

Powered by Google App Engine
This is Rietveld 408576698