ledbat tweaks

This commit is contained in:
Green Sky 2023-03-12 18:48:33 +01:00
parent 95bfa2473c
commit 304aae05c2
No known key found for this signature in database
2 changed files with 11 additions and 13 deletions

View File

@ -187,18 +187,18 @@ void LEDBAT::updateWindows(void) {
if (now - _last_cwnd >= current_delay) {
const float queuing_delay {current_delay - _base_delay};
_fwnd = max_byterate_allowed * getCurrentDelay();
_fwnd = max_byterate_allowed * current_delay;
_fwnd *= 1.3f; // try do balance conservative algo a bit, current_delay
//const float gain {1}; // TODO: move and increase
float gain {1.f / std::min(16.f, std::ceil(2.f*target_delay/_base_delay))};
//gain *= 400.f; // from packets to bytes ~
gain *= _recently_acked_data/10.f; // from packets to bytes ~
gain *= _recently_acked_data/5.f; // from packets to bytes ~
//gain *= 0.1f;
if (_recently_lost_data) {
_cwnd = std::clamp(
_cwnd / 2.f,
//_cwnd / 2.f,
_cwnd / 1.6f,
2.f * maximum_segment_size,
_cwnd
);
@ -207,23 +207,22 @@ void LEDBAT::updateWindows(void) {
// "Multiplicative decrease"
const float constant {2.f}; // spec recs 1
if (queuing_delay < target_delay) {
_cwnd += gain;
_cwnd = std::min(
_cwnd + gain,
_fwnd
);
} else if (queuing_delay > target_delay) {
_cwnd = std::clamp(
_cwnd + std::max( // TODO: where to put bytes_newly_acked
_cwnd + std::max(
gain - constant * _cwnd * (queuing_delay / target_delay - 1.f),
-_cwnd/2.f // at most halve
),
// never drop below 2 "packets" in flight
//2.f * maximum_segment_size,
2.f * 496,
2.f * maximum_segment_size,
current_delay * max_byterate_allowed // cap rate
// cap rate
_fwnd
);
} // no else, we on point. very unlikely with float
}

View File

@ -29,8 +29,8 @@ struct LEDBAT {
static_assert(maximum_segment_size == 574); // mesured in wireshark
// ledbat++ says 60ms, we might need other values if relayed
//const float target_delay {0.060f};
const float target_delay {0.030f};
const float target_delay {0.060f};
//const float target_delay {0.030f};
//const float target_delay {0.120f}; // 2x if relayed?
// TODO: use a factor for multiple of rtt
@ -38,8 +38,7 @@ struct LEDBAT {
//static constexpr size_t rtt_buffer_size_max {2000};
//float max_byterate_allowed {10*1024*1024}; // 10MiB/s
float max_byterate_allowed {1*1024*1024};
float max_byterate_allowed {10*1024*1024}; // 10MiB/s
public:
LEDBAT(void);