Design an Ads Click Aggregation System
Design a service responsible for ingesting ad click events at very high QPS and supporting aggregated analytics in near real-time.
Functional Requirements
- Event Ingestion: Ingest click and optionally impression events from multiple frontends.
- Near Real-time Aggregates: Provide aggregated analytics with breakdowns, such as:
- Clicks per
ad_id,campaign_id, andadvertiser_id. - Breakdown by time window (e.g., per minute, per hour, per day).
- Optionally, breakdown by country and/or device.
- Clicks per
- Querying: Support querying these aggregates via an API or dashboard.
Non-Functional Requirements
- High Write Throughput: The system must handle a very high query per second (QPS) rate for event ingestion and be horizontally scalable.
- Data Integrity: Handle duplicate and retry events, ensuring idempotency.
- Event Ordering: Gracefully handle late and out-of-order events.
- Consistency & Latency: Clearly define and meet consistency and latency targets (e.g., aggregates available within 1-5 minutes).
Deliverables
For your design, explain the proposed APIs, data model, major components, scaling strategy, and key trade-offs.
AI interview prep
Core dilemma
Balancing extreme write throughput and low-latency ingestion with the need for accurate, eventually consistent, and queryable aggregates, especially when dealing with imperfect event streams (duplicates, late/out-of-order events).
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design an Ads Click Aggregation System
Design a service responsible for ingesting ad click events at very high QPS and supporting aggregated analytics in near real-time.
Functional Requirements
- Event Ingestion: Ingest click and optionally impression events from multiple frontends.
- Near Real-time Aggregates: Provide aggregated analytics with breakdowns, such as:
- Clicks per
ad_id,campaign_id, andadvertiser_id. - Breakdown by time window (e.g., per minute, per hour, per day).
- Optionally, breakdown by country and/or device.
- Clicks per
- Querying: Support querying these aggregates via an API or dashboard.
Non-Functional Requirements
- High Write Throughput: The system must handle a very high query per second (QPS) rate for event ingestion and be horizontally scalable.
- Data Integrity: Handle duplicate and retry events, ensuring idempotency.
- Event Ordering: Gracefully handle late and out-of-order events.
- Consistency & Latency: Clearly define and meet consistency and latency targets (e.g., aggregates available within 1-5 minutes).
Deliverables
For your design, explain the proposed APIs, data model, major components, scaling strategy, and key trade-offs.