Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(990)

Unified Diff: net/quic/core/congestion_control/cubic_bytes_test.cc

Issue 2569723004: relnote: Protected by --quic_fix_beta_last_max. Fix conservative decrease for n-connection emulatio… (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/congestion_control/cubic_bytes.cc ('k') | net/quic/core/congestion_control/cubic_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/congestion_control/cubic_bytes_test.cc
diff --git a/net/quic/core/congestion_control/cubic_bytes_test.cc b/net/quic/core/congestion_control/cubic_bytes_test.cc
index 4112a5f74ce51068214d863fa4241816a4313e3b..0cade3708fdfd3717c48c0d72487e7e2da582efd 100644
--- a/net/quic/core/congestion_control/cubic_bytes_test.cc
+++ b/net/quic/core/congestion_control/cubic_bytes_test.cc
@@ -14,9 +14,12 @@
namespace net {
namespace test {
-const float kBeta = 0.7f; // Default Cubic backoff factor.
+const float kBeta = 0.7f; // Default Cubic backoff factor.
+const float kBetaLastMax = 0.85f; // Default Cubic backoff factor.
const uint32_t kNumConnections = 2;
const float kNConnectionBeta = (kNumConnections - 1 + kBeta) / kNumConnections;
+const float kNConnectionBetaLastMax =
+ (kNumConnections - 1 + kBetaLastMax) / kNumConnections;
const float kNConnectionAlpha = 3 * kNumConnections * kNumConnections *
(1 - kNConnectionBeta) / (1 + kNConnectionBeta);
@@ -30,6 +33,7 @@ class CubicBytesTest : public ::testing::Test {
FLAGS_quic_fix_cubic_convex_mode);
cubic_.SetFixCubicQuantization(
FLAGS_quic_fix_cubic_bytes_quantization);
+ cubic_.SetFixBetaLastMax(FLAGS_quic_fix_beta_last_max);
}
QuicByteCount RenoCwndInBytes(QuicByteCount current_cwnd) {
@@ -57,6 +61,10 @@ class CubicBytesTest : public ::testing::Test {
return cubic_cwnd;
}
+ QuicByteCount LastMaxCongestionWindow() {
+ return cubic_.last_max_congestion_window();
+ }
+
const QuicTime::Delta one_ms_;
const QuicTime::Delta hundred_ms_;
MockClock clock_;
@@ -303,12 +311,62 @@ TEST_F(CubicBytesTest, LossEvents) {
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterAck(kDefaultTCPMSS, current_cwnd,
rtt_min, clock_.ApproximateNow()));
- expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
+
+ // On the first loss, the last max congestion window is set to the
+ // congestion window before the loss.
+ QuicByteCount pre_loss_cwnd = current_cwnd;
+ ASSERT_EQ(0u, LastMaxCongestionWindow());
+ expected_cwnd = static_cast<QuicByteCount>(current_cwnd * kNConnectionBeta);
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
- expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
+ ASSERT_EQ(pre_loss_cwnd, LastMaxCongestionWindow());
+ current_cwnd = expected_cwnd;
+
+ // On the second loss, the current congestion window has not yet
+ // reached the last max congestion window. The last max congestion
+ // window will be reduced by an additional backoff factor to allow
+ // for competition.
+ pre_loss_cwnd = current_cwnd;
+ expected_cwnd = static_cast<QuicByteCount>(current_cwnd * kNConnectionBeta);
+ ASSERT_EQ(expected_cwnd,
+ cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
+ current_cwnd = expected_cwnd;
+ EXPECT_GT(pre_loss_cwnd, LastMaxCongestionWindow());
+ QuicByteCount expected_last_max =
+ FLAGS_quic_fix_beta_last_max
+ ? static_cast<QuicByteCount>(pre_loss_cwnd * kNConnectionBetaLastMax)
+ : static_cast<QuicByteCount>(pre_loss_cwnd * kBetaLastMax);
+ EXPECT_EQ(expected_last_max, LastMaxCongestionWindow());
+ if (FLAGS_quic_fix_beta_last_max) {
+ EXPECT_LT(expected_cwnd, LastMaxCongestionWindow());
+ } else {
+ // If we don't scale kLastBetaMax, the current window is exactly
+ // equal to the last max congestion window, which would cause us
+ // to land above the origin on the next increase.
+ EXPECT_EQ(expected_cwnd, LastMaxCongestionWindow());
+ }
+ // Simulate an increase, and check that we are below the origin.
+ current_cwnd = cubic_.CongestionWindowAfterAck(
+ kDefaultTCPMSS, current_cwnd, rtt_min, clock_.ApproximateNow());
+ if (FLAGS_quic_fix_beta_last_max) {
+ EXPECT_GT(LastMaxCongestionWindow(), current_cwnd);
+ } else {
+ // Without the bug fix, we will be at or above the origin.
+ EXPECT_LE(LastMaxCongestionWindow(), current_cwnd);
+ }
+
+ // On the final loss, simulate the condition where the congestion
+ // window had a chance to grow nearly to the last congestion window.
+ current_cwnd = LastMaxCongestionWindow() - 1;
+ pre_loss_cwnd = current_cwnd;
+ expected_cwnd = static_cast<QuicByteCount>(current_cwnd * kNConnectionBeta);
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
+ expected_last_max =
+ FLAGS_quic_fix_beta_last_max
+ ? pre_loss_cwnd
+ : static_cast<QuicByteCount>(pre_loss_cwnd * kBetaLastMax);
+ ASSERT_EQ(expected_last_max, LastMaxCongestionWindow());
}
TEST_F(CubicBytesTest, BelowOrigin) {
« no previous file with comments | « net/quic/core/congestion_control/cubic_bytes.cc ('k') | net/quic/core/congestion_control/cubic_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698