[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torflow/master] Make the guard sample rate a consensus param.
commit 3c0dd74bcc46050b4b7131b479a779bf26258926
Author: Mike Perry <mikeperry-git@xxxxxxxxxx>
Date: Thu Dec 15 12:01:15 2011 -0800
Make the guard sample rate a consensus param.
---
NetworkScanners/BwAuthority/README.spec.txt | 6 ++++++
NetworkScanners/BwAuthority/aggregate.py | 9 +++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/NetworkScanners/BwAuthority/README.spec.txt b/NetworkScanners/BwAuthority/README.spec.txt
index a1b732e..835b312 100644
--- a/NetworkScanners/BwAuthority/README.spec.txt
+++ b/NetworkScanners/BwAuthority/README.spec.txt
@@ -585,3 +585,9 @@
If absent, the default is 500.0, which translates to a 501X
multiplier of descriptor bandwidth.
+
+ "bwauthguardrate=N"
+ Restricts the rate at which we perform feedback on Guard nodes
+ to at most every N seconds.
+
+ If absent, the default is 2*7*24*60*60, or two weeks.
diff --git a/NetworkScanners/BwAuthority/aggregate.py b/NetworkScanners/BwAuthority/aggregate.py
index 46e4679..77e3cdc 100755
--- a/NetworkScanners/BwAuthority/aggregate.py
+++ b/NetworkScanners/BwAuthority/aggregate.py
@@ -21,7 +21,6 @@ IGNORE_GUARDS = 0
# The guard measurement period is based on the client turnover
# rate for guard nodes
-# XXX: Make this a consensus param
GUARD_SAMPLE_RATE = 2*7*24*60*60 # 2wks
# PID constant defaults. May be overridden by consensus
@@ -243,6 +242,7 @@ class ConsensusJunk:
self.use_desc_bw = True
self.use_mercy = False
+ self.guard_sample_rate = GUARD_SAMPLE_RATE
self.pid_max = 500.0
self.K_p = K_p
self.T_i = T_i
@@ -288,6 +288,10 @@ class ConsensusJunk:
elif p.startswith("bwauthpidmax="):
self.pid_max = (int(p.split("=")[1])/10000.0)
plog("INFO", "Got pid_max=%f from consensus." % self.pid_max)
+ elif p.startswith("bwauthguardrate="):
+ self.guard_sample_rate = int(p.split("=")[1])
+ plog("INFO", "Got guard_sample_rate=%d from consensus." %
+ self.guard_sample_rate)
except:
plog("NOTICE", "Bw auth PID control disabled due to parse error.")
traceback.print_exc()
@@ -655,7 +659,8 @@ def main(argv):
and "Exit" not in prev_consensus[n.idhex].flags):
# Do full feedback if our previous vote > 2.5 weeks old
if n.idhex not in prev_votes.vote_map or \
- n.measured_at - prev_votes.vote_map[n.idhex].measured_at > GUARD_SAMPLE_RATE:
+ n.measured_at - prev_votes.vote_map[n.idhex].measured_at \
+ > cs_junk.guard_sample_rate:
n.new_bw = n.get_pid_bw(prev_votes.vote_map[n.idhex],
cs_junk.K_p,
cs_junk.K_i,
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits