make cubic and flow more resilient
This commit is contained in:
parent
4ee5dd6ca5
commit
a1a9bf886a
@ -33,12 +33,14 @@ float CUBIC::getCWnD(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CUBIC::onCongestion(void) {
|
void CUBIC::onCongestion(void) {
|
||||||
if (getTimeNow() - _time_point_reduction >= getCurrentDelay()) {
|
if (getTimeNow() - _time_point_reduction >= getCurrentDelay()*4.f) {
|
||||||
const auto current_cwnd = getCWnD();
|
const auto current_cwnd = getCWnD();
|
||||||
_time_point_reduction = getTimeNow();
|
_time_point_reduction = getTimeNow();
|
||||||
_window_max = current_cwnd;
|
_window_max = current_cwnd * BETA;
|
||||||
|
_window_max = std::max(_window_max, 2.*MAXIMUM_SEGMENT_SIZE);
|
||||||
|
|
||||||
std::cout << "CONGESTION! cwnd:" << current_cwnd << "\n";
|
//std::cout << "CONGESTION! cwnd:" << current_cwnd << "\n";
|
||||||
|
std::cout << "CONGESTION! cwnd_max:" << _window_max << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,11 @@ float FlowOnly::getCurrentDelay(void) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FlowOnly::addRTT(float new_delay) {
|
void FlowOnly::addRTT(float new_delay) {
|
||||||
|
if (new_delay > _rtt_ema * RTT_UP_MAX) {
|
||||||
|
// too large a jump up, to be taken into account
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// lerp(new_delay, rtt_ema, 0.1)
|
// lerp(new_delay, rtt_ema, 0.1)
|
||||||
_rtt_ema = RTT_EMA_ALPHA * new_delay + (1.f - RTT_EMA_ALPHA) * _rtt_ema;
|
_rtt_ema = RTT_EMA_ALPHA * new_delay + (1.f - RTT_EMA_ALPHA) * _rtt_ema;
|
||||||
}
|
}
|
||||||
@ -88,13 +93,10 @@ void FlowOnly::onAck(std::vector<SeqIDType> seqs) {
|
|||||||
if (it != _in_flight.begin()) {
|
if (it != _in_flight.begin()) {
|
||||||
// not next expected seq -> skip detected
|
// not next expected seq -> skip detected
|
||||||
|
|
||||||
std::cout << "CONGESTION out of order\n";
|
// TODO: change expectations of next seq in order, so we dont trigger a flood of ce
|
||||||
|
|
||||||
|
//std::cout << "CONGESTION out of order\n";
|
||||||
onCongestion();
|
onCongestion();
|
||||||
//if (getTimeNow() >= _last_congestion_event + _last_congestion_rtt) {
|
|
||||||
//_recently_lost_data = true;
|
|
||||||
//_last_congestion_event = getTimeNow();
|
|
||||||
//_last_congestion_rtt = getCurrentDelay();
|
|
||||||
//}
|
|
||||||
} else {
|
} else {
|
||||||
// only mesure delay, if not a congestion
|
// only mesure delay, if not a congestion
|
||||||
addRTT(now - std::get<1>(*it));
|
addRTT(now - std::get<1>(*it));
|
||||||
@ -137,7 +139,7 @@ void FlowOnly::onLoss(SeqIDType seq, bool discard) {
|
|||||||
return; // not found, ignore ??
|
return; // not found, ignore ??
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cerr << "FLOW loss\n";
|
//std::cerr << "FLOW loss\n";
|
||||||
|
|
||||||
// "if data lost is not to be retransmitted"
|
// "if data lost is not to be retransmitted"
|
||||||
if (discard) {
|
if (discard) {
|
||||||
|
@ -11,7 +11,8 @@ struct FlowOnly : public CCAI {
|
|||||||
using clock = std::chrono::steady_clock;
|
using clock = std::chrono::steady_clock;
|
||||||
|
|
||||||
public: // config
|
public: // config
|
||||||
static constexpr float RTT_EMA_ALPHA = 0.1f; // might need over time
|
static constexpr float RTT_EMA_ALPHA = 0.001f; // might need change over time
|
||||||
|
static constexpr float RTT_UP_MAX = 3.0f; // how much larger a delay can be to be taken into account
|
||||||
static constexpr float RTT_MAX = 2.f; // 2 sec is probably too much
|
static constexpr float RTT_MAX = 2.f; // 2 sec is probably too much
|
||||||
|
|
||||||
//float max_byterate_allowed {100.f*1024*1024}; // 100MiB/s
|
//float max_byterate_allowed {100.f*1024*1024}; // 100MiB/s
|
||||||
|
@ -599,7 +599,8 @@ bool NGCFT1::onEvent(const Events::NGCEXT_ft1_data_ack& e) {
|
|||||||
|
|
||||||
Group::Peer& peer = groups[e.group_number].peers[e.peer_number];
|
Group::Peer& peer = groups[e.group_number].peers[e.peer_number];
|
||||||
if (!peer.send_transfers[e.transfer_id].has_value()) {
|
if (!peer.send_transfers[e.transfer_id].has_value()) {
|
||||||
std::cerr << "NGCFT1 warning: data_ack for unknown transfer\n";
|
// we delete directly, packets might still be in flight (in practice they are when ce)
|
||||||
|
//std::cerr << "NGCFT1 warning: data_ack for unknown transfer\n";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user