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

Use new priority queue implementation

Summary:
This adds the new priority queue implementation and a TransportSetting that controls whether it should be used or not.  The default is still the old priority queue, so this diff should not introduce any functional changes in production code.

One key difference is that with the new queue, streams with new data that become connection flow control blocked are *removed* from the queue, and added back once more flow control comes.  I think this will make the scheduler slightly more efficient at writing low-priority loss streams when there's high-pri data and no connection flow control, since it doesn't need to skip over those streams when building the packet.

If this diff regresses build size, D72476484 should get it back.

Reviewed By: mjoras

Differential Revision: D72476486

fbshipit-source-id: 9665cf3f66dcdbfd57d2199d5c832529a68cfac0
This commit is contained in:
Alan Frindell
2025-04-17 08:43:19 -07:00
committed by Facebook GitHub Bot
parent 47da181ae8
commit 1e1c7defef
15 changed files with 696 additions and 177 deletions

View File

@@ -124,6 +124,14 @@ class QuicTransportTest : public Test {
return MockByteEventCallback::getTxMatcher(id, offset);
}
StreamId nextScheduledStreamID(QuicConnectionStateBase& conn) {
auto oldWriteQueue = conn.streamManager->oldWriteQueue();
if (oldWriteQueue) {
return oldWriteQueue->getNextScheduledStream();
}
return conn.streamManager->writeQueue().peekNextScheduledID().asStreamID();
}
protected:
folly::EventBase evb_;
std::shared_ptr<FollyQuicEventBase> qEvb_;
@@ -4606,8 +4614,8 @@ TEST_F(QuicTransportTest, WriteStreamFromMiddleOfMap) {
EXPECT_EQ(streamFrame->streamId, s1);
conn.outstandings.reset();
// Start from stream2 instead of stream1
conn.streamManager->writeQueue().setNextScheduledStream(s2);
// Queue already points to stream2
EXPECT_EQ(nextScheduledStreamID(conn), stream2->id);
writableBytes = kDefaultUDPSendPacketLen - 100;
EXPECT_CALL(*socket_, write(_, _, _))
@@ -4633,8 +4641,13 @@ TEST_F(QuicTransportTest, WriteStreamFromMiddleOfMap) {
EXPECT_EQ(streamFrame2->streamId, s2);
conn.outstandings.reset();
// Test wrap around
conn.streamManager->writeQueue().setNextScheduledStream(s2);
// Test wrap around by skipping a stream
auto oldWriteQueue = conn.streamManager->oldWriteQueue();
if (oldWriteQueue) {
oldWriteQueue->setNextScheduledStream(s2);
} else {
conn.streamManager->writeQueue().getNextScheduledID(quic::none);
}
writableBytes = kDefaultUDPSendPacketLen;
EXPECT_CALL(*socket_, write(_, _, _))
.WillOnce(testing::WithArgs<1, 2>(Invoke(getTotalIovecLen)));