Commit 374e5688 authored by rtenneti's avatar rtenneti Committed by Commit bot

QUIC - Added the following finch trial parameters to disable QUIC if

the packet loss rate is bad for multiple connections in a row.

+ max_number_of_lossy_connections: specifies the maximum number of
  connections with high packet loss in a row after which QUIC will be
  disabled.

+ packet_loss_threshold:  specifies packet loss rate in franction after
  which a connection is closed and is considered as a lossy connection.

QUIC changes to support this were checked in the following CL:
  https://codereview.chromium.org/1025573002/

R=rch@chromium.org

Review URL: https://codereview.chromium.org/1041953003

Cr-Commit-Position: refs/heads/master@{#322704}
parent 10f7018a
......@@ -1211,6 +1211,10 @@ void IOThread::InitializeNetworkSessionParamsFromGlobals(
&params->quic_enable_non_blocking_io);
globals.quic_disable_disk_cache.CopyToIfSet(
&params->quic_disable_disk_cache);
globals.quic_max_number_of_lossy_connections.CopyToIfSet(
&params->quic_max_number_of_lossy_connections);
globals.quic_packet_loss_threshold.CopyToIfSet(
&params->quic_packet_loss_threshold);
globals.quic_socket_receive_buffer_size.CopyToIfSet(
&params->quic_socket_receive_buffer_size);
globals.enable_quic_port_selection.CopyToIfSet(
......@@ -1347,6 +1351,15 @@ void IOThread::ConfigureQuicGlobals(
ShouldQuicEnableNonBlockingIO(quic_trial_params));
globals->quic_disable_disk_cache.set(
ShouldQuicDisableDiskCache(quic_trial_params));
int max_number_of_lossy_connections = GetQuicMaxNumberOfLossyConnections(
quic_trial_params);
if (max_number_of_lossy_connections != 0) {
globals->quic_max_number_of_lossy_connections.set(
max_number_of_lossy_connections);
}
float packet_loss_threshold = GetQuicPacketLossThreshold(quic_trial_params);
if (packet_loss_threshold != 0)
globals->quic_packet_loss_threshold.set(packet_loss_threshold);
globals->enable_quic_port_selection.set(
ShouldEnableQuicPortSelection(command_line));
globals->quic_connection_options =
......@@ -1546,6 +1559,30 @@ bool IOThread::ShouldQuicDisableDiskCache(
GetVariationParam(quic_trial_params, "disable_disk_cache"), "true");
}
// static
int IOThread::GetQuicMaxNumberOfLossyConnections(
const VariationParameters& quic_trial_params) {
int value;
if (base::StringToInt(GetVariationParam(quic_trial_params,
"max_number_of_lossy_connections"),
&value)) {
return value;
}
return 0;
}
// static
float IOThread::GetQuicPacketLossThreshold(
const VariationParameters& quic_trial_params) {
double value;
if (base::StringToDouble(GetVariationParam(quic_trial_params,
"packet_loss_threshold"),
&value)) {
return (float)value;
}
return 0.0f;
}
// static
int IOThread::GetQuicSocketReceiveBufferSize(
const VariationParameters& quic_trial_params) {
......
......@@ -189,6 +189,8 @@ class IOThread : public content::BrowserThreadDelegate {
Optional<bool> quic_enable_connection_racing;
Optional<bool> quic_enable_non_blocking_io;
Optional<bool> quic_disable_disk_cache;
Optional<int> quic_max_number_of_lossy_connections;
Optional<float> quic_packet_loss_threshold;
Optional<int> quic_socket_receive_buffer_size;
Optional<size_t> quic_max_packet_length;
net::QuicTagVector quic_connection_options;
......@@ -372,6 +374,18 @@ class IOThread : public content::BrowserThreadDelegate {
static bool ShouldQuicDisableDiskCache(
const VariationParameters& quic_trial_params);
// Returns the maximum number of QUIC connections with high packet loss in a
// row after which QUIC should be disabled. Returns 0 if the default value
// should be used.
static int GetQuicMaxNumberOfLossyConnections(
const VariationParameters& quic_trial_params);
// Returns the packet loss rate in fraction after which a QUIC connection is
// closed and is considered as a lossy connection. Returns 0 if the default
// value should be used.
static float GetQuicPacketLossThreshold(
const VariationParameters& quic_trial_params);
// Returns the size of the QUIC receive buffer to use, or 0 if
// the default should be used.
static int GetQuicSocketReceiveBufferSize(
......
......@@ -225,6 +225,8 @@ TEST_F(IOThreadTest, EnableQuicFromFieldTrialGroup) {
EXPECT_FALSE(params.quic_enable_connection_racing);
EXPECT_FALSE(params.quic_enable_non_blocking_io);
EXPECT_FALSE(params.quic_disable_disk_cache);
EXPECT_EQ(0, params.quic_max_number_of_lossy_connections);
EXPECT_EQ(1.0f, params.quic_packet_loss_threshold);
EXPECT_FALSE(IOThread::ShouldEnableQuicForDataReductionProxy());
}
......@@ -414,6 +416,24 @@ TEST_F(IOThreadTest, QuicDisableDiskCache) {
EXPECT_TRUE(params.quic_disable_disk_cache);
}
TEST_F(IOThreadTest, QuicMaxNumberOfLossyConnectionsFieldTrialParams) {
field_trial_group_ = "Enabled";
field_trial_params_["max_number_of_lossy_connections"] = "5";
ConfigureQuicGlobals();
net::HttpNetworkSession::Params params;
InitializeNetworkSessionParams(&params);
EXPECT_EQ(5, params.quic_max_number_of_lossy_connections);
}
TEST_F(IOThreadTest, QuicPacketLossThresholdFieldTrialParams) {
field_trial_group_ = "Enabled";
field_trial_params_["packet_loss_threshold"] = "0.5";
ConfigureQuicGlobals();
net::HttpNetworkSession::Params params;
InitializeNetworkSessionParams(&params);
EXPECT_EQ(0.5f, params.quic_packet_loss_threshold);
}
TEST_F(IOThreadTest, QuicReceiveBufferSize) {
field_trial_group_ = "Enabled";
field_trial_params_["receive_buffer_size"] = "1048576";
......
......@@ -342,7 +342,7 @@ class NET_EXPORT_PRIVATE QuicStreamFactory
// Specifies the maximum number of connections with high packet loss in a row
// after which QUIC will be disabled.
int max_number_of_lossy_connections_;
// Specifies packet loss rate in franction after which a connection is closed
// Specifies packet loss rate in fraction after which a connection is closed
// and is considered as a lossy connection.
float packet_loss_threshold_;
// Count number of lossy connections by port.
......
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