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

Packets inflight, packets sent in OutstandingPacketMetadata

Summary:
- Adds counter of the number of ack-eliciting packets sent; useful for understanding lost / retransmission numbers
- Adds the following to `OutstandingPacketMetadata`
  - # of packets sent and # of ack-eliciting packets sent; this enables indexing of each packet when processed by an observer on loss / RTT event, including understanding its ordering in the flow of sent packets.
  - # of packets in flight; useful during loss analysis to understand if self-induced congestion could be culprit
- Fixes the inflightBytes counter in `OutstandingPacketMetadata`; it was previously _not_ including the packets own bytes, despite saying that it was.

Right now we are passing multiple integers into the `OutstandingPacket` constructor. I've switched to passing in `LossState` to avoid passing in two more integers, although I will need to come back and clean up the existing ones.

Differential Revision: D25861702

fbshipit-source-id: e34c0edcb136bc1a2a6aeb898ecbb4cf11d0aa2c
This commit is contained in:
Brandon Schlinker
2021-01-21 21:10:07 -08:00
committed by Facebook GitHub Bot
parent 4c5874e062
commit f206c5125b
18 changed files with 356 additions and 150 deletions

View File

@@ -908,6 +908,9 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionWithPureAck) {
std::make_unique<NiceMock<MockCongestionController>>();
auto rawController = mockCongestionController.get();
conn->congestionController = std::move(mockCongestionController);
EXPECT_EQ(0, conn->lossState.totalPacketsSent);
EXPECT_EQ(0, conn->lossState.totalAckElicitingPacketsSent);
EXPECT_EQ(0, conn->outstandings.packets.size());
ASSERT_EQ(0, conn->lossState.totalBytesAcked);
WriteAckFrame ackFrame;
ackFrame.ackBlocks.emplace_back(0, 10);
@@ -916,6 +919,8 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionWithPureAck) {
EXPECT_CALL(*rawPacer, onPacketSent()).Times(0);
updateConnection(
*conn, folly::none, packet.packet, TimePoint(), getEncodedSize(packet));
EXPECT_EQ(1, conn->lossState.totalPacketsSent);
EXPECT_EQ(0, conn->lossState.totalAckElicitingPacketsSent);
EXPECT_EQ(0, conn->outstandings.packets.size());
EXPECT_EQ(0, conn->lossState.totalBytesAcked);
std::shared_ptr<quic::FileQLogger> qLogger =
@@ -947,13 +952,18 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionWithBytesStats) {
packet.packet.frames.push_back(std::move(writeStreamFrame));
conn->lossState.totalBytesSent = 13579;
conn->lossState.totalBytesAcked = 8642;
conn->lossState.inflightBytes = 16000;
auto currentTime = Clock::now();
conn->lossState.lastAckedTime = currentTime - 123s;
conn->lossState.adjustedLastAckedTime = currentTime - 123s;
conn->lossState.lastAckedPacketSentTime = currentTime - 234s;
conn->lossState.totalBytesSentAtLastAck = 10000;
conn->lossState.totalBytesAckedAtLastAck = 5000;
conn->lossState.totalPacketsSent = 20;
conn->lossState.totalAckElicitingPacketsSent = 15;
updateConnection(*conn, folly::none, packet.packet, TimePoint(), 555);
EXPECT_EQ(21, conn->lossState.totalPacketsSent);
EXPECT_EQ(16, conn->lossState.totalAckElicitingPacketsSent);
// verify QLogger contains correct packet information
std::shared_ptr<quic::FileQLogger> qLogger =
@@ -972,6 +982,27 @@ TEST_F(QuicTransportFunctionsTest, TestUpdateConnectionWithBytesStats) {
13579 + 555,
getFirstOutstandingPacket(*conn, PacketNumberSpace::Handshake)
->metadata.totalBytesSent);
EXPECT_EQ(
16000 + 555,
getFirstOutstandingPacket(*conn, PacketNumberSpace::Handshake)
->metadata.inflightBytes);
EXPECT_EQ(
1,
getFirstOutstandingPacket(*conn, PacketNumberSpace::Handshake)
->metadata.packetsInflight);
EXPECT_EQ(
555,
getFirstOutstandingPacket(*conn, PacketNumberSpace::Handshake)
->metadata.encodedSize);
EXPECT_EQ(
20 + 1,
getFirstOutstandingPacket(*conn, PacketNumberSpace::Handshake)
->metadata.totalPacketsSent);
EXPECT_EQ(
15 + 1,
getFirstOutstandingPacket(*conn, PacketNumberSpace::Handshake)
->metadata.totalAckElicitingPacketsSent);
EXPECT_TRUE(getFirstOutstandingPacket(*conn, PacketNumberSpace::Handshake)
->lastAckedPacketInfo.has_value());
EXPECT_EQ(