Skip to content

Commit

Permalink
fix to limit rate increase to no more than double during slow start
Browse files Browse the repository at this point in the history
  • Loading branch information
bebopagogo committed Jan 2, 2025
1 parent 0c6e516 commit bc6e81f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/common/normNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2824,12 +2824,15 @@ void NormSenderNode::UpdateRecvRate(const struct timeval& currentTime, unsigned
{
// Approximate initial recv_rate when initial packets arrive in a burst
recv_rate = recv_accumulator.GetValue() / NORM_TICK_MIN;
TRACE("BURST INIT: accum:%lf tick:%lf rate:%lf kbps\n", recv_accumulator.GetValue(), NORM_TICK_MIN, recv_rate*8.0e-03);
recv_rate_prev = 0.0;
}
nominal_packet_size += 0.05 * (((double)msgSize) - nominal_packet_size);
TRACE("UPDATED RECV rate: %lf kbps nsize: %lf\n", 8.0e-3*recv_rate, nominal_packet_size);
}
else
{
TRACE("RATE INIT ZERO\n");
recv_rate = recv_rate_prev = 0.0;
prev_update_time = currentTime;
recv_accumulator.Reset();
Expand Down
10 changes: 9 additions & 1 deletion src/common/normSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2782,7 +2782,8 @@ void NormTrace(const struct timeval &currentTime,
// Print ccRtt (only valid if pcap file is from sender node)
double ccRtt = NormUnquantizeRtt(((NormCCFeedbackExtension &)ext).GetCCRtt());
double ccLoss = NormUnquantizeLoss32(((NormCCFeedbackExtension &)ext).GetCCLoss32());
PLOG(PL_ALWAYS, "ccRtt:%lf ccLoss:%lf ", ccRtt, ccLoss);
double ccRate = 8.0e-03 * NormUnquantizeRate(((NormCCFeedbackExtension &)ext).GetCCRate());
PLOG(PL_ALWAYS, "ccRtt:%lf ccLoss:%lf ccRate:%lf kbps ", ccRtt, ccLoss, ccRate);
// Print locally measured rtt (only valid if pcap file is from sender node)
struct timeval grttResponse;
if (NormMsg::NACK == msgType)
Expand Down Expand Up @@ -5540,6 +5541,9 @@ void NormSession::AdjustRate(bool onResponse)
if (cc_slow_start)
{
txRate = clr->GetRate();
// Don't adjust rate more than double per RTT during slow start
double rateDouble = 2.0*tx_rate;
if (txRate > rateDouble) txRate = rateDouble;
if (GetDebugLevel() >= 6)
{
double sentRate = 8.0e-03 * sent_accumulator.GetScaledValue(1.0 / (report_timer.GetInterval() - report_timer.GetTimeRemaining()));
Expand Down Expand Up @@ -5647,10 +5651,14 @@ void NormSession::AdjustRate(bool onResponse)
}
}
}
// Limit rate to tx_rate_max if that has been set
if ((tx_rate_max >= 0.0) && (txRate > tx_rate_max))
txRate = tx_rate_max;
if (txRate != tx_rate)
{
// TBD - don't adjust rate more than double per RTT all the time???
//double rateDouble = 2.0*tx_rate;
//if (txRate > rateDouble) txRate = rateDouble;
if (cc_adjust)
SetTxRateInternal(txRate);
if (!posted_tx_rate_changed)
Expand Down
14 changes: 13 additions & 1 deletion src/common/pcap2norm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,19 @@ int main(int argc, char *argv[])
ProtoPktETH::Type ethType;
unsigned int payloadLength;
UINT32 *payloadPtr;
if (DLT_NULL == deviceType)
if (DLT_LINUX_SLL == deviceType)
{
// For now, assume the header is 16 bytes (6-byte link addr)
// TBD - do proper DLT_LINUX_SLL parsing
memcpy(alignedBuffer, pktData, numBytes);
//ethType = (ProtoPktETH::Type)ntohs(((UINT16*)alignedBuffer)[7]);
payloadPtr = alignedBuffer + 4; // assumes 16 byte header
//ipBufferBytes = maxBytes + 2 - 16;
payloadLength = numBytes - 16;
ethType = ProtoPktETH::IP;

}
else if (DLT_NULL == deviceType)
{
// pcap was captured from "loopback" device
memcpy(alignedBuffer, pktData, numBytes);
Expand Down

0 comments on commit bc6e81f

Please sign in to comment.