Design a Real-Time Voting System with Vote Changes for Millions of Concurrent Voters

Quick Overview

A system design question about a 5-minute poll where millions of people vote at once, can change their vote and see results refresh every second. It tests atomic vote changes, hot counter sharding, fan-out of live results, durable vote records and recovery after failures.

Design a Real-Time Voting System with Vote Changes for Millions of Concurrent Voters

Company: Amazon

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design a real-time voting system. A poll stays open for 5 minutes. During that time millions of people vote at once, every voter can see the current results and change their vote, and the displayed results update every second. The system has to stay available for the whole poll. ### Clarifying Questions - Does each account hold exactly one current vote per poll, with the latest choice counting? - How exact must the live results be while the poll is open, and how exact must the final result be? - Do votes that arrive after the 5 minutes end still count? - How many polls run at the same time, and how many options does a poll have? - Must individual votes be kept after the poll for audits or recounts? ### Part 1: Casting and changing a vote Design the write path for casting a vote and changing it. A voter must never be counted twice, and a change must move exactly one vote from the old option to the new one. ```hint Make the change indivisible Two change requests from the same voter can arrive at the same moment. Decide where the read of the old choice and the two count updates run so that nothing can interleave with them. ``` #### What This Part Should Cover - The data model for each voter's current choice and for the per-option counts. - An atomic change operation and what it returns. - Retries, duplicate requests and the close of the poll. ### Part 2: Hot counters and per-second results Millions of votes land on one poll, so a single counter per option becomes a hot key. Scale the write path, and serve results that refresh every second to every viewer. ```hint Count the readers Estimate the read rate if every viewer refreshes once per second, and decide whether those reads need to reach the vote store at all. ``` #### What This Part Should Cover - Load estimates for writes and for result reads. - Spreading counter writes across shards and combining them. - Delivering results to millions of viewers every second. ### Part 3: Durability, recovery and availability Make sure no accepted vote is lost when a node fails, keep accepting votes during partial outages, and produce a final result you can trust. ```hint Decide what is the record Decide which component holds the record of every vote and which components hold counts that can be rebuilt from it. ``` #### What This Part Should Cover - An event log and persistent storage for votes. - Rebuilding counts after a failure. - Degraded behavior when a component is down, and how the final count is produced. ### What a Strong Answer Covers - Estimates that justify counting in memory and sharding the counters. - Vote changes that keep the counts equal to the number of current votes per option. - A result path that does not send every viewer to the vote store. - Durable vote records, a recovery path and a clear rule for closing the poll. ### Follow-up Questions - The in-memory store fails over and loses its last second of writes. How do you detect the gap and repair the counts? - How would you keep bots or scripted accounts from flooding a poll? - The final result must be exact. How do you compute it, and how soon after the close can you publish it? - How would the design change if a poll stayed open for a week instead of 5 minutes?

Overview: A system design question about a 5-minute poll where millions of people vote at once, can change their vote and see results refresh every second. It tests atomic vote changes, hot counter sharding, fan-out of live results, durable vote records and recovery after failures.

Read the full Amazon Software Engineer interview experience this question came from

Amazon logo
Amazon
Nov 27, 2026
hardSoftware EngineerTechnical ScreenSystem Design
0
0

Design a real-time voting system. A poll stays open for 5 minutes. During that time millions of people vote at once, every voter can see the current results and change their vote, and the displayed results update every second. The system has to stay available for the whole poll.

Clarifying Questions Guidance

  • Does each account hold exactly one current vote per poll, with the latest choice counting?
  • How exact must the live results be while the poll is open, and how exact must the final result be?
  • Do votes that arrive after the 5 minutes end still count?
  • How many polls run at the same time, and how many options does a poll have?
  • Must individual votes be kept after the poll for audits or recounts?

Part 1: Casting and changing a vote

Design the write path for casting a vote and changing it. A voter must never be counted twice, and a change must move exactly one vote from the old option to the new one.

What This Part Should Cover Guidance

  • The data model for each voter's current choice and for the per-option counts.
  • An atomic change operation and what it returns.
  • Retries, duplicate requests and the close of the poll.

Part 2: Hot counters and per-second results

Millions of votes land on one poll, so a single counter per option becomes a hot key. Scale the write path, and serve results that refresh every second to every viewer.

What This Part Should Cover Guidance

  • Load estimates for writes and for result reads.
  • Spreading counter writes across shards and combining them.
  • Delivering results to millions of viewers every second.

Part 3: Durability, recovery and availability

Make sure no accepted vote is lost when a node fails, keep accepting votes during partial outages, and produce a final result you can trust.

What This Part Should Cover Guidance

  • An event log and persistent storage for votes.
  • Rebuilding counts after a failure.
  • Degraded behavior when a component is down, and how the final count is produced.

What a Strong Answer Covers Guidance

  • Estimates that justify counting in memory and sharding the counters.
  • Vote changes that keep the counts equal to the number of current votes per option.
  • A result path that does not send every viewer to the vote store.
  • Durable vote records, a recovery path and a clear rule for closing the poll.

Follow-up Questions Guidance

  • The in-memory store fails over and loses its last second of writes. How do you detect the gap and repair the counts?
  • How would you keep bots or scripted accounts from flooding a poll?
  • The final result must be exact. How do you compute it, and how soon after the close can you publish it?
  • How would the design change if a poll stayed open for a week instead of 5 minutes?