From a98b1d3ab67af5d14039cc277ad4532d99036355 Mon Sep 17 00:00:00 2001 From: Mike Perry Date: Mon, 8 May 2023 14:44:38 +0000 Subject: [PATCH] Remove two conflux algs: maxrate and cwndrate. Maxrate had slower throughput than lowrtt in Shadow, which is not too surprising. We just wanted to test it. --- src/core/or/conflux.c | 131 --------------------------------------- src/core/or/conflux_st.h | 2 - 2 files changed, 133 deletions(-) diff --git a/src/core/or/conflux.c b/src/core/or/conflux.c index e9a66b83e1..e2e9460c06 100644 --- a/src/core/or/conflux.c +++ b/src/core/or/conflux.c @@ -438,133 +438,6 @@ conflux_decide_circ_cwndrtt(const conflux_t *cfx) return leg->circ; } -/** - * Favor the circuit with the highest send rate. - * - * Only spill over to other circuits if they are still in slow start. - * In steady-state, we only use the max throughput circuit. - */ -static const circuit_t * -conflux_decide_circ_maxrate(const conflux_t *cfx) -{ - uint64_t max_rate = 0; - const conflux_leg_t *leg = NULL; - - /* Find the highest bandwidth leg */ - CONFLUX_FOR_EACH_LEG_BEGIN(cfx, l) { - uint64_t rate; - const congestion_control_t *cc = circuit_ccontrol(l->circ); - - rate = CELL_MAX_NETWORK_SIZE*USEC_PER_SEC * - cc->cwnd / l->circ_rtts_usec; - if (rate > max_rate) { - max_rate = rate; - leg = l; - } - } CONFLUX_FOR_EACH_LEG_END(l); - - /* If the package window is has room, use it */ - if (leg && circuit_ready_to_send(leg->circ)) { - return leg->circ; - } - - leg = NULL; - max_rate = 0; - - /* Find the circuit with the max rate where in_slow_start == 1: */ - CONFLUX_FOR_EACH_LEG_BEGIN(cfx, l) { - uint64_t rate; - /* Ignore circuits with no room in the package window */ - if (!circuit_ready_to_send(l->circ)) { - continue; - } - - const congestion_control_t *cc = circuit_ccontrol(l->circ); - - rate = CELL_MAX_NETWORK_SIZE*USEC_PER_SEC * - cc->cwnd / l->circ_rtts_usec; - - if (rate > max_rate && cc->in_slow_start) { - max_rate = rate; - leg = l; - } - } CONFLUX_FOR_EACH_LEG_END(l); - - /* If no sendable leg was found, don't send on any circuit. */ - if (!leg) { - return NULL; - } - return leg->circ; -} - -/** - * Favor the circuit with the highest send rate that still has space - * in the congestion window, but when it is full, pick the next - * highest. - */ -static const circuit_t * -conflux_decide_circ_highrate(const conflux_t *cfx) -{ - uint64_t max_rate = 0; - uint64_t primary_leg_rtt = 0; - const conflux_leg_t *leg = NULL; - - /* Find the highest bandwidth leg */ - CONFLUX_FOR_EACH_LEG_BEGIN(cfx, l) { - uint64_t rate; - const congestion_control_t *cc = circuit_ccontrol(l->circ); - - rate = CELL_MAX_NETWORK_SIZE*USEC_PER_SEC * - cc->cwnd / l->circ_rtts_usec; - - if (rate > max_rate) { - max_rate = rate; - primary_leg_rtt = l->circ_rtts_usec; - leg = l; - } - } CONFLUX_FOR_EACH_LEG_END(l); - - /* If the package window is has room, use it */ - if (leg && circuit_ready_to_send(leg->circ)) { - return leg->circ; - } - - /* Reset the max rate to find a new max */ - max_rate = 0; - leg = NULL; - - /* For any given leg, it has primary_leg_rtt/2 time before the 'primary' - * leg's acks start arriving. So, the amount of data a 'secondary' - * leg can send while the primary leg transmits these acks is: - * (cwnd_leg/(secondary_rtt/2))*primary_rtt/2 - * = cwnd_leg*primary_rtt/secondary_rtt. - * So any leg with available room below that that is no good. - */ - CONFLUX_FOR_EACH_LEG_BEGIN(cfx, l) { - if (!circuit_ready_to_send(l->circ)) { - continue; - } - const congestion_control_t *cc = circuit_ccontrol(l->circ); - - uint64_t rate = CELL_MAX_NETWORK_SIZE*USEC_PER_SEC * - cc->cwnd / l->circ_rtts_usec; - - /* Pick the leg with the highest rate that still has room */ - if (rate > max_rate && - cwnd_sendable(l->circ, primary_leg_rtt, l->circ_rtts_usec) <= - cwnd_available(l->circ)) { - leg = l; - max_rate = rate; - } - } CONFLUX_FOR_EACH_LEG_END(l); - - /* If no sendable leg was found, don't send on any circuit. */ - if (!leg) { - return NULL; - } - return leg->circ; -} - /** * This function is called when we want to send a relay cell on a * conflux, as well as when we want to compute available space in @@ -736,10 +609,6 @@ conflux_decide_next_circ(conflux_t *cfx) return (circuit_t*)conflux_decide_circ_lowrtt(cfx); case CONFLUX_ALG_CWNDRTT: // throughput (low oooq) return (circuit_t*)conflux_decide_circ_cwndrtt(cfx); - case CONFLUX_ALG_MAXRATE: // perf test (likely high ooq) - return (circuit_t*)conflux_decide_circ_maxrate(cfx); - case CONFLUX_ALG_HIGHRATE: // perf test (likely high ooq) - return (circuit_t*)conflux_decide_circ_highrate(cfx); default: return NULL; } diff --git a/src/core/or/conflux_st.h b/src/core/or/conflux_st.h index dae4845cb6..af2e4db7b8 100644 --- a/src/core/or/conflux_st.h +++ b/src/core/or/conflux_st.h @@ -20,8 +20,6 @@ typedef enum { CONFLUX_ALG_MINRTT = 0, CONFLUX_ALG_LOWRTT = 1, CONFLUX_ALG_CWNDRTT = 2, - CONFLUX_ALG_MAXRATE = 3, - CONFLUX_ALG_HIGHRATE = 4 } conflux_alg_t; /**