Reviewers: Nicolas Zea,
Message:
Please sanity check, I picked all of these numbers semi-arbitrarily.
Description:
Raise the throttling limits of the storage API.
The per-hour limit is now 3600, allowing 1 write operation per second over
an
extended period of time. To provide protection against short-term flooding,
add
a new per-minute limit of 300 (5 per second).
BUG=406406
R=
z...@chromium.org
Please review this at
https://codereview.chromium.org/702303002/
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Affected files (+17, -9 lines):
M extensions/browser/api/storage/storage_api.cc
M extensions/common/api/storage.json
Index: extensions/browser/api/storage/storage_api.cc
diff --git a/extensions/browser/api/storage/storage_api.cc
b/extensions/browser/api/storage/storage_api.cc
index
5e984bc8f95362c6034de5f8bd265264cf2c79c1..38c8e7181ac47b48fb7146eb5d3fb3a441aba76a
100644
--- a/extensions/browser/api/storage/storage_api.cc
+++ b/extensions/browser/api/storage/storage_api.cc
@@ -149,14 +149,18 @@ std::vector<std::string> GetKeys(const
base::DictionaryValue& dict) {
// Creates quota heuristics for settings modification.
void GetModificationQuotaLimitHeuristics(QuotaLimitHeuristics* heuristics)
{
- QuotaLimitHeuristic::Config longLimitConfig = {
- // See storage.json for current value.
- core_api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR,
- base::TimeDelta::FromHours(1)
- };
+ // See storage.json for the current value of these limits.
+ QuotaLimitHeuristic::Config short_limit_config = {
+ core_api::storage::sync::MAX_WRITE_OPERATIONS_PER_MINUTE,
+ base::TimeDelta::FromMinutes(1)};
+ QuotaLimitHeuristic::Config long_limit_config = {
+ core_api::storage::sync::MAX_WRITE_OPERATIONS_PER_HOUR,
+ base::TimeDelta::FromHours(1)};
+ heuristics->push_back(new QuotaService::TimedLimit(
+ short_limit_config, new QuotaLimitHeuristic::SingletonBucketMapper(),
+ "MAX_WRITE_OPERATIONS_PER_MINUTE"));
heuristics->push_back(new QuotaService::TimedLimit(
- longLimitConfig,
- new QuotaLimitHeuristic::SingletonBucketMapper(),
+ long_limit_config, new QuotaLimitHeuristic::SingletonBucketMapper(),
"MAX_WRITE_OPERATIONS_PER_HOUR"));
};
Index: extensions/common/api/storage.json
diff --git a/extensions/common/api/storage.json
b/extensions/common/api/storage.json
index
34e789c349a90e3d7ef058dc05854bbb82451cf6..14ecc6c62c3ba96bc5be98de35e6ea87d2c96e2a
100644
--- a/extensions/common/api/storage.json
+++ b/extensions/common/api/storage.json
@@ -189,8 +189,12 @@
"description": "The maximum number of items that can be stored
in sync storage. Updates that would cause this limit to be exceeded will
fail immediately and set $(ref:runtime.lastError)."
},
"MAX_WRITE_OPERATIONS_PER_HOUR": {
- "value": 1000,
- "description": "The maximum number of <code>set</code>,
<code>remove</code>, or <code>clear</code> operations that can be performed
each hour. Updates that would cause this limit to be exceeded fail
immediately and set $(ref:runtime.lastError)."
+ "value": 3600,
+ "description": "<p>The maximum number of <code>set</code>,
<code>remove</code>, or <code>clear</code> operations that can be performed
each hour. This is 1 per second, a lower ceiling than the short term higher
writes-per-minute limit.</p><p>Updates that would cause this limit to be
exceeded fail immediately and set $(ref:runtime.lastError).</p>"
+ },
+ "MAX_WRITE_OPERATIONS_PER_MINUTE": {
+ "value": 300,
+ "description": "<p>The maximum number of <code>set</code>,
<code>remove</code>, or <code>clear</code> operations that can be performed
each minute. This is 5 per second, providing higher throughput than
writes-per-hour over a shorter period of time.</p><p>Updates that would
cause this limit to be exceeded fail immediately and set
$(ref:runtime.lastError).</p>"
},
"MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE": {
"value": 1000000,