Live poll service inspired by Slido and Twitter polls: one vote per person is enforced by the database, tallies are built by background workers, and the results page is cached so a big audience can watch.
See why counting votes from the database on every results view does not scale.
What was missing: No rule against voting twice and no cheap way to show results.
Why that's risky: Each results view scans every vote for the poll: 8K viewers/s means 8K full scans/s, and a double click can insert two votes.
What gets added: One server and a database; results come from COUNT over every vote row on each view.
Trade-offs: Always exact, but expensive per view and nothing prevents duplicates.
Enforce one vote per person with a unique key in the database.
What was missing: Double voting is possible and results are recounted from scratch.
Why that's risky: Results views still run COUNT queries against the votes database.
What gets added: The vote service writes each vote under a UNIQUE key on (poll, voter) so the database rejects a second vote even when two requests race; results get their own service.
Trade-offs: A constraint in the database is slower than an in-memory check but it is the only place uniqueness holds under races; a retry gets 'already voted' instead of counting twice.
Build tallies in the background and serve results from memory.
What was missing: Every results view recounts the votes.
Why that's risky: If workers lag the results go stale, and if the cache is lost the tally has to be rebuilt from the votes table.
What gets added: After saving a vote a job goes on a queue; tally workers keep running counts per choice in a cache and the results service reads the tally.
Trade-offs: Results trail votes by a few seconds, in exchange for results reads that cost almost nothing.
Let the edge serve the results page and protect voting from abuse.
What was missing: Every viewer still reaches our servers and scripts can flood a poll.
Why that's risky: If the CDN fails, the whole audience lands on the results service at once.
What gets added: A CDN caches the results page for a few seconds, a rate limiter caps votes per IP and device, and monitoring tracks tally lag and duplicate rejections.
Trade-offs: A 3 to 5 second edge TTL means everyone sees slightly old numbers, but an audience of 100K costs only a handful of origin requests. Pushing results over WebSockets is fresher but needs an open connection per viewer.
You're in the middle of an interview session. Leaving now will end your current attempt.
Explore concept overviews, real-system examples, key tradeoffs, and interview talking points for each roadmap section.
You've conquered this phase. These are the skills you now own: