mirror of
https://github.com/facebookincubator/mvfst.git
synced 2026-01-06 03:41:10 +03:00
Limit write loop time by a fraction of RTT
Summary: Before we have pacing, we limit write function to loop at most 5 times. Then pacing came in, and pacing burst is used as the limit when pacing is enabled. Then pacing token was introduced to increase send rate when pacing is enabled. Then when cwnd is large enough, pacing burst size can be really large, that means this write function can loop for long time. When use loopback as network interface, for example, the write function can loop more than 1 RTT, which delays receive time when peer packets already arrived, which leads to both wrong RTT estimation and wrong BBR bandwidth estimation. This diff limits the write to a fraction of RTT as well, and current default value will be 1/25 SRTT. Reviewed By: mjoras Differential Revision: D18864699 fbshipit-source-id: 0b57ee4138e4788d132152a4aa363959065f6f7f
This commit is contained in:
committed by
Facebook Github Bot
parent
b8bac00147
commit
68e0a1add2
@@ -927,7 +927,22 @@ uint64_t writeConnectionDataToSocket(
|
||||
connection.debugState.noWriteReason = NoWriteReason::EMPTY_SCHEDULER;
|
||||
}
|
||||
}
|
||||
while (scheduler.hasData() && ioBufBatch.getPktSent() < packetLimit) {
|
||||
auto writeLoopBeginTime = Clock::now();
|
||||
// helper functor to check if we have been write in a loop for longer than the
|
||||
// RTT fraction that we are allowed to write. Only kicks in if we have write
|
||||
// one batch in batching write mode.
|
||||
auto timeLimitHelper = [&]() -> bool {
|
||||
auto batchSize = connection.transportSettings.batchingMode ==
|
||||
quic::QuicBatchingMode::BATCHING_MODE_NONE
|
||||
? connection.transportSettings.writeConnectionDataPacketsLimit
|
||||
: connection.transportSettings.maxBatchSize;
|
||||
return ioBufBatch.getPktSent() < batchSize ||
|
||||
connection.lossState.srtt == 0us ||
|
||||
Clock::now() - writeLoopBeginTime < connection.lossState.srtt /
|
||||
connection.transportSettings.writeLimitRttFraction;
|
||||
};
|
||||
while (scheduler.hasData() && ioBufBatch.getPktSent() < packetLimit &&
|
||||
timeLimitHelper()) {
|
||||
auto packetNum = getNextPacketNum(connection, pnSpace);
|
||||
auto header = builder(srcConnId, dstConnId, packetNum, version, token);
|
||||
uint32_t writableBytes = folly::to<uint32_t>(std::min<uint64_t>(
|
||||
|
||||
Reference in New Issue
Block a user