summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-26 16:06:50 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-26 16:06:50 +0000
commit3d4bce0e7fcff552f51dabd1a00317a97505c3af (patch)
treedc57c5cd418c70487d9a05131f009f33fe69688c /net
parent94b15f517b37214097f2e447f1197abfd19bd048 (diff)
downloadchromium_src-3d4bce0e7fcff552f51dabd1a00317a97505c3af.zip
chromium_src-3d4bce0e7fcff552f51dabd1a00317a97505c3af.tar.gz
chromium_src-3d4bce0e7fcff552f51dabd1a00317a97505c3af.tar.bz2
QUIC - Persist 1000 MRU alternate protocols to preferences file.
+ Flip a coin and if we have persisted 1000 MRU servers, then load only either 200 or 1000 servers from disk. + Persist only one server (or don't duplicate server names) that spoke QUIC for canonical suffixes like: + .c.youtube.com + .googlevideo.com + Bumped up the version number of http_server_properties. + Added two histograms to measure the impact of persisting 1000 alternate protocol servers. ++ Net.AlternateProtocolUsage.200Truncated ++ Net.AlternateProtocolUsage.1000Truncated R=jar@chromium.org, rch@chromium.org Review URL: https://codereview.chromium.org/298683010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272836 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/http/http_server_properties.cc13
-rw-r--r--net/http/http_server_properties.h21
-rw-r--r--net/http/http_server_properties_impl.cc28
-rw-r--r--net/http/http_server_properties_impl.h11
-rw-r--r--net/http/http_server_properties_impl_unittest.cc4
-rw-r--r--net/http/http_stream_factory_impl.cc4
-rw-r--r--net/http/http_stream_factory_impl_job.cc17
7 files changed, 90 insertions, 8 deletions
diff --git a/net/http/http_server_properties.cc b/net/http/http_server_properties.cc
index 72b47c1..19b334c 100644
--- a/net/http/http_server_properties.cc
+++ b/net/http/http_server_properties.cc
@@ -31,9 +31,20 @@ COMPILE_ASSERT(
} // namespace
-void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage) {
+void HistogramAlternateProtocolUsage(
+ AlternateProtocolUsage usage,
+ AlternateProtocolExperiment alternate_protocol_experiment) {
UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage", usage,
ALTERNATE_PROTOCOL_USAGE_MAX);
+ if (alternate_protocol_experiment ==
+ ALTERNATE_PROTOCOL_TRUNCATED_200_SERVERS) {
+ UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage.200Truncated", usage,
+ ALTERNATE_PROTOCOL_USAGE_MAX);
+ } else if (alternate_protocol_experiment ==
+ ALTERNATE_PROTOCOL_TRUNCATED_1000_SERVERS) {
+ UMA_HISTOGRAM_ENUMERATION("Net.AlternateProtocolUsage.1000Truncated", usage,
+ ALTERNATE_PROTOCOL_USAGE_MAX);
+ }
}
void HistogramBrokenAlternateProtocolLocation(
diff --git a/net/http/http_server_properties.h b/net/http/http_server_properties.h
index d3108d6..b76fd96 100644
--- a/net/http/http_server_properties.h
+++ b/net/http/http_server_properties.h
@@ -19,6 +19,15 @@
namespace net {
+enum AlternateProtocolExperiment {
+ // 200 alternate_protocol servers are loaded (persisted 200 MRU servers).
+ ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT = 0,
+ // 200 alternate_protocol servers are loaded (persisted 1000 MRU servers).
+ ALTERNATE_PROTOCOL_TRUNCATED_200_SERVERS,
+ // 1000 alternate_protocol servers are loaded (persisted 1000 MRU servers).
+ ALTERNATE_PROTOCOL_TRUNCATED_1000_SERVERS,
+};
+
enum AlternateProtocolUsage {
// Alternate Protocol was used without racing a normal connection.
ALTERNATE_PROTOCOL_USAGE_NO_RACE = 0,
@@ -36,8 +45,10 @@ enum AlternateProtocolUsage {
ALTERNATE_PROTOCOL_USAGE_MAX,
};
-// Log a histogram to reflect |usage|.
-NET_EXPORT void HistogramAlternateProtocolUsage(AlternateProtocolUsage usage);
+// Log a histogram to reflect |usage| and |alternate_protocol_experiment|.
+NET_EXPORT void HistogramAlternateProtocolUsage(
+ AlternateProtocolUsage usage,
+ AlternateProtocolExperiment alternate_protocol_experiment);
enum BrokenAlternateProtocolLocation {
BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB = 0,
@@ -159,6 +170,12 @@ class NET_EXPORT HttpServerProperties {
// Returns all Alternate-Protocol mappings.
virtual const AlternateProtocolMap& alternate_protocol_map() const = 0;
+ virtual void SetAlternateProtocolExperiment(
+ AlternateProtocolExperiment experiment) = 0;
+
+ virtual AlternateProtocolExperiment GetAlternateProtocolExperiment()
+ const = 0;
+
// Gets a reference to the SettingsMap stored for a host.
// If no settings are stored, returns an empty SettingsMap.
virtual const SettingsMap& GetSpdySettings(
diff --git a/net/http/http_server_properties_impl.cc b/net/http/http_server_properties_impl.cc
index 5177188..bd7de2f 100644
--- a/net/http/http_server_properties_impl.cc
+++ b/net/http/http_server_properties_impl.cc
@@ -29,6 +29,8 @@ const uint64 kBrokenAlternateProtocolDelaySecs = 300;
HttpServerPropertiesImpl::HttpServerPropertiesImpl()
: spdy_servers_map_(SpdyServerHostPortMap::NO_AUTO_EVICT),
alternate_protocol_map_(AlternateProtocolMap::NO_AUTO_EVICT),
+ alternate_protocol_experiment_(
+ ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT),
spdy_settings_map_(SpdySettingsMap::NO_AUTO_EVICT),
pipeline_capability_map_(
new CachedPipelineCapabilityMap(kDefaultNumHostsToRemember)),
@@ -220,6 +222,19 @@ bool HttpServerPropertiesImpl::HasAlternateProtocol(
return GetCanonicalHost(server) != canonical_host_to_origin_map_.end();
}
+std::string HttpServerPropertiesImpl::GetCanonicalSuffix(
+ const HostPortPair& server) {
+ // If this host ends with a canonical suffix, then return the canonical
+ // suffix.
+ for (size_t i = 0; i < canoncial_suffixes_.size(); ++i) {
+ std::string canonical_suffix = canoncial_suffixes_[i];
+ if (EndsWith(server.host(), canoncial_suffixes_[i], false)) {
+ return canonical_suffix;
+ }
+ }
+ return std::string();
+}
+
PortAlternateProtocolPair
HttpServerPropertiesImpl::GetAlternateProtocol(
const HostPortPair& server) {
@@ -275,7 +290,8 @@ void HttpServerPropertiesImpl::SetAlternateProtocol(
// TODO(rch): Consider the case where multiple requests are started
// before the first completes. In this case, only one of the jobs
// would reach this code, whereas all of them should should have.
- HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING);
+ HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_MAPPING_MISSING,
+ alternate_protocol_experiment_);
}
alternate_protocol_map_.Put(server, alternate);
@@ -340,6 +356,16 @@ HttpServerPropertiesImpl::alternate_protocol_map() const {
return alternate_protocol_map_;
}
+void HttpServerPropertiesImpl::SetAlternateProtocolExperiment(
+ AlternateProtocolExperiment experiment) {
+ alternate_protocol_experiment_ = experiment;
+}
+
+AlternateProtocolExperiment
+HttpServerPropertiesImpl::GetAlternateProtocolExperiment() const {
+ return alternate_protocol_experiment_;
+}
+
const SettingsMap& HttpServerPropertiesImpl::GetSpdySettings(
const HostPortPair& host_port_pair) {
SpdySettingsMap::iterator it = spdy_settings_map_.Get(host_port_pair);
diff --git a/net/http/http_server_properties_impl.h b/net/http/http_server_properties_impl.h
index 13af9a9..8c635f4 100644
--- a/net/http/http_server_properties_impl.h
+++ b/net/http/http_server_properties_impl.h
@@ -65,6 +65,10 @@ class NET_EXPORT HttpServerPropertiesImpl
static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair);
static void DisableForcedAlternateProtocol();
+ // Returns the canonical host suffix for |server|, or std::string() if none
+ // exists.
+ std::string GetCanonicalSuffix(const net::HostPortPair& server);
+
// Changes the number of host/port pairs we remember pipelining capability
// for. A larger number means we're more likely to be able to pipeline
// immediately if a host is known good, but uses more memory. This function
@@ -118,6 +122,12 @@ class NET_EXPORT HttpServerPropertiesImpl
// Returns all Alternate-Protocol mappings.
virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE;
+ virtual void SetAlternateProtocolExperiment(
+ AlternateProtocolExperiment experiment) OVERRIDE;
+
+ virtual AlternateProtocolExperiment GetAlternateProtocolExperiment()
+ const OVERRIDE;
+
// Gets a reference to the SettingsMap stored for a host.
// If no settings are stored, returns an empty SettingsMap.
virtual const SettingsMap& GetSpdySettings(
@@ -187,6 +197,7 @@ class NET_EXPORT HttpServerPropertiesImpl
AlternateProtocolMap alternate_protocol_map_;
BrokenAlternateProtocolList broken_alternate_protocol_list_;
BrokenAlternateProtocolMap broken_alternate_protocol_map_;
+ AlternateProtocolExperiment alternate_protocol_experiment_;
SpdySettingsMap spdy_settings_map_;
ServerNetworkStatsMap server_network_stats_map_;
diff --git a/net/http/http_server_properties_impl_unittest.cc b/net/http/http_server_properties_impl_unittest.cc
index 6a709a9..c801474 100644
--- a/net/http/http_server_properties_impl_unittest.cc
+++ b/net/http/http_server_properties_impl_unittest.cc
@@ -415,6 +415,10 @@ TEST_F(AlternateProtocolServerPropertiesTest, Canonical) {
impl_.GetAlternateProtocol(test_host_port_pair);
EXPECT_EQ(canonical_protocol.port, alternate.port);
EXPECT_EQ(canonical_protocol.protocol, alternate.protocol);
+
+ // Verify the canonical suffix.
+ EXPECT_EQ(".c.youtube.com", impl_.GetCanonicalSuffix(test_host_port_pair));
+ EXPECT_EQ(".c.youtube.com", impl_.GetCanonicalSuffix(canonical_port_pair));
}
typedef HttpServerPropertiesImplTest SpdySettingsServerPropertiesTest;
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
index d964ab4..7845e69 100644
--- a/net/http/http_stream_factory_impl.cc
+++ b/net/http/http_stream_factory_impl.cc
@@ -207,7 +207,9 @@ PortAlternateProtocolPair HttpStreamFactoryImpl::GetAlternateProtocolRequestFor(
PortAlternateProtocolPair alternate =
http_server_properties.GetAlternateProtocol(origin);
if (alternate.protocol == ALTERNATE_PROTOCOL_BROKEN) {
- HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_BROKEN);
+ HistogramAlternateProtocolUsage(
+ ALTERNATE_PROTOCOL_USAGE_BROKEN,
+ http_server_properties.GetAlternateProtocolExperiment());
return kNoAlternateProtocol;
}
diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc
index 7e0dc2f..c5a8b9f 100644
--- a/net/http/http_stream_factory_impl_job.cc
+++ b/net/http/http_stream_factory_impl_job.cc
@@ -1472,17 +1472,28 @@ bool HttpStreamFactoryImpl::Job::IsOrphaned() const {
}
void HttpStreamFactoryImpl::Job::ReportJobSuccededForRequest() {
+ net::AlternateProtocolExperiment alternate_protocol_experiment =
+ ALTERNATE_PROTOCOL_NOT_PART_OF_EXPERIMENT;
+ base::WeakPtr<HttpServerProperties> http_server_properties =
+ session_->http_server_properties();
+ if (http_server_properties) {
+ alternate_protocol_experiment =
+ http_server_properties->GetAlternateProtocolExperiment();
+ }
if (using_existing_quic_session_) {
// If an existing session was used, then no TCP connection was
// started.
- HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_NO_RACE);
+ HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_NO_RACE,
+ alternate_protocol_experiment);
} else if (original_url_) {
// This job was the alternate protocol job, and hence won the race.
- HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_WON_RACE);
+ HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_WON_RACE,
+ alternate_protocol_experiment);
} else {
// This job was the normal job, and hence the alternate protocol job lost
// the race.
- HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_LOST_RACE);
+ HistogramAlternateProtocolUsage(ALTERNATE_PROTOCOL_USAGE_LOST_RACE,
+ alternate_protocol_experiment);
}
}