summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 23:52:40 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-11 23:52:40 +0000
commit8df3407d293c6895ed8f95ad85c29bbef23443a5 (patch)
tree5fe723e790f74b0095ef519230c8aab31772a733 /net
parentfcc21e89ce697257c2d64debe116c2df77ac7e6a (diff)
downloadchromium_src-8df3407d293c6895ed8f95ad85c29bbef23443a5.zip
chromium_src-8df3407d293c6895ed8f95ad85c29bbef23443a5.tar.gz
chromium_src-8df3407d293c6895ed8f95ad85c29bbef23443a5.tar.bz2
Disk Cache: Lower the definition of a loaded system from
10 pending operations to 5. Data from the Beta channel shows that for all group sizes except one, the 99.90% cutoff of number of pending operations falls below 5 (in fact, below 3). BUG=none TEST=none Review URL: http://codereview.chromium.org/164355 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/disk_cache/backend_impl.cc10
-rw-r--r--net/disk_cache/backend_impl.h13
-rw-r--r--net/disk_cache/stress_cache.cc11
3 files changed, 19 insertions, 15 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 506ab22..5af790f 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -797,7 +797,10 @@ void BackendImpl::TooMuchStorageRequested(int32 size) {
bool BackendImpl::IsLoaded() const {
CACHE_UMA(COUNTS, "PendingIO", GetSizeGroup(), num_pending_io_);
- return num_pending_io_ > 10;
+ if (user_flags_ & kNoLoadProtection)
+ return false;
+
+ return num_pending_io_ > 5;
}
std::string BackendImpl::HistogramName(const char* name, int experiment) const {
@@ -1589,10 +1592,7 @@ bool BackendImpl::CheckIndex() {
AdjustMaxCacheSize(data_->header.table_len);
- // We need to avoid integer overflows.
- DCHECK(max_size_ < kint32max - kint32max / 10);
- if (data_->header.num_bytes < 0 ||
- data_->header.num_bytes > max_size_ + max_size_ / 10) {
+ if (data_->header.num_bytes < 0) {
LOG(ERROR) << "Invalid cache (current) size";
return false;
}
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 242c0c5..a2dd0c6 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -19,12 +19,13 @@
namespace disk_cache {
enum BackendFlags {
- kMask = 1,
- kMaxSize = 1 << 1,
- kUnitTestMode = 1 << 2,
- kUpgradeMode = 1 << 3,
- kNewEviction = 1 << 4,
- kNoRandom = 1 << 5
+ kMask = 1, // A mask (for the index table) was specified.
+ kMaxSize = 1 << 1, // A maximum size was provided.
+ kUnitTestMode = 1 << 2, // We are modifying the behavior for testing.
+ kUpgradeMode = 1 << 3, // This is the upgrade tool (dump).
+ kNewEviction = 1 << 4, // Use of new eviction was specified.
+ kNoRandom = 1 << 5, // Don't add randomness to the behavior.
+ kNoLoadProtection = 1 << 6 // Don't act conservatively under load.
};
// This class implements the Backend interface. An object of this
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index b2b60e4..7b5912c 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -25,6 +25,7 @@
#include "base/string_util.h"
#include "base/thread.h"
#include "net/base/io_buffer.h"
+#include "net/disk_cache/backend_impl.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/disk_cache_test_util.h"
@@ -77,10 +78,11 @@ void StressTheCache(int iteration) {
int cache_size = 0x800000; // 8MB
std::wstring path = GetCachePath();
path.append(L"_stress");
- disk_cache::Backend* cache = disk_cache::CreateCacheBackend(path, false,
- cache_size,
- net::DISK_CACHE);
- if (NULL == cache) {
+ disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(path);
+ cache->SetFlags(disk_cache::kNoLoadProtection | disk_cache::kNoRandom);
+ cache->SetMaxSize(cache_size);
+ cache->SetType(net::DISK_CACHE);
+ if (!cache->Init()) {
printf("Unable to initialize cache.\n");
return;
}
@@ -123,6 +125,7 @@ void StressTheCache(int iteration) {
if (!(i % 100))
printf("Entries: %d \r", i);
+ MessageLoop::current()->RunAllPending();
}
}