Um momento
0x20Lesson 3 of 6

Choose a backend selection strategy

Compare round robin, least connections, weights, and hashing.

12 min 5-question quiz
By the end of this lesson you can
  • Select a routing algorithm based on backend capacity and workload behavior.

Round robin cycles through available backends and works well when instances and requests are similar. Weighted round robin sends a larger share to higher-capacity instances. Least connections can help when request durations vary, though connection counts are only a proxy for work. Hash-based routing can keep a key on the same backend, but can create skew and complicates membership changes.

Python simulation · illustrative only
weights = {"small": 1, "large": 2}
sequence = ["small", "large", "large"]
print(" -> ".join(sequence))
Output
small -> large -> large

A policy is only as good as its inputs. Long-lived connections, uneven request cost, and stale health or load measurements can make a seemingly fair algorithm distribute actual work poorly.

Key takeaways

  • Use round robin for fairly uniform pools and workloads.

  • Weights represent known capacity differences.

  • No selection algorithm can compensate for misleading signals or severe key skew.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: