[tor-commits] [tor] 02/09: Create slow-start max for n_ewma_cnt.

gitolite role git at cupani.torproject.org
Thu Aug 11 13:28:46 UTC 2022


This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit 08c3ee8eca4bf60f3218daeb65acf97da554e80f
Author: Mike Perry <mikeperry-git at torproject.org>
AuthorDate: Sun Jul 31 16:38:34 2022 +0000

    Create slow-start max for n_ewma_cnt.
    
    Since slow-start now checks every sendme, lower EWMA is better.
---
 src/core/or/congestion_control_common.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/src/core/or/congestion_control_common.c b/src/core/or/congestion_control_common.c
index 8f09a80bae..c1a62cada0 100644
--- a/src/core/or/congestion_control_common.c
+++ b/src/core/or/congestion_control_common.c
@@ -52,6 +52,7 @@
 
 #define N_EWMA_CWND_PCT_DFLT (50)
 #define N_EWMA_MAX_DFLT (10)
+#define N_EWMA_SS_DFLT (2)
 
 /* BDP algorithms for each congestion control algorithms use the piecewise
  * estimattor. See section 3.1.4 of proposal 324. */
@@ -107,6 +108,11 @@ static uint8_t n_ewma_cwnd_pct;
  */
 static uint8_t n_ewma_max;
 
+/**
+ * Maximum number N for the N-count EWMA averaging of RTT in Slow Start.
+ */
+static uint8_t n_ewma_ss;
+
 /**
  * Minimum number of sendmes before we begin BDP estimates
  */
@@ -196,6 +202,14 @@ congestion_control_new_consensus_params(const networkstatus_t *ns)
         N_EWMA_MAX_DFLT,
         N_EWMA_MAX_MIN,
         N_EWMA_MAX_MAX);
+
+#define N_EWMA_SS_MIN 2
+#define N_EWMA_SS_MAX (INT32_MAX)
+  n_ewma_ss =
+    networkstatus_get_param(NULL, "cc_ewma_ss",
+        N_EWMA_SS_DFLT,
+        N_EWMA_SS_MIN,
+        N_EWMA_SS_MAX);
 }
 
 /**
@@ -452,8 +466,18 @@ dequeue_timestamp(smartlist_t *timestamps_u64_usecs)
 static inline uint64_t
 n_ewma_count(const congestion_control_t *cc)
 {
-  uint64_t ewma_cnt = MIN(CWND_UPDATE_RATE(cc)*n_ewma_cwnd_pct/100,
+  uint64_t ewma_cnt = 0;
+
+  if (cc->in_slow_start) {
+    /* In slow-start, we check the Vegas condition every sendme,
+     * so much lower ewma counts are needed. */
+    ewma_cnt = n_ewma_ss;
+  } else {
+    /* After slow-start, we check the Vegas condition only once per
+     * CWND, so it is better to average over longer periods. */
+    ewma_cnt = MIN(CWND_UPDATE_RATE(cc)*n_ewma_cwnd_pct/100,
                           n_ewma_max);
+  }
   ewma_cnt = MAX(ewma_cnt, 2);
   return ewma_cnt;
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list