Relays should disable DirPort if RelayBandwidthRate is less than 50kb/s
While I was checking fallback directory mirrors for #17158 (moved), I encountered some relays that took more than a minute to serve a consensus.
Most took 150 seconds, which could be caused by a RelayBandwidthRate of 10 kilobytes a second.
I suggest that we disable the DirPort on relays with a RelayBandwidthRate less than 50 kilobytes a second (30s to serve a consensus).
This is an incomplete list, starting with those with the highest consensus weight: 217.198.117.122:80 212.47.250.44:80 158.69.112.86:80 50.7.178.34:80 191.101.251.172:80 51.254.249.177:80 188.165.232.40:80 104.236.38.231:8080 89.163.225.184:9030 185.31.230.69:9030 81.7.14.227:9030 62.210.238.33:9030 164.132.56.137:9030 212.107.149.145:9030 94.23.165.33:9031
I'm using this python function from scripts/maint/updateFallbackDirs.py (not yet merged to master) to find them:
from stem.descriptor.remote import DescriptorDownloader
def fallback_consensus_dl_speed(dirip, dirport, nickname, max_time):
download_failed = False
downloader = DescriptorDownloader()
start = datetime.datetime.utcnow()
# some directory mirrors respond to requests in ways that hang python
# sockets, which is why we long this line here
logging.info('Initiating consensus download from %s (%s:%d).', nickname,
dirip, dirport)
# there appears to be about 1 second of overhead when comparing stem's
# internal trace time and the elapsed time calculated here
TIMEOUT_SLOP = 1.0
try:
downloader.get_consensus(endpoints = [(dirip, dirport)],
timeout = (max_time + TIMEOUT_SLOP)).run()
except Exception, stem_error:
logging.info('Unable to retrieve a consensus from %s: %s', nickname,
exc)
download_failed = True
elapsed = (datetime.datetime.utcnow() - start).total_seconds()
if elapsed > max_time:
status = 'too slow'
level = logging.WARNING
download_failed = True
else:
status = 'ok'
level = logging.DEBUG
logging.log(level, 'Consensus download: %0.1fs %s from %s (%s:%d), ' +
'max download time %0.1fs.', elapsed, status, nickname,
dirip, dirport, max_time)
return download_failed