Design ad click aggregator and file sync service
Company: Apple
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Onsite
You have two system design prompts.
## 1) Design an ads click aggregation system
Design a service that ingests ad click events at very high QPS and supports aggregated analytics.
### Functional requirements
- Ingest click/impression events (at least clicks; optionally impressions) from multiple frontends.
- Provide near-real-time aggregates such as:
- clicks per `ad_id` / `campaign_id` / `advertiser_id`
- breakdown by time window (e.g., per minute, per hour, per day)
- optionally by country/device
- Support querying these aggregates via an API (and/or dashboard).
### Non-functional requirements
- High write throughput; scalable horizontally.
- Handle duplicates and retries (idempotency).
- Handle late/out-of-order events.
- Clearly define consistency/latency targets (e.g., “within 1–5 minutes”).
## 2) Design a file storage + sync service (Dropbox-like)
Design a cloud file sync product where users can upload files, keep folders in sync across devices, and share files.
### Functional requirements
- Upload/download files and list folders.
- Sync changes across multiple devices (near real-time).
- Versioning (recover older versions) and deletion/restore.
- Sharing via link and/or ACL-based sharing.
### Non-functional requirements
- Large files support (chunking/resumable upload).
- Efficient storage (dedup/content-addressing acceptable).
- Security (authn/authz, encryption).
- High availability and scalability.
For both prompts, explain APIs, data model, major components, scaling strategy, and key trade-offs.
Quick Answer: This question evaluates system design competencies in building scalable, reliable distributed services—covering high-throughput event ingestion and aggregation, real-time analytics, idempotency and out-of-order handling for ad click processing, and cloud file storage, synchronization, versioning and secure sharing for a Dropbox-like service, and it falls under the System Design domain. It is commonly asked to assess architectural thinking about APIs, data models, major components, scaling strategies and operational trade-offs, and focuses primarily on conceptual architectural understanding with practical application constraints like latency, consistency, throughput, storage efficiency and security.