System Design
Design a real-time Restaurant Analytics Dashboard
- System requirements: show order volume, top dishes, and revenue for the past 1h, 1d, and 7d. Data must update in real time, and throughput needs to support 100K orders/sec.
- Primary store schema design: determine the primary storage's tables, partition key, and columns.
- Cache key design: determine the Redis key pattern and the corresponding TTL.
- Access pattern design: explain how the 1h, 1d, and 7d queries each hit the right storage tier precisely, without scanning millions of rows of raw orders.
- Rollup aggregation design: explain the specific aggregation strategy for rolling up data at the minute, hour, and day level.
- Follow-up 1: How do you handle an extremely heavy read load?
- Follow-up 2: If Redis goes down, how do you replay through Kafka and rebuild the data?
- Follow-up 3: How do you efficiently extract the top 3 dishes? How do you keep a full dish-frequency map in storage and merge it at read time?
- Follow-up 4: How do you handle late-arriving events, and how do you use Flink watermarks?
Discussion
Loading comments…