KatInterview

Multi-Tenant Ad Delivery and Performance Analytics Platform

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

Last updated

Architect a multi-tenant ad server and analytics engine that reliably serving ads, deduplicates metrics, and aggregates cross-campaign performance stats.

Architect an end-to-end advertising system capable of hosting multiple distinct organizations, serving targeted ads under low latency, tracking user interaction events, and serving deduplicated performance metrics to compare ad effectiveness across campaigns.

Key Requirements

  1. Campaign & Ad Management: Allow multiple organization accounts to upload, update, and manage their creative assets, targeting criteria, and budget parameters.
  2. Ad Selection & Serving: Process incoming ad requests from publisher placements, filter and select eligible ads based on targeting rules, and return the response within strict latency budgets (< 50ms).
  3. Event Ingestion & Deduplication: Capture lifecycle events (impressions, clicks, conversions) reliably. Filter out spam, duplicate impressions, and late-arriving events.
  4. Analytics & Fair Comparison: Store and aggregate metrics to enable tenant-isolated dashboards and fair, normalized performance comparisons between different ads and campaigns.

Key Constraints & Considerations

  • Clarify latency SLAs, scale (QPS for serving vs. event ingestion throughput), and consistency requirements.
  • Account for tenant isolation: an organization should never access another organization's raw data.
  • Detail how duplicate clicks or impressions are identified and handled in high-throughput streaming environments.

Hints

Hint 1

Break the architecture down into distinct paths: a low-latency read/serving path, a high-throughput event ingestion path, and an asynchronous analytical/aggregation path.

Hint 2

To prevent double-counting impressions or clicks, use unique transaction/impression tokens generated at ad-serving time with a sliding-window cache or stream processing key (e.g., Redis or Flink state).

Hint 3

When measuring comparative performance across campaigns, raw click counts are insufficient due to differences in reach; consider normalized metrics like CTR, CPC, or statistical significance tests.