diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-19 18:47:41 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-19 18:47:41 +0000 |
commit | 06768c2f67ae0353981851c6f6af29df85747b75 (patch) | |
tree | 3edc51f88c03fe463d5d49d7ba75d2e9d1b956e8 /chrome | |
parent | 2e39d2ebf7e388595bd7fe17d99e30e8a35a43fc (diff) | |
download | chromium_src-06768c2f67ae0353981851c6f6af29df85747b75.zip chromium_src-06768c2f67ae0353981851c6f6af29df85747b75.tar.gz chromium_src-06768c2f67ae0353981851c6f6af29df85747b75.tar.bz2 |
Update the table of RAM vs number of renderers
- revised my guesstimate of 25 MB per renderer to 40MB, which I think is more appropiate for long lived tabs, since short lived tabs don't really matter here.
- the lower end (< 1GB) has less total renderers
- the middle has about the same
- the upper end (> 2GB) has more renderers
- added test to open 34 tabs.
Review URL: http://codereview.chromium.org/21484
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_uitest.cc | 30 | ||||
-rw-r--r-- | chrome/browser/renderer_host/render_process_host.cc | 25 | ||||
-rw-r--r-- | chrome/common/chrome_constants.cc | 4 |
3 files changed, 52 insertions, 7 deletions
diff --git a/chrome/browser/browser_uitest.cc b/chrome/browser/browser_uitest.cc index 5096923..efaaa45 100644 --- a/chrome/browser/browser_uitest.cc +++ b/chrome/browser/browser_uitest.cc @@ -4,6 +4,7 @@ #include "base/file_util.h" #include "base/string_util.h" +#include "base/sys_info.h" #include "base/values.h" #include "chrome/app/chrome_dll_resource.h" #include "chrome/common/chrome_constants.h" @@ -85,6 +86,35 @@ TEST_F(BrowserTest, Title) { EXPECT_EQ(test_title, GetActiveTabTitle()); } +// Create 34 tabs and verify that a lot of processes have been created. The +// exact number of processes depends on the amount of memory. Previously we +// had a hard limit of 31 processes and this test is mainly directed at +// verifying that we don't crash when we pass this limit. +TEST_F(BrowserTest, ThirtyFourTabs) { + std::wstring test_file = test_data_directory_; + file_util::AppendToPath(&test_file, L"title2.html"); + GURL url(net::FilePathToFileURL(test_file)); + scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); + // There is one initial tab. + for (int ix = 0; ix != 33; ++ix) { + EXPECT_TRUE(window->AppendTab(url)); + } + int tab_count = 0; + EXPECT_TRUE(window->GetTabCount(&tab_count)); + EXPECT_EQ(34, tab_count); + // Do not test the rest in single process mode. + if (in_process_renderer()) + return; + // See browser\renderer_host\render_process_host.cc for the algorithm to + // decide how many processes to create. + int process_count = GetBrowserProcessCount(); + if (base::SysInfo::AmountOfPhysicalMemoryMB() >= 2048) { + EXPECT_GE(process_count, 24); + } else { + EXPECT_LE(process_count, 22); + } +} + // The browser should quit quickly if it receives a WM_ENDSESSION message. TEST_F(BrowserTest, WindowsSessionEnd) { std::wstring test_file = test_data_directory_; diff --git a/chrome/browser/renderer_host/render_process_host.cc b/chrome/browser/renderer_host/render_process_host.cc index 7a9ede0..ad44ac8 100644 --- a/chrome/browser/renderer_host/render_process_host.cc +++ b/chrome/browser/renderer_host/render_process_host.cc @@ -16,12 +16,27 @@ unsigned int GetMaxRendererProcessCount() { // amount of installed memory as reported by the OS. The table // values are calculated by assuming that you want the renderers to // use half of the installed ram and assuming that each tab uses - // ~25MB. + // ~40MB, however the curve is not linear but piecewise linear with + // interleaved slopes of 3 and 2. + // If you modify this table you need to adjust browser\browser_uitest.cc + // to match the expected number of processes. + static const int kMaxRenderersByRamTier[] = { - 4, // less than 256MB - 8, // 256MB - 12, // 512MB - 16, // 768MB + 3, // less than 256MB + 6, // 256MB + 9, // 512MB + 12, // 768MB + 14, // 1024MB + 18, // 1280MB + 20, // 1536MB + 22, // 1792MB + 24, // 2048MB + 26, // 2304MB + 29, // 2560MB + 32, // 2816MB + 35, // 3072MB + 38, // 3328MB + 40 // 3584MB }; static unsigned int max_count = 0; diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc index 494d3b0..9432915 100644 --- a/chrome/common/chrome_constants.cc +++ b/chrome/common/chrome_constants.cc @@ -46,8 +46,8 @@ const FilePath::CharType kHistoryBookmarksFileName[] = FPL("Bookmarks From History"); const wchar_t kCustomDictionaryFileName[] = L"Custom Dictionary.txt"; -// Note, this shouldn't go above 64. See bug 535234. -const unsigned int kMaxRendererProcessCount = 20; +// This number used to be limited to 32 in the past (see b/535234). +const unsigned int kMaxRendererProcessCount = 42; const int kStatsMaxThreads = 32; const int kStatsMaxCounters = 300; |