commit 4a4b8a73185f763f0def3e0d30c052f3abeb6fa0 Author: Mike Perry mikeperry-git@fscked.org Date: Thu Dec 1 17:38:45 2011 -0800
Alter default param values.
These defaults should still be equivalent to Section 2 in the spec, but these values will keep the PID interim state from disappearing every time ides crashes and the consensus params disappear. --- NetworkScanners/BwAuthority/README.spec.txt | 73 ++++++++++++++++----------- NetworkScanners/BwAuthority/aggregate.py | 24 ++++---- 2 files changed, 56 insertions(+), 41 deletions(-)
diff --git a/NetworkScanners/BwAuthority/README.spec.txt b/NetworkScanners/BwAuthority/README.spec.txt index b8f86d4..81468b5 100644 --- a/NetworkScanners/BwAuthority/README.spec.txt +++ b/NetworkScanners/BwAuthority/README.spec.txt @@ -483,23 +483,59 @@ 3.6. Consensus Parameters
The bandwidth auths listen for several consensus parameters to tweak - behavior: + behavior.
- "bwauthpid=1" - If present, enables the PID control features in Section 3. + In the absence of any consensus parameters, the default behavior is + to use the PID control code to produce values identical to Section 2, + by using default values of: + + K_p = 1.0, K_i = 0, K_d = 0, as well as bwauthcircs=0. + + This equivalence was proved in Section 3.1, and has been observed + in practice. + + The available consensus parameters are: + + "bwauthpid=0" + If present, entirely disables the PID control features in + Section 3 and computes bandwidths according to Section 2. + + Setting this value to temporarily disable PID feedback is not + recommended, because it causes the PID code to lose interim + recorded state. + + To temporarily disable PID feedback, simply remove all consensus + parameters, and the system will compute Section 2 values while + retaining PID state.
"bwauthcircs=1" If present, F_node is multiplied by (1.0 - circ_fail_rate) as described in Section 3.1. - + + "bwauthbestratio=0" + If absent, the larger of stream bandwidth vs filtered bandwidth + is used to compute F_node. + + If present, only filtered stream bandwidth ratios are used. + + "bwauthnsbw=1" + If present, uses consensus bandwidth to determine new bandwidth + values. + + If absent, uses descriptor bandwidth instead of feeding back + PID control values. This may be functionally equivalent to NS + bandwidth so long as T_i is non-zero, because error will get + accumulated in pid_error_sum as opposed to the consensus value + itself. + "bwauthkp=N" - Sets K_p to N/10000.0 + Sets K_p to N/10000.0. If absent, K_p=1.0.
"bwauthti=N" - Sets T_i to N/10000.0. For T_i=0, K_i is set to 0. + Sets T_i to N/10000.0. If T_i=0 or absent, K_i is set to 0.
"bwauthtd=N" - Sets T_d to N/10000.0. + Sets T_d to N/10000.0. If absent, K_d=0.
"bwauthtidecay=N" Sets T_i_decay to N/10000.0. T_i_decay is an parameter @@ -513,25 +549,4 @@ the T_i'th round has experienced a reduction by T_i_decay for the values of T_i that are relevant to us.
- If T_i is 0, K_i_decay is set to 0. - - "bwauthbestratio=1" - If present, the larger of stream bandwidth vs filtered bandwidth - is used to compute F_node. - - "bwauthdescbw=1" - If present, uses descriptor bandwidth instead of feeding back - PID control values. This may be functionally equivalent to NS - bandwidth so long as T_i is non-zero, because error will get - accumulated in pid_error_sum as opposed to the consensus value - itself. - - It also has the advantage of allowing the PID control code to be - exercised, yet to still produce identical results to Section 2 - by using the following consensus parameters: - - bwauthpid=1 bwauthdescbw=1 bwauthbestratio=1 bwauthcircs=0 - bwauthkp=10000 bwauthti=0 bwauthtd=0 - - This equivalence was proved in Section 3.1, and has been observed - in practice. + If T_i is 0 or absent, K_i_decay is set to 0. diff --git a/NetworkScanners/BwAuthority/aggregate.py b/NetworkScanners/BwAuthority/aggregate.py index 19697eb..6283f3f 100755 --- a/NetworkScanners/BwAuthority/aggregate.py +++ b/NetworkScanners/BwAuthority/aggregate.py @@ -28,19 +28,19 @@ GUARD_SAMPLE_RATE = 2*7*24*60*60 # 2wks K_p = 1.0
# We expect to correct steady state error in 5 samples (guess) -T_i = 5.0 +T_i = 0
# T_i_decay is a weight factor to govern how fast integral sums # decay. For the values of T_i that we care about, T_i_decay represents # the fraction of integral sum that is eliminated after T_i sample rounds. # This decay is non-standard, but we do it to avoid overflow -T_i_decay = 0.5 +T_i_decay = 0
# We can only expect to predict less than one sample into the future, as # after 1 sample, clients will have migrated # FIXME: Our prediction ability is a function of the consensus uptake time # vs measurement rate -T_d = 0.5 +T_d = 0
NODE_CAP = 0.05
@@ -221,10 +221,10 @@ class VoteSet: class ConsensusJunk: def __init__(self, c): cs_bytes = c.sendAndRecv("GETINFO dir/status-vote/current/consensus\r\n")[0][2] - self.bwauth_pid_control = False + self.bwauth_pid_control = True self.use_circ_fails = False - self.use_best_ratio = False - self.use_desc_bw = False + self.use_best_ratio = True + self.use_desc_bw = True
self.K_p = K_p self.T_i = T_i @@ -235,16 +235,16 @@ class ConsensusJunk: cs_params = re.search("^params ((?:[\S]+=[\d]+[\s]?)+)", cs_bytes, re.M).group(1).split() for p in cs_params: - if p == "bwauthpid=1": - self.bwauth_pid_control = True - elif p == "bwauthdescbw=1": - self.use_desc_bw = True + if p == "bwauthpid=0": + self.bwauth_pid_control = False + elif p == "bwauthnsbw=1": + self.use_desc_bw = False plog("INFO", "Using descriptor bandwidth") elif p == "bwauthcircs=1": self.use_circ_fails = True plog("INFO", "Counting circuit failures") - elif p == "bwauthbestratio=1": - self.use_best_ratio = True + elif p == "bwauthbestratio=0": + self.use_best_ratio = False plog("INFO", "Choosing larger of sbw vs fbw") elif p.startswith("bwauthkp="): self.K_p = int(p.split("=")[1])/10000.0
tor-commits@lists.torproject.org