Practice/Meta/Design Online Auction System
Design Online Auction System
System DesignMust
Problem Statement
Design a real-time sports betting platform where users can place wagers on live sporting events, view dynamic odds that adjust based on betting activity and game state, and receive instant confirmation or rejection of their bets. The system must handle events ranging from niche college games to major championship finals that attract millions of concurrent bettors.
The platform needs to manage rapidly changing odds across thousands of simultaneous games and bet types (point spreads, over/under, prop bets), process high-velocity bet placement during critical game moments, ensure that no user receives outdated odds, and settle all wagers correctly when events conclude. The core challenge lies in maintaining strict consistency for bet acceptance while delivering sub-second odds updates to millions of connected clients, all while preventing any scenario where conflicting bets could be accepted against stale pricing.
Key Requirements
Functional
- Event and odds management -- administrators create sporting events with multiple bet types, each having dynamically adjusting odds based on game state and betting volume
- Bet placement -- users submit wagers against current odds and receive immediate acceptance or rejection based on the latest pricing and their account balance
- Live odds feeds -- users see real-time odds updates as they change throughout the event, with updates propagating within one second
- Bet settlement -- when events conclude, all accepted wagers are automatically settled, winnings credited, and users notified of outcomes
Non-Functional
- Scalability -- support 10 million concurrent users during peak events like championship finals, with 100,000+ bets per second during critical moments
- Reliability -- zero tolerance for incorrectly accepted bets or incorrect settlements; system must maintain audit trail for regulatory compliance
- Latency -- odds updates must reach connected clients within 500ms; bet acceptance decisions must complete within 200ms
- Consistency -- strong consistency required for bet acceptance and balance deduction; eventual consistency acceptable for non-critical feeds
What Interviewers Focus On
Based on real interview experiences, these are the areas interviewers probe most deeply:
1. Optimistic Concurrency for Bet Acceptance
When thousands of users simultaneously attempt to place bets on the same outcome, the system must prevent accepting wagers against outdated odds while maintaining high throughput. Interviewers want to see how you avoid race conditions where users lock in stale prices.
Hints to consider:
- Attach version numbers or timestamps to odds, reject bets if the version has advanced since the user's display
- Use compare-and-swap operations on the odds record to atomically verify pricing before accepting the bet
- Consider whether to queue bets during rapid odds changes or reject immediately, and how to communicate rejections gracefully
- Discuss partitioning strategies that isolate hot events while maintaining consistency within each partition
2. Real-Time Odds Distribution at Scale
Millions of users watching the same popular game need odds updates pushed instantly as momentum shifts. Broadcasting every odds tick to every connected client creates unsustainable network and CPU load. Interviewers expect a sophisticated fanout design.
Hints to consider:
- Separate odds calculation (centralized, infrequent) from odds delivery (distributed, frequent) using pub/sub messaging
- Deploy regional WebSocket servers that subscribe to odds topics and multiplex updates to local clients
- Implement client-side throttling and delta updates so only changed odds are transmitted
- Handle connection storms when major events start by load-balancing connections and gracefully degrading to polling if push capacity is exceeded
3. Odds Calculation Under Betting Pressure
Odds must adjust dynamically as bets flow in to balance the platform's risk exposure. A naive recalculation on every bet creates a bottleneck. Interviewers probe whether you can batch updates, approximate risk in real-time, and trigger recalculations intelligently.
Hints to consider:
- Aggregate incoming bets in memory for short windows (100-500ms) before triggering odds recalculation
- Use a risk engine that maintains cumulative exposure per outcome and applies algorithmic adjustments when thresholds are crossed
- Precompute odds scenarios for common bet distributions to avoid expensive recomputation
- Discuss tradeoffs between recalculation frequency, odds volatility, and system load
4. Durable Settlement and Financial Consistency
When events conclude, the system must settle thousands of bets correctly, handle edge cases like cancelled games or disputed outcomes, and ensure every dollar is accounted for. Interviewers expect you to design for auditability and resilience against partial failures.
Hints to consider:
- Use a saga or multi-step workflow with idempotent operations: mark bets as settled, calculate payouts, update balances, commit ledger entries
- Store immutable bet and settlement records in append-only logs for auditing and dispute resolution
- Implement dead letter queues for problematic settlements that require manual review
- Consider distributed transactions or eventual consistency patterns if the ledger and user balance services are separate
Suggested Approach
Step 1: Clarify Requirements
Begin by confirming the scope of betting types -- will this support simple moneyline bets only, or complex parlays and live in-game micro-bets? Establish the scale: how many concurrent events, how many users per event, and what is the peak bet rate? Understand regulatory constraints such as geo-fencing, age verification, and audit retention. Clarify whether odds are set manually by traders, algorithmically, or a hybrid. Confirm latency and consistency expectations: can odds updates tolerate 1-2 second delays, or is sub-second critical? Determine if the system must prevent users from placing bets they cannot afford, requiring real-time balance checks.