Commit f6498189 authored by rdsmith's avatar rdsmith Committed by Commit bot

Remove code for max connection throttling; the experiment's complete.

BUG=501432
R=csharrison@chromium.org

Review-Url: https://codereview.chromium.org/2363743005
Cr-Commit-Position: refs/heads/master@{#420621}
parent 2c2a79b3
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_piece.h"
#include "base/supports_user_data.h" #include "base/supports_user_data.h"
#include "content/common/resource_messages.h" #include "content/common/resource_messages.h"
#include "content/public/browser/resource_controller.h" #include "content/public/browser/resource_controller.h"
...@@ -38,10 +36,6 @@ enum StartMode { ...@@ -38,10 +36,6 @@ enum StartMode {
START_ASYNC START_ASYNC
}; };
// Field trial constants
const char kRequestLimitFieldTrial[] = "OutstandingRequestLimiting";
const char kRequestLimitFieldTrialGroupPrefix[] = "Limit";
// Flags identifying various attributes of the request that are used // Flags identifying various attributes of the request that are used
// when making scheduling decisions. // when making scheduling decisions.
using RequestAttributes = uint8_t; using RequestAttributes = uint8_t;
...@@ -314,7 +308,6 @@ class ResourceScheduler::Client { ...@@ -314,7 +308,6 @@ class ResourceScheduler::Client {
: is_loaded_(false), : is_loaded_(false),
has_html_body_(false), has_html_body_(false),
using_spdy_proxy_(false), using_spdy_proxy_(false),
scheduler_(scheduler),
in_flight_delayable_count_(0), in_flight_delayable_count_(0),
total_layout_blocking_count_(0) {} total_layout_blocking_count_(0) {}
...@@ -577,16 +570,13 @@ class ResourceScheduler::Client { ...@@ -577,16 +570,13 @@ class ResourceScheduler::Client {
// The following rules are followed: // The following rules are followed:
// //
// All types of requests: // All types of requests:
// * If an outstanding request limit is in place, only that number
// of requests may be in flight for a single client at the same time.
// * Non-delayable, High-priority and request-priority capable requests are // * Non-delayable, High-priority and request-priority capable requests are
// issued immediately. // issued immediately.
// * Low priority requests are delayable. // * Low priority requests are delayable.
// * While kInFlightNonDelayableRequestCountPerClientThreshold // * While kInFlightNonDelayableRequestCountPerClientThreshold
// layout-blocking requests are loading or the body tag has not yet been // layout-blocking requests are loading or the body tag has not yet been
// parsed, limit the number of delayable requests that may be in flight // parsed, limit the number of delayable requests that may be in flight
// (to kMaxNumDelayableWhileLayoutBlockingPerClient by default, or to zero // to kMaxNumDelayableWhileLayoutBlockingPerClient.
// if there's an outstanding request limit in place).
// * If no high priority or layout-blocking requests are in flight, start // * If no high priority or layout-blocking requests are in flight, start
// loading delayable requests. // loading delayable requests.
// * Never exceed 10 delayable requests in flight per client. // * Never exceed 10 delayable requests in flight per client.
...@@ -608,12 +598,6 @@ class ResourceScheduler::Client { ...@@ -608,12 +598,6 @@ class ResourceScheduler::Client {
if (using_spdy_proxy_ && url_request.url().SchemeIs(url::kHttpScheme)) if (using_spdy_proxy_ && url_request.url().SchemeIs(url::kHttpScheme))
return START_REQUEST; return START_REQUEST;
// Implementation of the kRequestLimitFieldTrial.
if (scheduler_->limit_outstanding_requests() &&
in_flight_requests_.size() >= scheduler_->outstanding_request_limit()) {
return DO_NOT_START_REQUEST_AND_STOP_SEARCHING;
}
net::HostPortPair host_port_pair = net::HostPortPair host_port_pair =
net::HostPortPair::FromURL(url_request.url()); net::HostPortPair::FromURL(url_request.url());
url::SchemeHostPort scheme_host_port(url_request.url()); url::SchemeHostPort scheme_host_port(url_request.url());
...@@ -654,8 +638,7 @@ class ResourceScheduler::Client { ...@@ -654,8 +638,7 @@ class ResourceScheduler::Client {
return DO_NOT_START_REQUEST_AND_STOP_SEARCHING; return DO_NOT_START_REQUEST_AND_STOP_SEARCHING;
} }
if (in_flight_requests_.size() > 0 && if (in_flight_requests_.size() > 0 &&
(scheduler_->limit_outstanding_requests() || (in_flight_delayable_count_ >=
in_flight_delayable_count_ >=
kMaxNumDelayableWhileLayoutBlockingPerClient)) { kMaxNumDelayableWhileLayoutBlockingPerClient)) {
// Block the request if at least one request is in flight and the // Block the request if at least one request is in flight and the
// number of in-flight delayable requests has hit the configured // number of in-flight delayable requests has hit the configured
...@@ -711,30 +694,13 @@ class ResourceScheduler::Client { ...@@ -711,30 +694,13 @@ class ResourceScheduler::Client {
bool using_spdy_proxy_; bool using_spdy_proxy_;
RequestQueue pending_requests_; RequestQueue pending_requests_;
RequestSet in_flight_requests_; RequestSet in_flight_requests_;
ResourceScheduler* scheduler_;
// The number of delayable in-flight requests. // The number of delayable in-flight requests.
size_t in_flight_delayable_count_; size_t in_flight_delayable_count_;
// The number of layout-blocking in-flight requests. // The number of layout-blocking in-flight requests.
size_t total_layout_blocking_count_; size_t total_layout_blocking_count_;
}; };
ResourceScheduler::ResourceScheduler() ResourceScheduler::ResourceScheduler() {}
: limit_outstanding_requests_(false),
outstanding_request_limit_(0) {
std::string outstanding_limit_trial_group =
base::FieldTrialList::FindFullName(kRequestLimitFieldTrial);
std::vector<std::string> split_group(
base::SplitString(outstanding_limit_trial_group, "=",
base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL));
int outstanding_limit = 0;
if (split_group.size() == 2 &&
split_group[0] == kRequestLimitFieldTrialGroupPrefix &&
base::StringToInt(split_group[1], &outstanding_limit) &&
outstanding_limit > 0) {
limit_outstanding_requests_ = true;
outstanding_request_limit_ = outstanding_limit;
}
}
ResourceScheduler::~ResourceScheduler() { ResourceScheduler::~ResourceScheduler() {
DCHECK(unowned_requests_.empty()); DCHECK(unowned_requests_.empty());
......
...@@ -105,17 +105,6 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { ...@@ -105,17 +105,6 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe {
int intra_priority_value); int intra_priority_value);
private: private:
// Returns true if limiting of outstanding requests is enabled.
bool limit_outstanding_requests() const {
return limit_outstanding_requests_;
}
// Returns the outstanding request limit. Only valid if
// |IsLimitingOutstandingRequests()|.
size_t outstanding_request_limit() const {
return outstanding_request_limit_;
}
// Returns the maximum number of delayable requests to all be in-flight at // Returns the maximum number of delayable requests to all be in-flight at
// any point in time (across all hosts). // any point in time (across all hosts).
size_t max_num_delayable_requests() const { size_t max_num_delayable_requests() const {
...@@ -145,8 +134,6 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe { ...@@ -145,8 +134,6 @@ class CONTENT_EXPORT ResourceScheduler : public base::NonThreadSafe {
Client* GetClient(int child_id, int route_id); Client* GetClient(int child_id, int route_id);
ClientMap client_map_; ClientMap client_map_;
bool limit_outstanding_requests_;
size_t outstanding_request_limit_;
size_t max_num_delayable_requests_; size_t max_num_delayable_requests_;
RequestSet unowned_requests_; RequestSet unowned_requests_;
......
...@@ -9,10 +9,8 @@ ...@@ -9,10 +9,8 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/memory/scoped_vector.h" #include "base/memory/scoped_vector.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/test/mock_entropy_provider.h"
#include "base/timer/mock_timer.h" #include "base/timer/mock_timer.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "content/browser/browser_thread_impl.h" #include "content/browser/browser_thread_impl.h"
...@@ -20,7 +18,6 @@ ...@@ -20,7 +18,6 @@
#include "content/public/browser/resource_context.h" #include "content/public/browser/resource_context.h"
#include "content/public/browser/resource_controller.h" #include "content/public/browser/resource_controller.h"
#include "content/public/browser/resource_throttle.h" #include "content/public/browser/resource_throttle.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/mock_render_process_host.h" #include "content/public/test/mock_render_process_host.h"
#include "content/public/test/test_browser_context.h" #include "content/public/test/test_browser_context.h"
#include "content/test/test_render_view_host_factory.h" #include "content/test/test_render_view_host_factory.h"
...@@ -129,8 +126,7 @@ class ResourceSchedulerTest : public testing::Test { ...@@ -129,8 +126,7 @@ class ResourceSchedulerTest : public testing::Test {
protected: protected:
ResourceSchedulerTest() ResourceSchedulerTest()
: ui_thread_(BrowserThread::UI, &message_loop_), : ui_thread_(BrowserThread::UI, &message_loop_),
io_thread_(BrowserThread::IO, &message_loop_), io_thread_(BrowserThread::IO, &message_loop_) {
field_trial_list_(base::MakeUnique<base::MockEntropyProvider>()) {
InitializeScheduler(); InitializeScheduler();
context_.set_http_server_properties(&http_server_properties_); context_.set_http_server_properties(&http_server_properties_);
} }
...@@ -160,13 +156,6 @@ class ResourceSchedulerTest : public testing::Test { ...@@ -160,13 +156,6 @@ class ResourceSchedulerTest : public testing::Test {
} }
} }
// Create field trials based on the argument, which has the same format
// as the argument to kForceFieldTrials.
bool InitializeFieldTrials(const std::string& force_field_trial_argument) {
return base::FieldTrialList::CreateTrialsFromString(
force_field_trial_argument, std::set<std::string>());
}
std::unique_ptr<net::URLRequest> NewURLRequestWithChildAndRoute( std::unique_ptr<net::URLRequest> NewURLRequestWithChildAndRoute(
const char* url, const char* url,
net::RequestPriority priority, net::RequestPriority priority,
...@@ -258,7 +247,6 @@ class ResourceSchedulerTest : public testing::Test { ...@@ -258,7 +247,6 @@ class ResourceSchedulerTest : public testing::Test {
BrowserThreadImpl io_thread_; BrowserThreadImpl io_thread_;
ResourceDispatcherHostImpl rdh_; ResourceDispatcherHostImpl rdh_;
std::unique_ptr<ResourceScheduler> scheduler_; std::unique_ptr<ResourceScheduler> scheduler_;
base::FieldTrialList field_trial_list_;
base::MockTimer* mock_timer_; base::MockTimer* mock_timer_;
net::HttpServerPropertiesImpl http_server_properties_; net::HttpServerPropertiesImpl http_server_properties_;
net::TestURLRequestContext context_; net::TestURLRequestContext context_;
...@@ -694,78 +682,7 @@ TEST_F(ResourceSchedulerTest, NewSpdyHostInDelayableRequests) { ...@@ -694,78 +682,7 @@ TEST_F(ResourceSchedulerTest, NewSpdyHostInDelayableRequests) {
EXPECT_TRUE(low2->started()); EXPECT_TRUE(low2->started());
} }
TEST_F(ResourceSchedulerTest, OustandingRequestLimitEnforced) { // Async revalidations which are not started when the tab is closed must be
const int kRequestLimit = 3;
ASSERT_TRUE(InitializeFieldTrials(
base::StringPrintf("OutstandingRequestLimiting/Limit=%d/",
kRequestLimit)));
InitializeScheduler();
// Throw in requests up to the above limit; make sure they are started.
ScopedVector<TestRequest> requests;
for (int i = 0; i < kRequestLimit; ++i) {
string url = "http://host/medium";
requests.push_back(NewRequest(url.c_str(), net::MEDIUM));
EXPECT_TRUE(requests[i]->started());
}
// Confirm that another request will indeed fail.
string url = "http://host/medium";
requests.push_back(NewRequest(url.c_str(), net::MEDIUM));
EXPECT_FALSE(requests[kRequestLimit]->started());
}
// Confirm that outstanding requests limits apply to requests to hosts
// that support request priority.
TEST_F(ResourceSchedulerTest,
OutstandingRequestsLimitsEnforcedForRequestPriority) {
const int kRequestLimit = 3;
ASSERT_TRUE(InitializeFieldTrials(
base::StringPrintf("OutstandingRequestLimiting/Limit=%d/",
kRequestLimit)));
InitializeScheduler();
http_server_properties_.SetSupportsSpdy(
url::SchemeHostPort("https", "spdyhost", 443), true);
// Throw in requests up to the above limit; make sure they are started.
ScopedVector<TestRequest> requests;
for (int i = 0; i < kRequestLimit; ++i) {
string url = "http://spdyhost/medium";
requests.push_back(NewRequest(url.c_str(), net::MEDIUM));
EXPECT_TRUE(requests[i]->started());
}
// Confirm that another request will indeed fail.
string url = "http://spdyhost/medium";
requests.push_back(NewRequest(url.c_str(), net::MEDIUM));
EXPECT_FALSE(requests[kRequestLimit]->started());
}
TEST_F(ResourceSchedulerTest, OutstandingRequestLimitDelays) {
const int kRequestLimit = 3;
ASSERT_TRUE(InitializeFieldTrials(
base::StringPrintf("OutstandingRequestLimiting/Limit=%d/",
kRequestLimit)));
InitializeScheduler();
std::unique_ptr<TestRequest> high(
NewRequest("http://host/high", net::HIGHEST));
std::unique_ptr<TestRequest> low(NewRequest("http://host/low",
net::LOWEST));
std::unique_ptr<TestRequest> low2(NewRequest("http://host/low",
net::LOWEST));
EXPECT_TRUE(high->started());
EXPECT_FALSE(low->started());
EXPECT_FALSE(low2->started());
high.reset();
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(low->started());
EXPECT_FALSE(low2->started());
}
// Async revalidations which are not started when the tab is closed must be
// started at some point, or they will hang around forever and prevent other // started at some point, or they will hang around forever and prevent other
// async revalidations to the same URL from being issued. // async revalidations to the same URL from being issued.
TEST_F(ResourceSchedulerTest, RequestStartedAfterClientDeleted) { TEST_F(ResourceSchedulerTest, RequestStartedAfterClientDeleted) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment