Commit 7fc2bace authored by Tarun Bansal's avatar Tarun Bansal Committed by Commit Bot

Network Quality Estimator: Use end to end rtt to clamp HTTP RTT

Use the end to end RTT provided by QUIC connections to clamp the
upper bound on HTTP RTT.

In some cases, network quality estimator may not detect hanging
XHR requests, and use the RTT samples from such requests when
computing the HTTP RTT estimate. Using end-to-end
RTT to clamp HTTP RTT helps in improving the accuracy of HTTP RTT
estimate in such cases.

Change-Id: I0c2b60eb73b35408c4d32d38ffffc29f6d3e0ce1
Bug: 834119
Reviewed-on: https://chromium-review.googlesource.com/c/1279435Reviewed-by: default avatarRyan Sturm <ryansturm@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599720}
parent cecb0af6
......@@ -1210,25 +1210,24 @@ NetworkQualityEstimator::GetRecentEffectiveConnectionTypeUsingMetrics(
*end_to_end_rtt = nqe::internal::InvalidRTT();
}
// Use transport RTT to clamp the lower bound on HTTP RTT.
// To improve accuracy, the transport RTT estimate is used only when the
// transport RTT estimate was computed using at least
// |params_->http_rtt_transport_rtt_min_count()| observations.
if (*http_rtt != nqe::internal::InvalidRTT() &&
*transport_rtt != nqe::internal::InvalidRTT()) {
// Use transport RTT to clamp the HTTP RTT between lower and upper bounds.
// To improve accuracy, the transport RTT estimate is used only when the
// transport RTT estimate was computed using at least
// |params_->http_rtt_transport_rtt_min_count()| observations.
if (transport_rtt_observation_count_last_ect_computation_ >=
params_->http_rtt_transport_rtt_min_count()) {
if (params_->lower_bound_http_rtt_transport_rtt_multiplier() > 0) {
*http_rtt = std::max(
*http_rtt,
*transport_rtt *
params_->lower_bound_http_rtt_transport_rtt_multiplier());
}
}
*transport_rtt != nqe::internal::InvalidRTT() &&
transport_rtt_observation_count_last_ect_computation_ >=
params_->http_rtt_transport_rtt_min_count() &&
params_->lower_bound_http_rtt_transport_rtt_multiplier() > 0) {
*http_rtt =
std::max(*http_rtt,
*transport_rtt *
params_->lower_bound_http_rtt_transport_rtt_multiplier());
}
// Put lower bound on |http_rtt| using |end_to_end_rtt|.
if (params_->use_end_to_end_rtt() &&
if (*http_rtt != nqe::internal::InvalidRTT() &&
params_->use_end_to_end_rtt() &&
*end_to_end_rtt != nqe::internal::InvalidRTT() &&
end_to_end_rtt_observation_count_at_last_ect_computation_ >=
params_->http_rtt_transport_rtt_min_count() &&
......@@ -1239,6 +1238,18 @@ NetworkQualityEstimator::GetRecentEffectiveConnectionTypeUsingMetrics(
params_->lower_bound_http_rtt_transport_rtt_multiplier());
}
// Put upper bound on |http_rtt| using |end_to_end_rtt|.
if (*http_rtt != nqe::internal::InvalidRTT() &&
params_->use_end_to_end_rtt() &&
*end_to_end_rtt != nqe::internal::InvalidRTT() &&
end_to_end_rtt_observation_count_at_last_ect_computation_ >=
params_->http_rtt_transport_rtt_min_count() &&
params_->upper_bound_http_rtt_endtoend_rtt_multiplier() > 0) {
*http_rtt = std::min(
*http_rtt, *end_to_end_rtt *
params_->upper_bound_http_rtt_endtoend_rtt_multiplier());
}
if (!GetRecentDownlinkThroughputKbps(start_time, downstream_throughput_kbps))
*downstream_throughput_kbps = nqe::internal::INVALID_RTT_THROUGHPUT;
......
......@@ -459,6 +459,11 @@ NetworkQualityEstimatorParams::NetworkQualityEstimatorParams(
min_socket_watcher_notification_interval_(
GetMinSocketWatcherNotificationInterval(params_)),
lower_bound_http_rtt_transport_rtt_multiplier_(1.0),
upper_bound_http_rtt_endtoend_rtt_multiplier_(
GetDoubleValueForVariationParamWithDefaultValue(
params_,
"upper_bound_http_rtt_endtoend_rtt_multiplier",
3.0)),
hanging_request_http_rtt_upper_bound_transport_rtt_multiplier_(
GetValueForVariationParam(
params_,
......
......@@ -124,6 +124,16 @@ class NET_EXPORT NetworkQualityEstimatorParams {
return lower_bound_http_rtt_transport_rtt_multiplier_;
}
// Returns the multiplier by which the end to end RTT estimate should be
// multiplied when computing the HTTP RTT. The multiplied value of the
// end to end RTT serves as an upper bound to the HTTP RTT estimate. e.g., if
// the multiplied end to end RTT is 100 msec., then HTTP RTT estimate can't be
// more than |upper_bound_http_rtt_endtoend_rtt_multiplier| times 100 msec.
// Returns a negative value if the param is not set.
double upper_bound_http_rtt_endtoend_rtt_multiplier() const {
return upper_bound_http_rtt_endtoend_rtt_multiplier_;
}
// For the purpose of estimating the HTTP RTT, a request is marked as hanging
// only if its RTT is at least this times the transport RTT estimate.
int hanging_request_http_rtt_upper_bound_transport_rtt_multiplier() const {
......@@ -248,6 +258,7 @@ class NET_EXPORT NetworkQualityEstimatorParams {
bool persistent_cache_reading_enabled_;
const base::TimeDelta min_socket_watcher_notification_interval_;
const double lower_bound_http_rtt_transport_rtt_multiplier_;
const double upper_bound_http_rtt_endtoend_rtt_multiplier_;
const int hanging_request_http_rtt_upper_bound_transport_rtt_multiplier_;
const int hanging_request_http_rtt_upper_bound_http_rtt_multiplier_;
const base::TimeDelta hanging_request_upper_bound_min_http_rtt_;
......
......@@ -1447,6 +1447,21 @@ TEST_F(NetworkQualityEstimatorTest, TestEndToEndRttUsedForHttpRttComputation) {
base::TimeDelta::FromMilliseconds(4000),
EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
},
{
// Verify end to end RTT places an upper bound on HTTP RTT when enough
// samples are present.
base::TimeDelta::FromMilliseconds(3000),
base::TimeDelta::FromMilliseconds(100), true,
base::TimeDelta::FromMilliseconds(300), EFFECTIVE_CONNECTION_TYPE_3G,
},
{
// Verify end to end RTT does not place an upper bound on HTTP RTT
// when enough samples are not present.
base::TimeDelta::FromMilliseconds(3000),
base::TimeDelta::FromMilliseconds(100), false,
base::TimeDelta::FromMilliseconds(3000),
EFFECTIVE_CONNECTION_TYPE_SLOW_2G,
},
};
for (const auto& test : tests) {
......
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