KatInterview

Design an Enterprise Event Analytics and Tracking Platform

System DesignModel answer
HardModel answerSystem Designsystem-designdistributed-systemsevent-driven

Last updated

Design an end-to-end event collection, processing, and storage platform supporting interactive dashboard queries and deep historical analytics.

Problem

Design a scalable Enterprise Event Analytics and Tracking Platform that captures, enriches, and serves user interactions across multiple web and mobile client applications.

The platform must ingest events (e.g., button_click, view_item, complete_checkout), collect payload data via client-side libraries and backend HTTP APIs, and deliver data to two distinct analytical query patterns:

  1. Interactive Metrics & Dashboards: Sub-second to low-second P95 latencies for real-time aggregation, filtering, conversion funnels, and high-level engagement metrics (such as DAU/WAU/MAU). Freshness lag target is under 3 minutes.
  2. Deep Historical Analytics & Data Science: Ad-hoc queries across multi-terabyte datasets spanning up to 13 months of historical log data.

The engine must also provide contextual enrichment (such as IP-to-geo resolution and user profile lookup) and enforce data privacy and compliance guidelines (e.g., PII tokenization, data residency enforcement, and deletion requests).

Scale & Requirements

  • Ingestion Volumetrics: Average throughput of 50,000 events per second (EPS), peaking at 250,000 EPS during high-traffic events. Average compressed JSON event size is ~1 KB.
  • Storage Retention: 30 days of granular data in hot/warm serving stores for interactive dashboards; 13 months of data in cold storage for deep analytics.
  • Freshness & Latency: Dashboards should reflect events within 1 to 3 minutes of generation. Interactive dashboard P95 query latency should be < 2 seconds.
  • Delivery & Accuracy: At-least-once ingestion combined with downstream deduplication to ensure exact metric counts. Zero tolerated data loss for verified client events.

Key Aspects to Cover

  1. Capacity & Volume Projections: Estimate network bandwidth, daily storage footprint, and peak ingestion throughput.
  2. End-to-End Architecture: Outline the path from SDK client collectors to API gateways, message queues, stream processors, and serving data stores.
  3. Data Contract & Schema Management: Formulate a extensible schema structure, schema versioning strategy, registry validation, and dead-letter queue (DLQ) path for corrupted payloads.
  4. Client SDK & Ingestion Mechanics: Explain client-side batching, retries under unstable network conditions, offline queueing, stateless server ingestion, and partition routing.
  5. Dual-Tier Storage Design: Select and justify storage technologies for low-latency interactive queries versus cost-efficient long-term historical storage.
  6. Enrichment & Compliance Architecture: Detail the placement of real-time stream enrichment vs. offline batch processing, identity resolution, PII masking, and data deletion workflows.

Hints

Hint 1

Calculate storage and network bandwidth early: 250K EPS at 1 KB per payload creates significant ingress bandwidth and daily storage requirements.

Hint 2

Decouple the ingestion pipeline completely from serving paths using a durable, partitioned commit log (e.g., Apache Kafka or AWS Kinesis).

Hint 3

Distinguish between client-side generation timestamps and server ingress timestamps to handle network delays and offline event batching.