Katkat

Design an ads data model

NetflixSoftware Engineer · Onsite

Last updated

This problem tests your ability to design a scalable, reliable data schema for an advertising platform that must support high-throughput event ingestion and real-time analytical queries.

Design an Ads Data Model

Netflix is introducing an ad-supported tier and needs a robust data architecture to manage ad campaigns, targeting rules, and the massive stream of performance events (impressions, clicks, and skips).

Requirements

Functional Requirements:

  1. Store campaign metadata: Advertiser info, budget, creative assets, and targeting criteria.
  2. Ingest ad-interaction events: Each event includes event_id, user_id, ad_id, timestamp, event_type (impression/click/skip), and device_metadata.
  3. Support reporting: Advertisers need dashboards showing performance metrics aggregated by day, ad, and creative group.

Non-Functional Requirements:

  1. High write availability for event ingestion (billions of events per day).
  2. Low-latency retrieval for campaign metadata during ad selection.
  3. Data consistency for budget management (preventing overspending).

Your Task

  1. Define the core data entities and their relationships.
  2. Propose a storage strategy: Explain how you would separate the OLTP data (campaign state) from the OLAP data (event stream/analytics).
  3. Outline the data pipeline: How do raw events transition into an analytics-ready format?
  4. Address scale: Discuss your partitioning strategy for the event data and how you would handle event deduplication.

Hints

Hint 1

Consider using a relational database for campaign metadata to ensure ACID compliance for budget tracking.

Hint 2

For the massive event stream, evaluate the trade-offs between using a NoSQL store versus a data lake architecture (e.g., S3/Parquet).

Hint 3

Think about using a lambda or kappa architecture to bridge the gap between real-time monitoring and historical reporting.

Follow-up questions

  • How would you handle late-arriving events that occur when a user is offline?
  • How would you evolve your schema if an advertiser wants to add complex, custom targeting attributes to their campaign?
  • If an ad campaign suddenly goes viral, how would you prevent a 'hot partition' issue in your event storage?