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

Unified Diff: net/quic/core/congestion_control/cubic_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
Index: net/quic/core/congestion_control/cubic_test.cc
diff --git a/net/quic/core/congestion_control/cubic_test.cc b/net/quic/core/congestion_control/cubic_test.cc
index 5eef447bc37a1145c28cd0414addaeeaba3611d3..93bbd2bb8edebed5d65407b363a9f886327f7790 100644
--- a/net/quic/core/congestion_control/cubic_test.cc
+++ b/net/quic/core/congestion_control/cubic_test.cc
@@ -7,15 +7,19 @@
#include <cstdint>
#include "base/logging.h"
+#include "net/quic/core/quic_flags.h"
#include "net/quic/test_tools/mock_clock.h"
#include "testing/gtest/include/gtest/gtest.h"
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);
@@ -29,7 +33,13 @@ class CubicTest : public ::testing::TestWithParam<bool> {
cubic_(&clock_) {
fix_convex_mode_ = GetParam();
cubic_.SetFixConvexMode(fix_convex_mode_);
+ cubic_.SetFixBetaLastMax(FLAGS_quic_fix_beta_last_max);
}
+
+ QuicByteCount LastMaxCongestionWindow() {
+ return cubic_.last_max_congestion_window();
+ }
+
const QuicTime::Delta one_ms_;
const QuicTime::Delta hundred_ms_;
MockClock clock_;
@@ -119,12 +129,59 @@ TEST_P(CubicTest, LossEvents) {
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterAck(current_cwnd, rtt_min,
clock_.ApproximateNow()));
+
+ // On the first loss, the last max congestion window is set to the
+ // congestion window before the loss.
+ QuicByteCount pre_loss_cwnd = current_cwnd;
expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
+ ASSERT_EQ(0u, LastMaxCongestionWindow());
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
+ ASSERT_EQ(pre_loss_cwnd, LastMaxCongestionWindow());
+ current_cwnd = expected_cwnd;
+
+ // On the second loss, the current congestion window is
+ // significantly lower than 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<QuicPacketCount>(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<QuicPacketCount>(pre_loss_cwnd *
+ kNConnectionBetaLastMax)
+ : static_cast<QuicPacketCount>(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(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 back to the last congestion window.
+ current_cwnd = LastMaxCongestionWindow();
+ pre_loss_cwnd = current_cwnd;
expected_cwnd = static_cast<QuicPacketCount>(current_cwnd * kNConnectionBeta);
EXPECT_EQ(expected_cwnd,
cubic_.CongestionWindowAfterPacketLoss(current_cwnd));
+ ASSERT_EQ(pre_loss_cwnd, LastMaxCongestionWindow());
}
TEST_P(CubicTest, BelowOrigin) {
« no previous file with comments | « net/quic/core/congestion_control/cubic_bytes_test.cc ('k') | net/quic/core/congestion_control/send_algorithm_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698