Bug 1457084 - Increase max chunk memory usage limit, r=mayhemer
authorMichal Novotny <michal.novotny>
Wed, 23 May 2018 05:03:00 +0300
changeset 419617 10f52bc1b0a47a7f0ca708d0f78e2b4d03e438c6
parent 419616 b6657c5618f0c1ad287f8448301ba6131a795c15
child 419618 7b99c5f0b05eae19a93699766a957ee658fb6856
push id103564
push userapavel@mozilla.com
push dateWed, 23 May 2018 22:36:24 +0000
treeherdermozilla-inbound@10f52bc1b0a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1457084
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457084 - Increase max chunk memory usage limit, r=mayhemer We can hit the limit very easily when writing javascript bytecode as alternative data to the cache entry because all data is written at once but CacheFileOutputStream splits it into chunks which are then written on a backgound thread. 40MB was chosen because bytecode is usually 4x-10x larger than the original data, so it can occupy most of the cache entry which is limited to 50MB.
modules/libpref/init/all.js
netwerk/cache2/CacheObserver.cpp
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -57,18 +57,18 @@ pref("browser.cache.memory.max_entry_siz
 // Memory limit (in kB) for new cache data not yet written to disk. Writes to
 // the cache are buffered and written to disk on background with low priority.
 // With a slow persistent storage these buffers may grow when data is coming
 // fast from the network. When the amount of unwritten data is exceeded, new
 // writes will simply fail. We have two buckets, one for important data
 // (priority) like html, css, fonts and js, and one for other data like images,
 // video, etc.
 // Note: 0 means no limit.
-pref("browser.cache.disk.max_chunks_memory_usage", 10240);
-pref("browser.cache.disk.max_priority_chunks_memory_usage", 10240);
+pref("browser.cache.disk.max_chunks_memory_usage", 40960);
+pref("browser.cache.disk.max_priority_chunks_memory_usage", 40960);
 
 pref("browser.cache.disk_cache_ssl",        true);
 // 0 = once-per-session, 1 = each-time, 2 = never, 3 = when-appropriate/automatically
 pref("browser.cache.check_doc_frequency",   3);
 // Limit of recent metadata we keep in memory for faster access, in Kb
 pref("browser.cache.disk.metadata_memory_limit", 250); // 0.25 MB
 // The number of chunks we preload ahead of read.  One chunk has currently 256kB.
 pref("browser.cache.disk.preload_chunk_count", 4); // 1 MB of read ahead
--- a/netwerk/cache2/CacheObserver.cpp
+++ b/netwerk/cache2/CacheObserver.cpp
@@ -57,20 +57,20 @@ static uint32_t const kDefaultPreloadChu
 uint32_t CacheObserver::sPreloadChunkCount = kDefaultPreloadChunkCount;
 
 static int32_t const kDefaultMaxMemoryEntrySize = 4 * 1024; // 4 MB
 int32_t CacheObserver::sMaxMemoryEntrySize = kDefaultMaxMemoryEntrySize;
 
 static int32_t const kDefaultMaxDiskEntrySize = 50 * 1024; // 50 MB
 int32_t CacheObserver::sMaxDiskEntrySize = kDefaultMaxDiskEntrySize;
 
-static uint32_t const kDefaultMaxDiskChunksMemoryUsage = 10 * 1024; // 10MB
+static uint32_t const kDefaultMaxDiskChunksMemoryUsage = 40 * 1024; // 40MB
 uint32_t CacheObserver::sMaxDiskChunksMemoryUsage = kDefaultMaxDiskChunksMemoryUsage;
 
-static uint32_t const kDefaultMaxDiskPriorityChunksMemoryUsage = 10 * 1024; // 10MB
+static uint32_t const kDefaultMaxDiskPriorityChunksMemoryUsage = 40 * 1024; // 40MB
 uint32_t CacheObserver::sMaxDiskPriorityChunksMemoryUsage = kDefaultMaxDiskPriorityChunksMemoryUsage;
 
 static uint32_t const kDefaultCompressionLevel = 1;
 uint32_t CacheObserver::sCompressionLevel = kDefaultCompressionLevel;
 
 static bool kDefaultSanitizeOnShutdown = false;
 bool CacheObserver::sSanitizeOnShutdown = kDefaultSanitizeOnShutdown;