1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-24 04:01:07 +03:00

Add new qlog type for l4s weight updates

Summary:
This helps with tuning l4s reaction in Cubic and debugging l4s in general.

To avoid spamming the qlog, an l4s weights update is only logged if new CE marks are echoed from the peer.

Reviewed By: sharmafb

Differential Revision: D57874704

fbshipit-source-id: 9c3f139aec73fc0dbd8d38e2237d6a6478cf1e3d
This commit is contained in:
Joseph Beshay
2024-05-29 19:17:38 -07:00
committed by Facebook GitHub Bot
parent 05b4eb9238
commit 1ad1b0789b
7 changed files with 68 additions and 1 deletions

View File

@@ -53,6 +53,11 @@ void EcnL4sTracker::onPacketAck(const AckEvent* ackEvent) {
}
auto frac = newCEEchoed / (newCEEchoed + newECT1Echoed);
l4sWeight_ += kL4sWeightEwmaGain * (frac - l4sWeight_);
if (conn_.qLogger && newCEEchoed > 0) {
conn_.qLogger->addL4sWeightUpdate(
l4sWeight_, newECT1Echoed, newCEEchoed);
}
}
lastUpdateTime_ = ackEvent->ackTime;

View File

@@ -499,6 +499,16 @@ void FileQLogger::addPriorityUpdate(
streamId, urgency, incremental, refTime));
}
void FileQLogger::addL4sWeightUpdate(
double l4sWeight,
uint32_t newEct1,
uint32_t newCe) {
auto refTime = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now().time_since_epoch());
handleEvent(std::make_unique<quic::QLogL4sWeightUpdateEvent>(
l4sWeight, newEct1, newCe, refTime));
}
void FileQLogger::outputLogsToFile(const std::string& path, bool prettyJson) {
if (streaming_) {
return;

View File

@@ -112,6 +112,8 @@ class FileQLogger : public BaseQLogger {
quic::StreamId streamId,
uint8_t urgency,
bool incremental) override;
void addL4sWeightUpdate(double l4sWeight, uint32_t newEct1, uint32_t newCe)
override;
void outputLogsToFile(const std::string& path, bool prettyJson);
folly::dynamic toDynamic() const;

View File

@@ -122,6 +122,8 @@ class QLogger {
quic::StreamId streamId,
uint8_t urgency,
bool incremental) = 0;
virtual void
addL4sWeightUpdate(double l4sWeight, uint32_t newEct1, uint32_t newCe) = 0;
virtual void setDcid(folly::Optional<ConnectionId> connID) = 0;
virtual void setScid(folly::Optional<ConnectionId> connID) = 0;

View File

@@ -957,6 +957,31 @@ folly::dynamic QLogPriorityUpdateEvent::toDynamic() const {
return d;
}
QLogL4sWeightUpdateEvent::QLogL4sWeightUpdateEvent(
double l4sWeightIn,
uint32_t newECT1EchoedIn,
uint32_t newCEEchoedIn,
std::chrono::microseconds refTimeIn)
: l4sWeight_(l4sWeightIn),
newECT1Echoed_(newECT1EchoedIn),
newCEEchoed_(newCEEchoedIn) {
eventType = QLogEventType::L4sWeightUpdate;
refTime = refTimeIn;
}
folly::dynamic QLogL4sWeightUpdateEvent::toDynamic() const {
folly::dynamic d = folly::dynamic::array(
folly::to<std::string>(refTime.count()),
"metric_update",
toString(eventType));
folly::dynamic data = folly::dynamic::object();
data["weight"] = l4sWeight_;
data["new_ect1"] = newECT1Echoed_;
data["new_ce"] = newCEEchoed_;
d.push_back(std::move(data));
return d;
}
folly::StringPiece toString(QLogEventType type) {
switch (type) {
case QLogEventType::PacketSent:
@@ -1003,6 +1028,8 @@ folly::StringPiece toString(QLogEventType type) {
return "path_validation";
case QLogEventType::PriorityUpdate:
return "priority";
case QLogEventType::L4sWeightUpdate:
return "l4s_weight_update";
}
folly::assume_unreachable();
}

View File

@@ -396,7 +396,8 @@ enum class QLogEventType : uint32_t {
BandwidthEstUpdate,
ConnectionMigration,
PathValidation,
PriorityUpdate
PriorityUpdate,
L4sWeightUpdate
};
folly::StringPiece toString(QLogEventType type);
@@ -763,4 +764,20 @@ class QLogPriorityUpdateEvent : public QLogEvent {
bool incremental_;
};
class QLogL4sWeightUpdateEvent : public QLogEvent {
public:
explicit QLogL4sWeightUpdateEvent(
double l4sWeightIn,
uint32_t newECT1EchoedIn,
uint32_t newCEEchoedIn,
std::chrono::microseconds refTimeIn);
~QLogL4sWeightUpdateEvent() override = default;
FOLLY_NODISCARD folly::dynamic toDynamic() const override;
double l4sWeight_;
uint32_t newECT1Echoed_;
uint32_t newCEEchoed_;
};
} // namespace quic

View File

@@ -68,5 +68,9 @@ class MockQLogger : public QLogger {
MOCK_METHOD(void, setDcid, (folly::Optional<ConnectionId>));
MOCK_METHOD(void, setScid, (folly::Optional<ConnectionId>));
MOCK_METHOD(void, addPriorityUpdate, (quic::StreamId, uint8_t, bool));
MOCK_METHOD(
void,
addL4sWeightUpdate,
(double l4sWeight, uint32_t newEct1, uint32_t newCe));
};
} // namespace quic::test