Visual RFC.
ALL RFCs / RFC 2782
Read the RFC ↗
RFC 2782 / DNS service location

Order peers with the published algorithm

03

First group by priority. Within one priority, RFC 2782 recommends an ordering algorithm with an inclusive random draw and removal after each selection.

RFC 2782 · Weight selection algorithmEXAMPLE
4 / 4
Order peers with the published algorithmB is removed from the candidate set, leaving Z and A with sums 0 and 1. Supplied next draw 1 selects A; Z must still be ordered before reaching priority 20.Priority first; weighted order within a tierChosen first: B · removed from candidatesRemaining priority 10: Z(0), A(1)New running sums: 0, 1draw 1 of 0–1Next chosen: AZ still remains before priority 20Published inclusive-zero algorithm is SHOULD · not traffic %
04
Remove B and draw again

B leaves the candidate set. Remaining total is 1; draw 1 chooses A next. Z remains to be ordered before moving to priority 20.

Source for this drawing: RFC 2782 · Read RFC source: Weight selection algorithm ↗

Protocol participantThreat or exceptionProtocol controlSimplified drawings · precise section references
New to this? Start hereA quick picture + helpful background

A message needs an address.

Think of a packet as a small addressed envelope. Devices pass it onward; transport protocols decide what delivery promises an application gets.

Helpful first, if these ideas are unfamiliar

These pictures are analogies to help you learn. The linked RFC explains the actual rules.

Related RFCs and changes

“Updates” changes part of an earlier RFC. “Obsoletes” replaces it. This list shows selected related documents.

KEY POINT

Keep zero weights first, use cumulative weights, select the first sum at least the draw, then remove that record.

  • Priority comes first. Example Z/A/B are priority 10 with weights 0/1/3; C is priority 20 with weight 65535. C’s larger weight does not let it jump ahead of reachable priority-10 targets.
  • The described ordering algorithm SHOULD be used in the absence of a protocol specifying other weighting information (Weight, page 4). Arrange the remaining records at one priority in any order, except put all zero-weight records first. The chosen stable example order is Z,A,B.
  • Compute running sums: Z=0, A=1, B=4. Choose a uniform random integer from 0 through total 4 inclusive. Select the first running sum greater than or equal to the draw. A chosen draw of 3 selects B. Remove B, recompute over the remaining records, and repeat for every priority.
  • Inclusive zero matters: with this chosen order, draw 0 selects Z, draw 1 selects A, and draws 2,3,4 select B. This is five equally likely draw values; zero weight is not an absolute prohibition. With only zero weights, total and draw are zero, so the first remaining record is chosen and then removed.
  • Do not promise exact Weight/total traffic percentages. Official technical erratum 2984, proposing to change the algorithm, is Rejected. Erratum 8120 about the fictional example’s exact three-quarter claim is Held for Document Update, not a verified replacement rule. This guide preserves the published inclusive algorithm and avoids the misleading percentage claim. Verified editorial erratum 6600 fixes a spelling typo only.
  • Removing each chosen record creates a retry order without replacement; it is not a command to connect to every server after success. Weight represents relatively static selection information, not a live server-load measurement (The Weight field, pages 5–6).
DETAILS

Example order is Z,A,B, with chosen draw 3 and then 1. Supplied draws in the offline model are explicit teaching inputs, not live randomness or measured traffic distribution.

Read the RFC section ↗

All chapters in RFC 2782

Drawing view

Scroll the drawing to see every part. Playback controls stay above it.

RFC 9700 / CHAPTERS

Chapters

For full details, tables, algorithms, and exceptions, read the original RFC.

RFC status and corrections ↗