summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 18:39:08 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-20 18:39:08 +0000
commit510e854f122deaedd5ba31af188105131a4c3b7d (patch)
tree03e6cbdeafa6529ab491fb85f05f6955ba713a70
parent8f1915d7a94456f029a25abdc64f9a5f6bdd1711 (diff)
downloadchromium_src-510e854f122deaedd5ba31af188105131a4c3b7d.zip
chromium_src-510e854f122deaedd5ba31af188105131a4c3b7d.tar.gz
chromium_src-510e854f122deaedd5ba31af188105131a4c3b7d.tar.bz2
Add a FieldTrial and histograms for measuring impact of http prioritization.
Currently this FieldTrial is measuring the transaction latencies of requests, separated into frame/subframe requests vs subresource requests. We run a 2% holdback experiment where the people in the holdback don't have http prioritization enabled. Add class static method to ResourceDispatcherHost to disable http prioritization. BUG=10486 Review URL: http://codereview.chromium.org/67119 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14040 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/field_trial.h2
-rw-r--r--chrome/browser/browser_main.cc9
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc44
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.h10
-rw-r--r--net/http/http_network_transaction.cc28
5 files changed, 69 insertions, 24 deletions
diff --git a/base/field_trial.h b/base/field_trial.h
index 3d922d1..4d04d30 100644
--- a/base/field_trial.h
+++ b/base/field_trial.h
@@ -13,7 +13,7 @@
// pseudo-randomly selected).
//
// States are typically generated randomly, either based on a one time
-// randomization (generated randomly once, and then persitently reused in the
+// randomization (generated randomly once, and then persistently reused in the
// client during each future run of the program), or by a startup randomization
// (generated each time the application starts up, but held constant during the
// duration of the process), or by continuous randomization across a run (where
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 9e9d656..83422e6 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -478,6 +478,15 @@ int BrowserMain(const MainFunctionParams& parameters) {
net::HttpNetworkSession::set_max_sockets_per_group(4);
}
+ scoped_refptr<FieldTrial> http_prioritization_trial =
+ new FieldTrial("HttpPrioritization", 100);
+ // Put 10% of people in the fallback experiment with the http prioritization
+ // code disabled.
+ const int holdback_group =
+ http_prioritization_trial->AppendGroup("_no_http_prioritization", 10);
+ if (http_prioritization_trial->group() == holdback_group) {
+ ResourceDispatcherHost::DisableHttpPrioritization();
+ }
#if defined(OS_WIN)
// Init common control sex.
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index db852b4..a4cd3ba 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -68,17 +68,7 @@ using base::TimeTicks;
// ----------------------------------------------------------------------------
-// The interval for calls to ResourceDispatcherHost::UpdateLoadStates
-static const int kUpdateLoadStatesIntervalMsec = 100;
-
-// Maximum number of pending data messages sent to the renderer at any
-// given time for a given request.
-static const int kMaxPendingDataMessages = 20;
-
-// Maximum byte "cost" of all the outstanding requests for a renderer.
-// See delcaration of |max_outstanding_requests_cost_per_process_| for details.
-// This bound is 25MB, which allows for around 6000 outstanding requests.
-static const int kMaxOutstandingRequestsCostPerProcess = 26214400;
+bool ResourceDispatcherHost::g_is_http_prioritization_enabled = true;
// A ShutdownTask proxies a shutdown task from the UI thread to the IO thread.
// It should be constructed on the UI thread and run in the IO thread.
@@ -97,6 +87,18 @@ class ResourceDispatcherHost::ShutdownTask : public Task {
namespace {
+// The interval for calls to ResourceDispatcherHost::UpdateLoadStates
+const int kUpdateLoadStatesIntervalMsec = 100;
+
+// Maximum number of pending data messages sent to the renderer at any
+// given time for a given request.
+const int kMaxPendingDataMessages = 20;
+
+// Maximum byte "cost" of all the outstanding requests for a renderer.
+// See delcaration of |max_outstanding_requests_cost_per_process_| for details.
+// This bound is 25MB, which allows for around 6000 outstanding requests.
+const int kMaxOutstandingRequestsCostPerProcess = 26214400;
+
// Consults the RendererSecurity policy to determine whether the
// ResourceDispatcherHost should service this request. A request might be
// disallowed if the renderer is not authorized to restrive the request URL or
@@ -340,16 +342,16 @@ void ResourceDispatcherHost::BeginRequest(
request->set_context(context);
request->set_origin_pid(request_data.origin_pid);
- // If the request is for the top level page or a frame/iframe, then we should
- // prioritize it higher than other resource types. Currently, we just use
- // priorities 1 and 0.
- // TODO(willchan): Revisit the actual priorities when looking at considering
- // boosting priorities for requests for the foreground tab.
- if (request_data.resource_type == ResourceType::MAIN_FRAME ||
- request_data.resource_type == ResourceType::SUB_FRAME) {
- request->set_priority(1);
- } else {
- request->set_priority(0);
+ if (IsHttpPrioritizationEnabled()) {
+ // If the request is for the top level page or a frame/iframe, then we
+ // should prioritize it higher than other resource types. Currently, we
+ // just use priorities 1 and 0.
+ if (request_data.resource_type == ResourceType::MAIN_FRAME ||
+ request_data.resource_type == ResourceType::SUB_FRAME) {
+ request->set_priority(1);
+ } else {
+ request->set_priority(0);
+ }
}
// Set upload data.
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index ba699bc..fd6e06c 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -370,6 +370,14 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
return false;
}
+ static void DisableHttpPrioritization() {
+ g_is_http_prioritization_enabled = false;
+ }
+
+ static bool IsHttpPrioritizationEnabled() {
+ return g_is_http_prioritization_enabled;
+ }
+
private:
FRIEND_TEST(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies);
FRIEND_TEST(ResourceDispatcherHostTest,
@@ -556,6 +564,8 @@ class ResourceDispatcherHost : public URLRequest::Delegate {
// to the source of the message.
Receiver* receiver_;
+ static bool g_is_http_prioritization_enabled;
+
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHost);
};
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 1065729..654eb6a 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -977,10 +977,34 @@ void HttpNetworkTransaction::LogTCPConnectionMetrics() const {
void HttpNetworkTransaction::LogTransactionConnectedMetrics() const {
base::TimeDelta total_duration = response_.response_time - start_time_;
- UMA_HISTOGRAM_CLIPPED_TIMES(FieldTrial::MakeName(
- "Net.Transaction_Connected_Under_10", "DnsImpact").data(), total_duration,
+ UMA_HISTOGRAM_CLIPPED_TIMES(
+ FieldTrial::MakeName(
+ "Net.Transaction_Connected_Under_10",
+ "DnsImpact").data(),
+ total_duration,
base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
100);
+
+ // Currently, non-zero priority requests are frame or sub-frame resource
+ // types. This will change when we also prioritize certain subresources like
+ // css, js, etc.
+ if (request_->priority) {
+ UMA_HISTOGRAM_CLIPPED_TIMES(
+ FieldTrial::MakeName(
+ "Net.Priority_High_Latency",
+ "HttpPrioritization").data(),
+ total_duration,
+ base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
+ 100);
+ } else {
+ UMA_HISTOGRAM_CLIPPED_TIMES(
+ FieldTrial::MakeName(
+ "Net.Priority_Low_Latency",
+ "HttpPrioritization").data(),
+ total_duration,
+ base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(10),
+ 100);
+ }
}
void HttpNetworkTransaction::LogTransactionMetrics() const {