commit 0a6cde8756423336c8e6901b55c31d67a2a35245 Author: Mike Perry mikeperry-git@torproject.org Date: Fri Jan 21 15:17:20 2022 +0000
Set new defaults for congestion control parameters.
Defaults determined from Shadow experimentation.
More parameter functionality changes to follow. --- src/core/or/congestion_control_common.c | 20 +++++++++++--------- src/core/or/congestion_control_common.h | 4 ++++ src/core/or/congestion_control_flow.c | 2 +- src/core/or/congestion_control_vegas.c | 10 ++++++---- 4 files changed, 22 insertions(+), 14 deletions(-)
diff --git a/src/core/or/congestion_control_common.c b/src/core/or/congestion_control_common.c index 6d4f34cff8..09c6c04bf3 100644 --- a/src/core/or/congestion_control_common.c +++ b/src/core/or/congestion_control_common.c @@ -35,16 +35,18 @@ * * More details for each of the parameters can be found in proposal 324, * section 6.5 including tuning notes. */ -#define CIRCWINDOW_INIT (500) -#define SENDME_INC_DFLT (50) +#define SENDME_INC_DFLT (TLS_RECORD_MAX_CELLS) +#define CIRCWINDOW_INIT (4*SENDME_INC_DFLT) + #define CC_ALG_DFLT (CC_ALG_SENDME) #define CC_ALG_DFLT_ALWAYS (CC_ALG_VEGAS)
-#define CWND_INC_DFLT (50) -#define CWND_INC_PCT_SS_DFLT (100) +#define CWND_INC_DFLT (TLS_RECORD_MAX_CELLS) +#define CWND_INC_PCT_SS_DFLT (50) #define CWND_INC_RATE_DFLT (1) + +#define CWND_MIN_DFLT (SENDME_INC_DFLT) #define CWND_MAX_DFLT (INT32_MAX) -#define CWND_MIN_DFLT (MAX(100, SENDME_INC_DFLT))
#define BWE_SENDME_MIN_DFLT (5) #define EWMA_CWND_COUNT_DFLT (2) @@ -138,8 +140,8 @@ congestion_control_new_consensus_params(const networkstatus_t *ns) CWND_MAX_MIN, CWND_MAX_MAX);
-#define SENDME_INC_MIN 10 -#define SENDME_INC_MAX (1000) +#define SENDME_INC_MIN 1 +#define SENDME_INC_MAX (255) cc_sendme_inc = networkstatus_get_param(NULL, "cc_sendme_inc", SENDME_INC_DFLT, @@ -171,7 +173,7 @@ congestion_control_init_params(congestion_control_t *cc, const or_options_t *opts = get_options(); cc->sendme_inc = params->sendme_inc_cells;
-#define CWND_INIT_MIN 100 +#define CWND_INIT_MIN SENDME_INC_DFLT #define CWND_INIT_MAX (10000) cc->cwnd = networkstatus_get_param(NULL, "cc_cwnd_init", @@ -203,7 +205,7 @@ congestion_control_init_params(congestion_control_t *cc, CWND_INC_RATE_MIN, CWND_INC_RATE_MAX);
-#define CWND_MIN_MIN 20 +#define CWND_MIN_MIN SENDME_INC_DFLT #define CWND_MIN_MAX (1000) cc->cwnd_min = networkstatus_get_param(NULL, "cc_cwnd_min", diff --git a/src/core/or/congestion_control_common.h b/src/core/or/congestion_control_common.h index 936cb5887c..1e5a00c942 100644 --- a/src/core/or/congestion_control_common.h +++ b/src/core/or/congestion_control_common.h @@ -13,6 +13,10 @@ #include "core/or/crypt_path_st.h" #include "core/or/circuit_st.h"
+/* The maximum whole number of cells that can fit in a + * full TLS record. This is 31. */ +#define TLS_RECORD_MAX_CELLS ((16 * 1024) / CELL_MAX_NETWORK_SIZE) + typedef struct congestion_control_t congestion_control_t;
/** Wrapper for the free function, set the CC pointer to NULL after free */ diff --git a/src/core/or/congestion_control_flow.c b/src/core/or/congestion_control_flow.c index c8b5ba2473..3a3a9522fd 100644 --- a/src/core/or/congestion_control_flow.c +++ b/src/core/or/congestion_control_flow.c @@ -116,7 +116,7 @@ flow_control_new_consensus_params(const networkstatus_t *ns) CC_XON_RATE_BYTES_MAX)*RELAY_PAYLOAD_SIZE;
#define CC_XON_EWMA_CNT_DFLT (2) -#define CC_XON_EWMA_CNT_MIN (1) +#define CC_XON_EWMA_CNT_MIN (2) #define CC_XON_EWMA_CNT_MAX (100) xon_ewma_cnt = networkstatus_get_param(ns, "cc_xon_ewma_cnt", CC_XON_EWMA_CNT_DFLT, diff --git a/src/core/or/congestion_control_vegas.c b/src/core/or/congestion_control_vegas.c index 3206821f4c..8e13499aff 100644 --- a/src/core/or/congestion_control_vegas.c +++ b/src/core/or/congestion_control_vegas.c @@ -23,11 +23,13 @@ #include "core/or/channel.h" #include "feature/nodelist/networkstatus.h"
-#define VEGAS_GAMMA(cc) (6*(cc)->sendme_inc) -#define VEGAS_ALPHA(cc) (3*(cc)->sendme_inc) -#define VEGAS_BETA(cc) (6*(cc)->sendme_inc) +#define OUTBUF_CELLS (2*TLS_RECORD_MAX_CELLS)
-#define VEGAS_BDP_MIX_PCT 0 +#define VEGAS_ALPHA(cc) (3*OUTBUF_CELLS-TLS_RECORD_MAX_CELLS) +#define VEGAS_BETA(cc) (3*OUTBUF_CELLS) +#define VEGAS_GAMMA(cc) (3*OUTBUF_CELLS) + +#define VEGAS_BDP_MIX_PCT 100
/** * The original TCP Vegas used only a congestion window BDP estimator. We