mirror of
https://github.com/overte-org/overte.git
synced 2025-07-04 04:49:10 +02:00
add comment about Jacobson's formula for RTT estimation
This commit is contained in:
parent
1041443796
commit
d5a450ad30
1 changed files with 16 additions and 5 deletions
|
@ -49,15 +49,26 @@ bool TCPVegasCC::onACK(SequenceNumber ack, p_high_resolution_clock::time_point r
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_ewmaRTT == -1) {
|
if (_ewmaRTT == -1) {
|
||||||
|
// first RTT sample - set _ewmaRTT to the value and set the variance to half the value
|
||||||
_ewmaRTT = lastRTT;
|
_ewmaRTT = lastRTT;
|
||||||
_rttVariance = lastRTT / 2;
|
_rttVariance = lastRTT / 2;
|
||||||
} else {
|
} else {
|
||||||
static const int RTT_ESTIMATION_ALPHA_NUMERATOR = 8;
|
// This updates the RTT using exponential weighted moving average
|
||||||
static const int RTT_ESTIMATION_VARIANCE_ALPHA_NUMERATOR = 4;
|
// This is the Jacobson's forumla for RTT estimation
|
||||||
|
// http://www.mathcs.emory.edu/~cheung/Courses/455/Syllabus/7-transport/Jacobson-88.pdf
|
||||||
|
|
||||||
_ewmaRTT = (_ewmaRTT * (RTT_ESTIMATION_ALPHA_NUMERATOR - 1) + lastRTT) / RTT_ESTIMATION_ALPHA_NUMERATOR;
|
// Estimated RTT = (1 - x)(estimatedRTT) + (x)(sampleRTT)
|
||||||
_rttVariance = (_rttVariance * (RTT_ESTIMATION_VARIANCE_ALPHA_NUMERATOR - 1)
|
// (where x = 0.125 via Jacobson)
|
||||||
+ abs(lastRTT - _ewmaRTT)) / RTT_ESTIMATION_VARIANCE_ALPHA_NUMERATOR;
|
|
||||||
|
// Deviation = (1 - x)(deviation) + x |sampleRTT - estimatedRTT|
|
||||||
|
// (where x = 0.25 via Jacobson)
|
||||||
|
|
||||||
|
static const int RTT_ESTIMATION_ALPHA = 8;
|
||||||
|
static const int RTT_ESTIMATION_VARIANCE_ALPHA = 4;
|
||||||
|
|
||||||
|
_ewmaRTT = (_ewmaRTT * (RTT_ESTIMATION_ALPHA - 1) + lastRTT) / RTT_ESTIMATION_ALPHA;
|
||||||
|
_rttVariance = (_rttVariance * (RTT_ESTIMATION_VARIANCE_ALPHA- 1)
|
||||||
|
+ abs(lastRTT - _ewmaRTT)) / RTT_ESTIMATION_VARIANCE_ALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add 1 to the number of ACKs during this RTT
|
// add 1 to the number of ACKs during this RTT
|
||||||
|
|
Loading…
Reference in a new issue