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:
committed by
Facebook Github Bot
parent
91f44b1159
commit
374c4e5b82
@@ -229,6 +229,8 @@ constexpr std::chrono::microseconds::rep kPersistentCongestionThreshold = 3;
|
|||||||
constexpr std::chrono::microseconds::rep kPersistentCongestionPeriodFactor =
|
constexpr std::chrono::microseconds::rep kPersistentCongestionPeriodFactor =
|
||||||
(((std::chrono::microseconds::rep)1 << kPersistentCongestionThreshold) - 1);
|
(((std::chrono::microseconds::rep)1 << kPersistentCongestionThreshold) - 1);
|
||||||
enum class CongestionControlType : uint8_t { Cubic, NewReno, Copa, BBR, None };
|
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 kInitCwndInMss = 10;
|
||||||
constexpr uint64_t kMinCwndInMss = 2;
|
constexpr uint64_t kMinCwndInMss = 2;
|
||||||
|
@@ -348,6 +348,14 @@ void updateConnection(
|
|||||||
conn.lossState.largestSent = std::max(conn.lossState.largestSent, packetNum);
|
conn.lossState.largestSent = std::max(conn.lossState.largestSent, packetNum);
|
||||||
if (conn.congestionController && !pureAck) {
|
if (conn.congestionController && !pureAck) {
|
||||||
conn.congestionController->onPacketSent(pkt);
|
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) {
|
if (pkt.isHandshake) {
|
||||||
++conn.outstandingHandshakePacketsCount;
|
++conn.outstandingHandshakePacketsCount;
|
||||||
|
@@ -358,11 +358,8 @@ TEST_F(QuicTransportTest, WriteDataWithProbing) {
|
|||||||
loopForWrites();
|
loopForWrites();
|
||||||
// Pending numProbePackets is cleared:
|
// Pending numProbePackets is cleared:
|
||||||
EXPECT_EQ(0, conn.pendingEvents.numProbePackets);
|
EXPECT_EQ(0, conn.pendingEvents.numProbePackets);
|
||||||
// getWritableBytes should be called with the same times as write
|
// both write and onPacketSent will inquire getWritableBytes
|
||||||
// getWritableBytes should happen exact one less time than socket write and
|
EXPECT_EQ(onPacketSentCounter + socketWriteCounter, getWritableBytesCounter);
|
||||||
// onPacketSent on write path and one more time in the updateWriteLooper.
|
|
||||||
EXPECT_EQ(socketWriteCounter, getWritableBytesCounter);
|
|
||||||
EXPECT_EQ(onPacketSentCounter, getWritableBytesCounter);
|
|
||||||
transport_->close(folly::none);
|
transport_->close(folly::none);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -10,13 +10,6 @@
|
|||||||
#include <quic/congestion_control/CongestionControlFunctions.h>
|
#include <quic/congestion_control/CongestionControlFunctions.h>
|
||||||
#include <quic/state/QuicStateFunctions.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 {
|
namespace quic {
|
||||||
|
|
||||||
Cubic::Cubic(
|
Cubic::Cubic(
|
||||||
@@ -89,17 +82,6 @@ void Cubic::onPacketSent(const OutstandingPacket& packet) {
|
|||||||
LocalErrorCode::INFLIGHT_BYTES_OVERFLOW);
|
LocalErrorCode::INFLIGHT_BYTES_OVERFLOW);
|
||||||
}
|
}
|
||||||
inflightBytes_ += packet.encodedSize;
|
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) {
|
void Cubic::onPacketLoss(const LossEvent& loss) {
|
||||||
|
Reference in New Issue
Block a user