160-bandwidth-offset.txt 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. Filename: 160-bandwidth-offset.txt
  2. Title: Authorities vote for bandwidth offsets in consensus
  3. Author: Roger Dingledine
  4. Created: 4-May-2009
  5. Status: Open
  6. Target: 0.2.2.x
  7. 1. Motivation
  8. As part of proposal 141, we moved the bandwidth value for each relay
  9. into the consensus. Now clients can know how they should load balance
  10. even before they've fetched the corresponding relay descriptors.
  11. Putting the bandwidth in the consensus also lets the directory
  12. authorities choose more accurate numbers to advertise, if we come up
  13. with a better algorithm for deciding weightings.
  14. Our original plan was to teach directory authorities how to measure
  15. bandwidth themselves; then every authority would vote for the bandwidth
  16. it prefers, and we'd take the median of votes as usual.
  17. The problem comes when we have 7 authorities, and only a few of them
  18. have smarter bandwidth allocation algorithms. So long as the majority
  19. of them are voting for the number in the relay descriptor, the minority
  20. that have better numbers will be ignored.
  21. 2. Options
  22. One fix would be to demand that every authority also run the
  23. new bandwidth measurement algorithms: in that case, part of the
  24. responsibility of being an authority operator is that you need to run
  25. this code too. But in practice we can't really require all current
  26. authority operators to do that; and if we want to expand the set of
  27. authority operators even further, it will become even more impractical.
  28. Also, bandwidth testing adds load to the network, so we don't really
  29. want to require that the number of concurrent bandwidth tests match
  30. the number of authorities we have.
  31. The better fix is to allow certain authorities to specify that they are
  32. voting on bandwidth measurements: more accurate bandwidth values that
  33. have actually been evaluated. In this way, authorities
  34. 3. Security implications
  35. If only some authorities choose to vote on an offset, then a majority of
  36. those voting authorities can arbitrarily change the bandwidth weighting
  37. for the relay. At the extreme, if there's only one offset-voting
  38. authority, then that authority can dictate which relays clients will
  39. find attractive.
  40. This problem isn't entirely new: we already have the worry wrt
  41. the subset of authorities that vote for BadExit.
  42. To make it not so bad, we should deploy at least three offset-voting
  43. authorities.
  44. Also, authorities that know how to vote for offsets should vote for
  45. an offset of zero for new nodes, rather than choosing not to vote on
  46. any offset in those cases.
  47. 4. Design
  48. First, we need a new consensus method to support this new calculation.
  49. Now v3 votes can have an additional value on the "w" line:
  50. "w Bandwidth=X Measured=" INT.
  51. Once we're using the new consensus method, the new way to compute the
  52. Bandwidth weight is by checking if there are at least 3 "Measured"
  53. votes. If so, the median of these is taken. Otherwise, the median
  54. of the "Bandwidth=" values are taken, as described in Proposal 141.
  55. Then the actual consensus looks just the same as it did before,
  56. so clients never have to know that this additional calculation is
  57. happening.
  58. 5. Implementation
  59. The Measured values will be read from a file provided by the scanners
  60. described in proposal 161. Files with a timestamp older than 3 days
  61. will be ignored.
  62. The file will be read in from dirserv_generate_networkstatus_vote_obj()
  63. in a location specified by a new config option "V3MeasuredBandwidths".
  64. A helper function will be called to populate new 'measured' and
  65. 'has_measured' fields of the routerstatus_t 'routerstatuses' list with
  66. values read from this file.
  67. An additional for_vote flag will be passed to
  68. routerstatus_format_entry() from format_networkstatus_vote(), which will
  69. indicate that the "Measured=" string should be appended to the "w Bandwith="
  70. line with the measured value in the struct.
  71. routerstatus_parse_entry_from_string() will be modified to parse the
  72. "Measured=" lines into routerstatus_t struct fields.
  73. Finally, networkstatus_compute_consensus() will set rs_out.bandwidth
  74. to the median of the measured values if there are more than 3, otherwise
  75. it will use the bandwidth value median as normal.