mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Add a delta parameter to Vegas.
This allows us to cap the queue use during steady state. In shadow, this reduced instances of long circuit queues at relays.
This commit is contained in:
parent
3a3f111b23
commit
a956b20c1d
@ -103,6 +103,8 @@ struct vegas_params_t {
|
||||
uint16_t alpha;
|
||||
/** The queue use above which we decrement cwnd */
|
||||
uint16_t beta;
|
||||
/** The queue use at which we cap cwnd in steady state */
|
||||
uint16_t delta;
|
||||
/** Weighted average (percent) between cwnd estimator and
|
||||
* piecewise estimator. */
|
||||
uint8_t bdp_mix_pct;
|
||||
|
@ -29,27 +29,32 @@
|
||||
#define VEGAS_ALPHA_SBWS_DFLT (2*OUTBUF_CELLS-TLS_RECORD_MAX_CELLS)
|
||||
#define VEGAS_BETA_SBWS_DFLT (2*OUTBUF_CELLS)
|
||||
#define VEGAS_GAMMA_SBWS_DFLT (2*OUTBUF_CELLS)
|
||||
#define VEGAS_DELTA_SBWS_DFLT (4*OUTBUF_CELLS)
|
||||
|
||||
/* Exits are three hops, so params are based on 3 outbufs of cells */
|
||||
#define VEGAS_ALPHA_EXIT_DFLT (3*OUTBUF_CELLS-TLS_RECORD_MAX_CELLS)
|
||||
#define VEGAS_BETA_EXIT_DFLT (3*OUTBUF_CELLS)
|
||||
#define VEGAS_GAMMA_EXIT_DFLT (3*OUTBUF_CELLS)
|
||||
#define VEGAS_DELTA_EXIT_DFLT (5*OUTBUF_CELLS)
|
||||
|
||||
/* Onion rends are six hops, so params are based on 6 outbufs of cells */
|
||||
#define VEGAS_ALPHA_ONION_DFLT (6*OUTBUF_CELLS-TLS_RECORD_MAX_CELLS)
|
||||
#define VEGAS_BETA_ONION_DFLT (6*OUTBUF_CELLS)
|
||||
#define VEGAS_GAMMA_ONION_DFLT (6*OUTBUF_CELLS)
|
||||
#define VEGAS_DELTA_ONION_DFLT (8*OUTBUF_CELLS)
|
||||
|
||||
/* Single Onions are three hops, so params are based on 3 outbufs of cells */
|
||||
#define VEGAS_ALPHA_SOS_DFLT (3*OUTBUF_CELLS-TLS_RECORD_MAX_CELLS)
|
||||
#define VEGAS_BETA_SOS_DFLT (3*OUTBUF_CELLS)
|
||||
#define VEGAS_GAMMA_SOS_DFLT (3*OUTBUF_CELLS)
|
||||
#define VEGAS_DELTA_SOS_DFLT (5*OUTBUF_CELLS)
|
||||
|
||||
/* Vanguard Onions are 7 hops (or 8 if both sides use vanguards, but that
|
||||
* should be rare), so params are based on 7 outbufs of cells */
|
||||
#define VEGAS_ALPHA_VG_DFLT (7*OUTBUF_CELLS-TLS_RECORD_MAX_CELLS)
|
||||
#define VEGAS_BETA_VG_DFLT (7*OUTBUF_CELLS)
|
||||
#define VEGAS_GAMMA_VG_DFLT (7*OUTBUF_CELLS)
|
||||
#define VEGAS_DELTA_VG_DFLT (9*OUTBUF_CELLS)
|
||||
|
||||
#define VEGAS_BDP_MIX_PCT 100
|
||||
|
||||
@ -81,48 +86,59 @@ congestion_control_vegas_set_params(congestion_control_t *cc,
|
||||
{
|
||||
tor_assert(cc->cc_alg == CC_ALG_VEGAS);
|
||||
const char *alpha_str = NULL, *beta_str = NULL, *gamma_str = NULL;
|
||||
int alpha, beta, gamma;
|
||||
const char *delta_str = NULL;
|
||||
int alpha, beta, gamma, delta;
|
||||
|
||||
switch (path) {
|
||||
case CC_PATH_SBWS:
|
||||
alpha_str = "cc_vegas_alpha_sbws";
|
||||
beta_str = "cc_vegas_beta_sbws";
|
||||
gamma_str = "cc_vegas_gamma_sbws";
|
||||
delta_str = "cc_vegas_delta_sbws";
|
||||
alpha = VEGAS_ALPHA_SBWS_DFLT;
|
||||
beta = VEGAS_BETA_SBWS_DFLT;
|
||||
gamma = VEGAS_GAMMA_SBWS_DFLT;
|
||||
delta = VEGAS_DELTA_SBWS_DFLT;
|
||||
break;
|
||||
case CC_PATH_EXIT:
|
||||
alpha_str = "cc_vegas_alpha_exit";
|
||||
beta_str = "cc_vegas_beta_exit";
|
||||
gamma_str = "cc_vegas_gamma_exit";
|
||||
delta_str = "cc_vegas_delta_exit";
|
||||
alpha = VEGAS_ALPHA_EXIT_DFLT;
|
||||
beta = VEGAS_BETA_EXIT_DFLT;
|
||||
gamma = VEGAS_GAMMA_EXIT_DFLT;
|
||||
delta = VEGAS_DELTA_EXIT_DFLT;
|
||||
break;
|
||||
case CC_PATH_ONION:
|
||||
alpha_str = "cc_vegas_alpha_onion";
|
||||
beta_str = "cc_vegas_beta_onion";
|
||||
gamma_str = "cc_vegas_gamma_onion";
|
||||
delta_str = "cc_vegas_delta_onion";
|
||||
alpha = VEGAS_ALPHA_ONION_DFLT;
|
||||
beta = VEGAS_BETA_ONION_DFLT;
|
||||
gamma = VEGAS_GAMMA_ONION_DFLT;
|
||||
delta = VEGAS_DELTA_ONION_DFLT;
|
||||
break;
|
||||
case CC_PATH_ONION_SOS:
|
||||
alpha_str = "cc_vegas_alpha_sos";
|
||||
beta_str = "cc_vegas_beta_sos";
|
||||
gamma_str = "cc_vegas_gamma_sos";
|
||||
delta_str = "cc_vegas_delta_sos";
|
||||
alpha = VEGAS_ALPHA_SOS_DFLT;
|
||||
beta = VEGAS_BETA_SOS_DFLT;
|
||||
gamma = VEGAS_GAMMA_SOS_DFLT;
|
||||
delta = VEGAS_DELTA_SOS_DFLT;
|
||||
break;
|
||||
case CC_PATH_ONION_VG:
|
||||
alpha_str = "cc_vegas_alpha_vg";
|
||||
beta_str = "cc_vegas_beta_vg";
|
||||
gamma_str = "cc_vegas_gamma_vg";
|
||||
delta_str = "cc_vegas_delta_vg";
|
||||
alpha = VEGAS_ALPHA_VG_DFLT;
|
||||
beta = VEGAS_BETA_VG_DFLT;
|
||||
gamma = VEGAS_GAMMA_VG_DFLT;
|
||||
delta = VEGAS_DELTA_VG_DFLT;
|
||||
break;
|
||||
default:
|
||||
tor_assert(0);
|
||||
@ -147,6 +163,12 @@ congestion_control_vegas_set_params(congestion_control_t *cc,
|
||||
0,
|
||||
1000);
|
||||
|
||||
cc->vegas_params.delta =
|
||||
networkstatus_get_param(NULL, delta_str,
|
||||
delta,
|
||||
0,
|
||||
INT32_MAX);
|
||||
|
||||
cc->vegas_params.bdp_mix_pct =
|
||||
networkstatus_get_param(NULL, "cc_vegas_bdp_mix",
|
||||
VEGAS_BDP_MIX_PCT,
|
||||
@ -216,7 +238,9 @@ congestion_control_vegas_process_sendme(congestion_control_t *cc,
|
||||
log_info(LD_CIRC, "CC: TOR_VEGAS exiting slow start");
|
||||
}
|
||||
} else {
|
||||
if (queue_use > cc->vegas_params.beta || cc->blocked_chan) {
|
||||
if (queue_use > cc->vegas_params.delta) {
|
||||
cc->cwnd = vegas_bdp_mix(cc) + cc->vegas_params.delta - CWND_INC(cc);
|
||||
} else if (queue_use > cc->vegas_params.beta || cc->blocked_chan) {
|
||||
cc->cwnd -= CWND_INC(cc);
|
||||
} else if (queue_use < cc->vegas_params.alpha) {
|
||||
cc->cwnd += CWND_INC(cc);
|
||||
|
Loading…
Reference in New Issue
Block a user