KatInterview

Caching and Inventory Architecture for a Vacation Rental Platform

System DesignModel answer
MediumModel answerSystem Designcachingdistributed-systemsconsistency

Last updated

Design a multi-tier caching system for a high-traffic rental marketplace that serves fast search results while guaranteeing zero double-bookings through authoritative holds.

Background

You are designing the caching and inventory management layer for a vacation rental marketplace — think short-term rentals of apartments, cabins, and villas worldwide. The platform serves a massive volume of read traffic as users browse listings and check availability, but the actual reservation process demands strict correctness: two guests must never end up with the same property on overlapping nights.

Your job is to connect the fast, potentially stale world of search caches with an authoritative booking engine that makes final decisions.

What You Need to Support

Core Features

  • Search and browsing: Guests search by location, travel dates, and party size. Results should feel instant.
  • Listing detail and pricing: Guests can view nightly rates, fees, and property details before committing.
  • Checkout hold: Once a guest starts the checkout flow, the property nights are reserved temporarily (10 minutes) so no one else can book them while payment processes.
  • Booking finalization: A successful payment converts the hold into a confirmed booking. A failed payment or expired timer releases the nights back to available inventory.

Quality of Service Goals

  • Search and listing endpoints must respond at p95 under 100 ms.
  • A given property-night must never be confirmed to two different guests.
  • Search must continue functioning even when the booking transaction engine is degraded.
  • Stale pricing or availability in search results is tolerable, as long as both are authoritatively verified before a hold is placed.

Scale to Design For

  • 500,000 properties, averaging 40 bookable units per property.
  • 50 million search requests per day (~600 QPS average, 3,000 QPS peak).
  • 100,000 bookings per day (~1.2 QPS average, 15 QPS peak).
  • Roughly a 500:1 read-to-write ratio.

What a Strong Answer Covers

  1. Multi-tier caching architecture — how you layer CDN, a distributed cache (e.g., Redis), and in-process memory caches, and which data lives where.
  2. Moving from cached search to an authoritative hold — the revalidation step and the full state machine: AVAILABLE → HELD → BOOKED, including expiry paths.
  3. Concurrency control and idempotency — how you prevent two simultaneous hold requests from both succeeding, and how retries stay safe.
  4. Cache invalidation and reconciliation — how booking events propagate back to update cached availability, and what happens when things fall out of sync.

Hints

Hint 1

Start by separating the read path from the write path. Search at 3,000 QPS and booking at 15 QPS have completely different requirements — your design should treat them as two distinct systems that share data, not one system that does both.

Hint 2

The cache is never the source of truth for whether a night can be sold. Think about what database primitive (row lock, conditional update, unique constraint) actually prevents two holds from claiming the same night, and work backward from there to figure out where Redis fits.

Hint 3

A hold that expires due to a crashed worker or a failed payment must automatically release inventory. Design the expiry as a condition that the database checks on the next claim attempt, rather than relying solely on a background sweeper — that way correctness does not depend on the sweeper running on time.