MetricFlow is building a real-time analytics platform (like a simplified Mixpanel/Amplitude). Customers embed a JavaScript SDK that sends user interaction events. The system then:
- Event ingestion - receive clickstream events (page view, button click, form submit, custom events) at 100,000 events per second at peak.•Real-time aggregation - compute metrics in real time: active users right now, events per minute, top pages, funnel conversion rates.•Dashboards - a web dashboard showing live-updating charts and counters. Data freshness: < 5 seconds from event to dashboard.•Historical queries - ad hoc queries over the last 90 days of data: "Show me daily active users by country for the last month."•Segmentation - filter events by user properties (plan, country, device) and event properties.•Funnel analysis - define multi-step funnels (e.g., Landing → Sign Up → First Purchase) and compute conversion rates.
Handle 100,000 events/second with 90 days retention (~500 billion events total).
Design a real-time analytics pipeline that ingests clickstream events and powers live dashboards with < 5 s latency. Build this architecture under realistic production constraints, then validate tradeoffs in the design lab simulation.
Request path: The solution keeps ingress, service logic, and stateful dependencies separated so each layer can scale independently.
Reference flow: Web Clients -> Load Balancer -> API Gateway -> API Service -> Primary NoSQL DB -> Redis Cache -> Event Bus -> Background Workers