1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00

Set ExperimentalCongestion As Default

Summary: - Set the experimental persistent congestion logic (D30117835 (2caf2ff49d)) as the default implementation.

Reviewed By: mjoras, lnicco

Differential Revision: D31347778

fbshipit-source-id: ab74359896f8f57cf4d8c3065de4c658f65b9769
This commit is contained in:
Hani Damlaj
2021-10-06 11:32:31 -07:00
committed by Facebook GitHub Bot
parent a7776d9d9e
commit a0d81894b5
6 changed files with 26 additions and 85 deletions

View File

@@ -19,11 +19,11 @@ std::chrono::microseconds calculatePTO(const QuicConnectionStateBase& conn) {
conn.lossState.maxAckDelay; conn.lossState.maxAckDelay;
} }
bool isPersistentCongestionExperimental( bool isPersistentCongestion(
folly::Optional<std::chrono::microseconds> pto, folly::Optional<std::chrono::microseconds> pto,
TimePoint lostPeriodStart, TimePoint lostPeriodStart,
TimePoint lostPeriodEnd, TimePoint lostPeriodEnd,
const CongestionController::AckEvent& ack) { const CongestionController::AckEvent& ack) noexcept {
if (!pto.has_value()) { if (!pto.has_value()) {
return false; return false;
} }
@@ -44,18 +44,6 @@ bool isPersistentCongestionExperimental(
return it == ack.ackedPackets.cend(); return it == ack.ackedPackets.cend();
} }
bool isPersistentCongestion(
const QuicConnectionStateBase& conn,
TimePoint lostPeriodStart,
TimePoint lostPeriodEnd) noexcept {
if (conn.lossState.srtt == 0us) {
return false;
}
auto pto = calculatePTO(conn);
return (lostPeriodEnd - lostPeriodStart) >=
pto * kPersistentCongestionThreshold;
}
void onPTOAlarm(QuicConnectionStateBase& conn) { void onPTOAlarm(QuicConnectionStateBase& conn) {
VLOG(10) << __func__ << " " << conn; VLOG(10) << __func__ << " " << conn;
QUIC_STATS(conn.statsCallback, onPTO); QUIC_STATS(conn.statsCallback, onPTO);

View File

@@ -39,15 +39,10 @@ std::chrono::microseconds calculatePTO(const QuicConnectionStateBase& conn);
* *
*/ */
bool isPersistentCongestion( bool isPersistentCongestion(
const QuicConnectionStateBase& conn,
TimePoint lostPeriodStart,
TimePoint lostPeriodEnd) noexcept;
bool isPersistentCongestionExperimental(
folly::Optional<std::chrono::microseconds> pto, folly::Optional<std::chrono::microseconds> pto,
TimePoint lostPeriodStart, TimePoint lostPeriodStart,
TimePoint lostPeriodEnd, TimePoint lostPeriodEnd,
const CongestionController::AckEvent& ack); const CongestionController::AckEvent& ack) noexcept;
inline std::ostream& operator<<( inline std::ostream& operator<<(
std::ostream& os, std::ostream& os,
@@ -378,12 +373,6 @@ void onLossDetectionAlarm(
lossTimeAndSpace.second); lossTimeAndSpace.second);
if (conn.congestionController && lossEvent) { if (conn.congestionController && lossEvent) {
DCHECK(lossEvent->largestLostSentTime && lossEvent->smallestLostSentTime); DCHECK(lossEvent->largestLostSentTime && lossEvent->smallestLostSentTime);
if (!conn.transportSettings.experimentalPersistentCongestion) {
lossEvent->persistentCongestion = isPersistentCongestion(
conn,
*lossEvent->smallestLostSentTime,
*lossEvent->largestLostSentTime);
}
conn.congestionController->onPacketAckOrLoss( conn.congestionController->onPacketAckOrLoss(
folly::none, std::move(lossEvent)); folly::none, std::move(lossEvent));
} }

View File

@@ -1831,30 +1831,6 @@ TEST_P(QuicLossFunctionsTest, CappedShiftNoCrash) {
} }
TEST_F(QuicLossFunctionsTest, PersistentCongestion) { TEST_F(QuicLossFunctionsTest, PersistentCongestion) {
auto conn = createConn();
auto currentTime = Clock::now();
conn->lossState.srtt = 1s;
EXPECT_TRUE(isPersistentCongestion(*conn, currentTime - 10s, currentTime));
EXPECT_TRUE(isPersistentCongestion(*conn, currentTime - 3s, currentTime));
EXPECT_TRUE(isPersistentCongestion(
*conn, currentTime - (1s * kPersistentCongestionThreshold), currentTime));
EXPECT_FALSE(isPersistentCongestion(
*conn,
currentTime - (1s * kPersistentCongestionThreshold) + 1us,
currentTime));
EXPECT_FALSE(isPersistentCongestion(*conn, currentTime - 2s, currentTime));
EXPECT_FALSE(isPersistentCongestion(*conn, currentTime - 100ms, currentTime));
conn->lossState.rttvar = 2s;
conn->lossState.maxAckDelay = 5s;
EXPECT_TRUE(isPersistentCongestion(*conn, currentTime - 42s, currentTime));
EXPECT_TRUE(isPersistentCongestion(*conn, currentTime - 43s, currentTime));
EXPECT_FALSE(
isPersistentCongestion(*conn, currentTime - 42s + 1ms, currentTime));
EXPECT_FALSE(isPersistentCongestion(*conn, currentTime - 100us, currentTime));
}
TEST_F(QuicLossFunctionsTest, ExperimentalPersistentCongestion) {
// Test cases copied over from PersistentCongestion above. // Test cases copied over from PersistentCongestion above.
auto conn = createConn(); auto conn = createConn();
auto currentTime = Clock::now(); auto currentTime = Clock::now();
@@ -1862,40 +1838,38 @@ TEST_F(QuicLossFunctionsTest, ExperimentalPersistentCongestion) {
CongestionController::AckEvent ack; CongestionController::AckEvent ack;
EXPECT_TRUE(isPersistentCongestionExperimental( EXPECT_TRUE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 10s, currentTime, ack)); calculatePTO(*conn), currentTime - 10s, currentTime, ack));
EXPECT_TRUE(isPersistentCongestionExperimental( EXPECT_TRUE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 3s, currentTime, ack)); calculatePTO(*conn), currentTime - 3s, currentTime, ack));
EXPECT_TRUE(isPersistentCongestionExperimental( EXPECT_TRUE(isPersistentCongestion(
calculatePTO(*conn), calculatePTO(*conn),
currentTime - (1s * kPersistentCongestionThreshold), currentTime - (1s * kPersistentCongestionThreshold),
currentTime, currentTime,
ack)); ack));
EXPECT_FALSE(isPersistentCongestionExperimental( EXPECT_FALSE(isPersistentCongestion(
calculatePTO(*conn), calculatePTO(*conn),
currentTime - (1s * kPersistentCongestionThreshold) + 1us, currentTime - (1s * kPersistentCongestionThreshold) + 1us,
currentTime, currentTime,
ack)); ack));
EXPECT_FALSE(isPersistentCongestionExperimental( EXPECT_FALSE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 2s, currentTime, ack)); calculatePTO(*conn), currentTime - 2s, currentTime, ack));
EXPECT_FALSE(isPersistentCongestionExperimental( EXPECT_FALSE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 100ms, currentTime, ack)); calculatePTO(*conn), currentTime - 100ms, currentTime, ack));
conn->lossState.rttvar = 2s; conn->lossState.rttvar = 2s;
conn->lossState.maxAckDelay = 5s; conn->lossState.maxAckDelay = 5s;
EXPECT_TRUE(isPersistentCongestionExperimental( EXPECT_TRUE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 42s, currentTime, ack)); calculatePTO(*conn), currentTime - 42s, currentTime, ack));
EXPECT_TRUE(isPersistentCongestionExperimental( EXPECT_TRUE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 43s, currentTime, ack)); calculatePTO(*conn), currentTime - 43s, currentTime, ack));
EXPECT_FALSE(isPersistentCongestionExperimental( EXPECT_FALSE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 42s + 1ms, currentTime, ack)); calculatePTO(*conn), currentTime - 42s + 1ms, currentTime, ack));
EXPECT_FALSE(isPersistentCongestionExperimental( EXPECT_FALSE(isPersistentCongestion(
calculatePTO(*conn), currentTime - 100us, currentTime, ack)); calculatePTO(*conn), currentTime - 100us, currentTime, ack));
} }
TEST_F( TEST_F(QuicLossFunctionsTest, PersistentCongestionAckOutsideWindow) {
QuicLossFunctionsTest,
ExperimentalPersistentCongestionAckOutsideWindow) {
auto conn = createConn(); auto conn = createConn();
auto currentTime = Clock::now(); auto currentTime = Clock::now();
conn->lossState.srtt = 1s; conn->lossState.srtt = 1s;
@@ -1907,11 +1881,11 @@ TEST_F(
.setSentTime(currentTime + 12s) .setSentTime(currentTime + 12s)
.build()); .build());
EXPECT_TRUE(isPersistentCongestionExperimental( EXPECT_TRUE(isPersistentCongestion(
calculatePTO(*conn), currentTime + 1s, currentTime + 8s, ack)); calculatePTO(*conn), currentTime + 1s, currentTime + 8s, ack));
} }
TEST_F(QuicLossFunctionsTest, ExperimentalPersistentCongestionAckInsideWindow) { TEST_F(QuicLossFunctionsTest, PersistentCongestionAckInsideWindow) {
auto conn = createConn(); auto conn = createConn();
auto currentTime = Clock::now(); auto currentTime = Clock::now();
conn->lossState.srtt = 1s; conn->lossState.srtt = 1s;
@@ -1923,11 +1897,11 @@ TEST_F(QuicLossFunctionsTest, ExperimentalPersistentCongestionAckInsideWindow) {
.setSentTime(currentTime + 4s) .setSentTime(currentTime + 4s)
.build()); .build());
EXPECT_FALSE(isPersistentCongestionExperimental( EXPECT_FALSE(isPersistentCongestion(
calculatePTO(*conn), currentTime + 1s, currentTime + 8s, ack)); calculatePTO(*conn), currentTime + 1s, currentTime + 8s, ack));
} }
TEST_F(QuicLossFunctionsTest, ExperimentalPersistentCongestionNoPTO) { TEST_F(QuicLossFunctionsTest, PersistentCongestionNoPTO) {
auto conn = createConn(); auto conn = createConn();
auto currentTime = Clock::now(); auto currentTime = Clock::now();
@@ -1938,7 +1912,7 @@ TEST_F(QuicLossFunctionsTest, ExperimentalPersistentCongestionNoPTO) {
.setSentTime(currentTime + 12s) .setSentTime(currentTime + 12s)
.build()); .build());
EXPECT_FALSE(isPersistentCongestionExperimental( EXPECT_FALSE(isPersistentCongestion(
folly::none, currentTime + 1s, currentTime + 8s, ack)); folly::none, currentTime + 1s, currentTime + 8s, ack));
} }

View File

@@ -90,9 +90,7 @@ void recoverOrResetCongestionAndRttState(
} }
} }
void setExperimentalSettings(QuicServerConnectionState& conn) { void setExperimentalSettings(QuicServerConnectionState& /*conn*/) {}
conn.transportSettings.experimentalPersistentCongestion = true;
}
} // namespace } // namespace
void processClientInitialParams( void processClientInitialParams(

View File

@@ -265,18 +265,12 @@ void processAckFrame(
// contiguous lost block and determine if that block is larger than the // contiguous lost block and determine if that block is larger than the
// congestion period. Alternatively we could consider every lost block // congestion period. Alternatively we could consider every lost block
// and check if any of them constitute persistent congestion. // and check if any of them constitute persistent congestion.
lossEvent->persistentCongestion = lossEvent->persistentCongestion = isPersistentCongestion(
conn.transportSettings.experimentalPersistentCongestion conn.lossState.srtt == 0s ? folly::none
? isPersistentCongestionExperimental( : folly::Optional(calculatePTO(conn)),
conn.lossState.srtt == 0s ? folly::none *lossEvent->smallestLostSentTime,
: folly::Optional(calculatePTO(conn)), *lossEvent->largestLostSentTime,
*lossEvent->smallestLostSentTime, ack);
*lossEvent->largestLostSentTime,
ack)
: isPersistentCongestion(
conn,
*lossEvent->smallestLostSentTime,
*lossEvent->largestLostSentTime);
if (lossEvent->persistentCongestion) { if (lossEvent->persistentCongestion) {
QUIC_STATS(conn.statsCallback, onPersistentCongestion); QUIC_STATS(conn.statsCallback, onPersistentCongestion);
} }

View File

@@ -268,8 +268,6 @@ struct TransportSettings {
// Whether or not to opportunistically retransmit 0RTT when the handshake // Whether or not to opportunistically retransmit 0RTT when the handshake
// completes. // completes.
bool earlyRetransmit0Rtt{false}; bool earlyRetransmit0Rtt{false};
// Experimental persistent congestion flag
bool experimentalPersistentCongestion{false};
// Whether to use JumpStarter as the CongestionControllerFactory // Whether to use JumpStarter as the CongestionControllerFactory
bool useJumpStart{false}; bool useJumpStart{false};
}; };