Skills101
← All practice quizzes

Quiz: Consistent Hashing

5 questions · new set on every retakeNo time limitPass: 60%+10 XP on first pass

When you add one cache server, hash % N moves about 80% of your keys. Consistent hashing moves only the keys the new server takes over. Built and measured in Python, with virtual nodes for even load.

Log in to take the quiz

Free account · see your score, answers and explanations, earn XP

  1. Question 1

    With hash(key) % N, roughly what share of keys moves when going from 4 to 5 servers?

  2. Question 2

    On a consistent hash ring, which server owns a key?

  3. Question 3

    What does this print?

    servers = [(50, "A"), (150, "B"), (250, "C")]
    def owner(pos):
        for p, name in servers:
            if pos <= p:
                return name
        return servers[0][1]
    print(owner(120), owner(250), owner(300))
    
  4. Question 4

    A new server E is added to a ring of four servers. Which keys move?

  5. Question 5

    What problem do virtual nodes mainly solve?

🎯 Today’s placement challenge — 10 questions, no login. Can you score 10/10?Take today’s challenge →