160-bandwidth-offset.txt 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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: Finished
  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 can vote on
  34. the median measured value if sufficient measured votes exist for a router,
  35. and otherwise fall back to the median value taken from the published router
  36. descriptors.
  37. 3. Security implications
  38. If only some authorities choose to vote on an offset, then a majority of
  39. those voting authorities can arbitrarily change the bandwidth weighting
  40. for the relay. At the extreme, if there's only one offset-voting
  41. authority, then that authority can dictate which relays clients will
  42. find attractive.
  43. This problem isn't entirely new: we already have the worry wrt
  44. the subset of authorities that vote for BadExit.
  45. To make it not so bad, we should deploy at least three offset-voting
  46. authorities.
  47. Also, authorities that know how to vote for offsets should vote for
  48. an offset of zero for new nodes, rather than choosing not to vote on
  49. any offset in those cases.
  50. 4. Design
  51. First, we need a new consensus method to support this new calculation.
  52. Now v3 votes can have an additional value on the "w" line:
  53. "w Bandwidth=X Measured=" INT.
  54. Once we're using the new consensus method, the new way to compute the
  55. Bandwidth weight is by checking if there are at least 3 "Measured"
  56. votes. If so, the median of these is taken. Otherwise, the median
  57. of the "Bandwidth=" values are taken, as described in Proposal 141.
  58. Then the actual consensus looks just the same as it did before,
  59. so clients never have to know that this additional calculation is
  60. happening.
  61. 5. Implementation
  62. The Measured values will be read from a file provided by the scanners
  63. described in proposal 161. Files with a timestamp older than 3 days
  64. will be ignored.
  65. The file will be read in from dirserv_generate_networkstatus_vote_obj()
  66. in a location specified by a new config option "V3MeasuredBandwidths".
  67. A helper function will be called to populate new 'measured' and
  68. 'has_measured' fields of the routerstatus_t 'routerstatuses' list with
  69. values read from this file.
  70. An additional for_vote flag will be passed to
  71. routerstatus_format_entry() from format_networkstatus_vote(), which will
  72. indicate that the "Measured=" string should be appended to the "w Bandwith="
  73. line with the measured value in the struct.
  74. routerstatus_parse_entry_from_string() will be modified to parse the
  75. "Measured=" lines into routerstatus_t struct fields.
  76. Finally, networkstatus_compute_consensus() will set rs_out.bandwidth
  77. to the median of the measured values if there are more than 3, otherwise
  78. it will use the bandwidth value median as normal.