Design a fast host listing metrics page
Company: Airbnb
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
Design the backend for a **host (landlord) listings page**.
User flow:
- Host opens a page showing **many of their listings**.
- Host selects a **date range**.
- For each listing shown, the UI displays aggregated metrics for that range, e.g.:
- **Nights booked** (how many nights are reserved within the range)
- **Average price** within the range
Assume you start with these tables:
- `Listings(listing_id, host_id, ... )`
- `Reservations(reservation_id, listing_id, start_date, end_date, status, ... )`
- `Pricing(listing_id, date, price, currency, ... )`
Problem:
- When a host has **100+ listings**, the page becomes slow.
Task:
- Propose an end-to-end design (APIs, data access patterns, storage/indexing, caching/precomputation) to make the page fast and scalable.
- Specify how you would compute the metrics correctly (including edge cases like partial overlap, cancellations) and keep them up to date.
- Include performance goals and how you would validate them.
Quick Answer: This question evaluates backend system design and data engineering competencies, including scalable API design, time-range aggregation correctness (handling partial overlaps and state changes), data modeling and indexing, caching and precomputation, and performance validation.