1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-08 09:42:06 +03:00

move cwnd blocked trace from Cubic to QuicTransportFunction

Summary:
So this trace is shared by all CongestionControllers. This also
changes what we log into the trace.

Reviewed By: siyengar

Differential Revision: D15184916

fbshipit-source-id: 6cbeb02ee2d24a6bf8d705ff883f5a57603988e7
This commit is contained in:
Yang Chi
2019-05-02 13:58:41 -07:00
committed by Facebook Github Bot
parent 91f44b1159
commit 374c4e5b82
4 changed files with 12 additions and 23 deletions

View File

@@ -229,6 +229,8 @@ constexpr std::chrono::microseconds::rep kPersistentCongestionThreshold = 3;
constexpr std::chrono::microseconds::rep kPersistentCongestionPeriodFactor =
(((std::chrono::microseconds::rep)1 << kPersistentCongestionThreshold) - 1);
enum class CongestionControlType : uint8_t { Cubic, NewReno, Copa, BBR, None };
// This is an approximation of a small enough number for cwnd to be blocked.
constexpr size_t kBlockedSizeBytes = 20;
constexpr uint64_t kInitCwndInMss = 10;
constexpr uint64_t kMinCwndInMss = 2;

View File

@@ -348,6 +348,14 @@ void updateConnection(
conn.lossState.largestSent = std::max(conn.lossState.largestSent, packetNum);
if (conn.congestionController && !pureAck) {
conn.congestionController->onPacketSent(pkt);
// An approximation of the app being blocked. The app
// technically might not have bytes to write.
auto writableBytes = conn.congestionController->getWritableBytes();
bool cwndBlocked = writableBytes < kBlockedSizeBytes;
if (cwndBlocked) {
auto cwndBytes = conn.congestionController->getCongestionWindow();
QUIC_TRACE(cwnd_may_block, conn, writableBytes, cwndBytes);
}
}
if (pkt.isHandshake) {
++conn.outstandingHandshakePacketsCount;

View File

@@ -358,11 +358,8 @@ TEST_F(QuicTransportTest, WriteDataWithProbing) {
loopForWrites();
// Pending numProbePackets is cleared:
EXPECT_EQ(0, conn.pendingEvents.numProbePackets);
// getWritableBytes should be called with the same times as write
// getWritableBytes should happen exact one less time than socket write and
// onPacketSent on write path and one more time in the updateWriteLooper.
EXPECT_EQ(socketWriteCounter, getWritableBytesCounter);
EXPECT_EQ(onPacketSentCounter, getWritableBytesCounter);
// both write and onPacketSent will inquire getWritableBytes
EXPECT_EQ(onPacketSentCounter + socketWriteCounter, getWritableBytesCounter);
transport_->close(folly::none);
}

View File

@@ -10,13 +10,6 @@
#include <quic/congestion_control/CongestionControlFunctions.h>
#include <quic/state/QuicStateFunctions.h>
namespace {
// This is an approximation of a small enough number
// for cwnd to be blocked.
constexpr size_t kBlockedSizeBytes = 20;
}
namespace quic {
Cubic::Cubic(
@@ -89,17 +82,6 @@ void Cubic::onPacketSent(const OutstandingPacket& packet) {
LocalErrorCode::INFLIGHT_BYTES_OVERFLOW);
}
inflightBytes_ += packet.encodedSize;
// An approximation of the app being blocked. The app
// technically might not have bytes to write.
bool cwndBlocked = getWritableBytes() < kBlockedSizeBytes;
if (cwndBlocked) {
QUIC_TRACE(
cubic_may_block,
conn_,
cubicStateToString(state_).data(),
cwndBytes_,
inflightBytes_);
}
}
void Cubic::onPacketLoss(const LossEvent& loss) {