[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] [tor/master 05/28] Add consensus parameter for max synthetic quantile.
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Thu, 6 May 2010 14:53:05 -0700
Subject: Add consensus parameter for max synthetic quantile.
Commit: eecdd94dec6cdb3515b0500a1d15170a199bee41
In case we decide that the timeout rate is now too high due to our
change of the max synthetic quantile value, this consensus parameter
will allow us to restore it to the previous value.
---
src/or/circuitbuild.c | 16 ++++++++++++----
src/or/or.h | 4 ++--
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index b549524..d7245c5 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -105,6 +105,14 @@ circuit_build_times_quantile_cutoff(void)
return num/100.0;
}
+static double
+circuit_build_times_max_synthetic_quantile(void)
+{
+ int32_t num = networkstatus_get_param(NULL, "cbtmaxsynthquantile",
+ CBT_DEFAULT_MAX_SYNTHETIC_QUANTILE);
+ return num/100.0;
+}
+
static int32_t
circuit_build_times_test_frequency(void)
{
@@ -733,7 +741,7 @@ circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt,
double quantile_cutoff)
{
build_time_t gentime = circuit_build_times_generate_sample(cbt,
- quantile_cutoff, CBT_MAX_SYNTHETIC_QUANTILE);
+ quantile_cutoff, circuit_build_times_max_synthetic_quantile());
if (gentime < (build_time_t)tor_lround(cbt->timeout_ms)) {
log_warn(LD_CIRC,
@@ -788,7 +796,7 @@ circuit_build_times_count_pretimeouts(circuit_build_times_t *cbt)
((double)cbt->pre_timeouts)/
(cbt->pre_timeouts+cbt->total_build_times);
/* Make sure it doesn't exceed the synthetic max */
- timeout_quantile *= CBT_MAX_SYNTHETIC_QUANTILE;
+ timeout_quantile *= circuit_build_times_max_synthetic_quantile();
cbt->Xm = circuit_build_times_get_xm(cbt);
tor_assert(cbt->Xm > 0);
/* Use current timeout to get an estimate on alpha */
@@ -1060,7 +1068,7 @@ circuit_build_times_filter_timeouts(circuit_build_times_t *cbt)
timeout_rate = circuit_build_times_timeout_rate(cbt);
max_timeout = tor_lround(circuit_build_times_calculate_timeout(cbt,
- CBT_MAX_SYNTHETIC_QUANTILE));
+ circuit_build_times_max_synthetic_quantile()));
for (i = 0; i < CBT_NCIRCUITS_TO_OBSERVE; i++) {
if (cbt->circuit_build_times[i] > max_timeout) {
@@ -1069,7 +1077,7 @@ circuit_build_times_filter_timeouts(circuit_build_times_t *cbt)
cbt->circuit_build_times[i] =
MIN(circuit_build_times_generate_sample(cbt,
circuit_build_times_quantile_cutoff(),
- CBT_MAX_SYNTHETIC_QUANTILE),
+ circuit_build_times_max_synthetic_quantile()),
CBT_BUILD_TIME_MAX);
log_debug(LD_CIRC, "Replaced timeout %d with %d", replaced,
diff --git a/src/or/or.h b/src/or/or.h
index c4cafcb..c8886cf 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -3016,9 +3016,9 @@ void entry_guards_free_all(void);
#define CBT_NCIRCUITS_TO_OBSERVE 1000
/** Maximum quantile to use to generate synthetic timeouts.
- * We want to stay a bit short of 1.0, because longtail is
+ * We want to stay a bit short of 100, because longtail is
* loooooooooooooooooooooooooooooooooooooooooooooooooooong. */
-#define CBT_MAX_SYNTHETIC_QUANTILE 0.90
+#define CBT_DEFAULT_MAX_SYNTHETIC_QUANTILE 90
/** Width of the histogram bins in milliseconds */
#define CBT_BIN_WIDTH ((build_time_t)50)
--
1.7.1