Practice: Design a Live Polling App
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.
Build this system yourself on the canvas below. Add components, connect them, and run traffic simulations to see where your design holds up and where it breaks.
Functional requirements
- Let a person cast one vote on a poll, and reject a second vote from the same person
- Enforce one vote per person even when the client retries or two requests arrive at the same moment
- Show live poll results (counts and percentages) to everyone watching
- Add up votes into tallies in the background, so recording a vote is quick and the results page is cheap to serve
- Let the host open, close and reopen a poll, and reject votes after it closes
- Limit how fast one client can vote, to slow down scripted ballot stuffing
Non-functional requirements
- Vote accepted < 100ms p99
- Results are visible within 5 seconds of a vote and may lag a few seconds under load
- One vote per person per poll, enforced by the database (unique constraint), not by the app
- Handle 10K requests per second at peak: about 2K votes and 8K results views per second
- Serve results from a cache so a big audience watching does not hit the votes database
- 99.99% durability: an accepted vote is never lost; scale to 1M votes per minute during a live event
- 99.9% availability while a poll is open