Sign in to track progress, unlock prep layers, and browse your pipeline.Sign in
Problem: Design an Ad Assignment API
Design a production service that exposes an ad-assignment function via an API.
The service must:
- Receive a user identifier, a list of browser positions, and a set of candidate ads.
- Randomly assign eligible ads to the provided positions.
- Respect each ad's per-user display limit during assignment.
- Persist and update the per-user ad display state.
Discussion Points:
- API endpoint(s) design.
- Choice of communication protocol (e.g., REST, RPC) and justification.
- Appropriate HTTP method for generating an assignment.
- URL structure for the API.
- Request and response schema definitions.
- Strategy for storing per-user ad display state.
- Handling concurrent requests for the same user to ensure safe state updates.
- Definition of API errors exposed to clients.
- Approaches to ensure the API's reliability, observability, and maintainability.
AI interview prep
Core dilemma
Balancing the need for low-latency ad assignment with the strict requirement to maintain accurate and consistent per-user ad display limits, especially under high concurrency and potential state update conflicts.
Mid-level signals3
Senior signals4
Red flags3
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Problem: Design an Ad Assignment API
Design a production service that exposes an ad-assignment function via an API.
The service must:
- Receive a user identifier, a list of browser positions, and a set of candidate ads.
- Randomly assign eligible ads to the provided positions.
- Respect each ad's per-user display limit during assignment.
- Persist and update the per-user ad display state.
Discussion Points:
- API endpoint(s) design.
- Choice of communication protocol (e.g., REST, RPC) and justification.
- Appropriate HTTP method for generating an assignment.
- URL structure for the API.
- Request and response schema definitions.
- Strategy for storing per-user ad display state.
- Handling concurrent requests for the same user to ensure safe state updates.
- Definition of API errors exposed to clients.
- Approaches to ensure the API's reliability, observability, and maintainability.