Problem Statement
Design the backend system for a host's listing metrics page. This page allows a host (landlord) to view aggregated performance metrics for many of their listings over a user-selected date range.
User Flow
- A host navigates to their listings page.
- The UI displays a list of their listings.
- The host selects a specific date range.
- For each listing displayed, the system must show aggregated metrics for the chosen date range, including:
- Nights booked: The total number of nights reserved within the selected range.
- Average price: The average nightly price for bookings within the selected range.
Initial Data Schema
Assume the following database tables are available:
Listings(listing_id, host_id, ...): Contains information about each property listing.Reservations(reservation_id, listing_id, start_date, end_date, status, ...): Stores details about bookings.Pricing(listing_id, date, price, currency, ...): Records the daily price for each listing.
Core Challenge
The current implementation becomes unacceptably slow when a host manages 100 or more listings. The goal is to design a system that can handle this scale efficiently.
Deliverables
Your design should cover:
- An end-to-end architecture, including APIs, data access patterns, storage/indexing strategies, and caching/precomputation mechanisms.
- Detailed explanation of how metrics (Nights booked, Average price) are computed correctly, addressing edge cases such as partial date range overlaps and reservation cancellations.
- Strategies for keeping the computed metrics up-to-date.
- Proposed performance goals and methods for validating that these goals are met.
AI interview prep
Core dilemma
Balancing the need for fast, on-demand aggregation of potentially large volumes of time-series data across many entities (listings) with the complexity of maintaining data freshness and correctness, especially considering variable date ranges and dynamic updates (reservations, pricing).
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 Statement
Design the backend system for a host's listing metrics page. This page allows a host (landlord) to view aggregated performance metrics for many of their listings over a user-selected date range.
User Flow
- A host navigates to their listings page.
- The UI displays a list of their listings.
- The host selects a specific date range.
- For each listing displayed, the system must show aggregated metrics for the chosen date range, including:
- Nights booked: The total number of nights reserved within the selected range.
- Average price: The average nightly price for bookings within the selected range.
Initial Data Schema
Assume the following database tables are available:
Listings(listing_id, host_id, ...): Contains information about each property listing.Reservations(reservation_id, listing_id, start_date, end_date, status, ...): Stores details about bookings.Pricing(listing_id, date, price, currency, ...): Records the daily price for each listing.
Core Challenge
The current implementation becomes unacceptably slow when a host manages 100 or more listings. The goal is to design a system that can handle this scale efficiently.
Deliverables
Your design should cover:
- An end-to-end architecture, including APIs, data access patterns, storage/indexing strategies, and caching/precomputation mechanisms.
- Detailed explanation of how metrics (Nights booked, Average price) are computed correctly, addressing edge cases such as partial date range overlaps and reservation cancellations.
- Strategies for keeping the computed metrics up-to-date.
- Proposed performance goals and methods for validating that these goals are met.