Design OLAP aggregation for advertising click events
Company: Amazon
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Onsite
Design the analytics and OLAP portion of an advertising click aggregator. Focus on event ingestion, storage, aggregation, and analytical queries rather than spending the discussion on a generic client or API gateway diagram. Cover geographic breakdowns and how you would compute means and P95/P99 for a specified numeric event measure.
```hint Preserve enough information to merge
Consider which statistics can be combined from partial aggregates and which lose essential information when summarized too early.
```
### Clarifying Questions
- What event measure needs means and percentiles, and what geographic and time dimensions are queried?
- Are duplicate clicks possible, and what is the acceptable delay for late events or corrections?
- Must percentiles be exact, or is a bounded approximation acceptable?
- What ingestion rate, retention period, and query freshness are required?
### What a Strong Answer Covers
- Event schema, identity, event time, and dimensional data
- Raw storage, streaming or batch rollups, and OLAP query layout
- Correctly mergeable counts, means, and percentile representations
- Late data, duplicates, retention, and operational verification
### Follow-up Questions
- Why can you not average regional P99 values to obtain the global P99?
- How would a late event change an already published daily aggregate?
- How would you detect a geographic breakdown that double-counts clicks?
Overview: Design the OLAP core of an ad-click aggregator, including geographic rollups and analytical statistics. Explain mergeable means, percentile computation, duplicate events, late corrections, raw storage, and query trade-offs.
Read the full Amazon Software Engineer interview experience this question came from