Bird
Raised Fist0

Design Airbnb - Search, Booking, Calendar Availability, Review System

HLDhardInterview freq: high
Choose your preparation mode4 modes available
▶
Request Trace
Step 1/7
API Gateway

Receives user search request

API Gateway accepts HTTP REST search query from client

Protocol:HTTP/REST
BeforeUser has entered search criteria on client app
AfterSearch request forwarded to Search Service
Search Service

Processes search and returns listings

Search Service queries listings and returns results to API Gateway

Protocol:RPC
BeforeSearch Service has no active request
AfterSearch results ready and sent back to API Gateway
Booking Service

Receives booking request from API Gateway

Booking Service validates and confirms booking

Protocol:RPC
BeforeBooking Service idle, no booking in progress
AfterBooking confirmed and event published to Kafka
Kafka Queue

Queues booking event for downstream processing

Kafka Queue durably stores booking event for Calendar Service

Protocol:Kafka Produce/Consume
BeforeKafka Queue has no booking event for this property
AfterBooking event durably stored in Kafka partition
Calendar Service

Consumes booking event and updates availability

Calendar Service marks dates as booked and updates calendar

Protocol:Kafka Consume
BeforeCalendar shows property as available for booked dates
AfterCalendar updated to show booked dates as unavailable
Review Service

Receives user review submission

Review Service accepts review and publishes to Kafka

Protocol:RPC and Kafka Produce
BeforeReview Service idle, no pending reviews
AfterReview event published to Kafka for moderation
Moderation Service

Consumes review event and applies moderation rules

Moderation Service flags or approves review content

Protocol:Kafka Consume
BeforeModeration Service has no pending review events
AfterReview moderated and approved or flagged for manual review
🏗️
Architecture Diagram
Architecture Diagram
┌───────────────┐
│  API Gateway  │
└───────┬───────┘
        │ HTTP/REST
        ▼
┌───────────────┐
│ Search Service│
└───────┬───────┘
        │ RPC
        ▼
┌───────────────┐
│ Booking Service│
└───────┬───────┘
        │ Kafka Produce
        ▼
┌───────────────┐
│ Kafka Queue   │
└───────┬───────┘
        │ Kafka Consume
        ▼
┌───────────────┐
│ Calendar Service│
└───────┬───────┘
        │ RPC
        ▼
┌───────────────┐
│ Review Service│
└───────┬───────┘
        │ Kafka Produce
        ▼
┌───────────────┐
│ Kafka Queue   │
└───────┬───────┘
        │ Kafka Consume
        ▼
┌───────────────────┐
│ Moderation Service │
└───────────────────┘

This architecture diagram illustrates Airbnb's core flow from search to booking and review moderation. The API Gateway acts as the client entry point, routing search requests to the Search Service. Booking requests flow through the Booking Service, which publishes booking events to Kafka for asynchronous processing. The Calendar Service consumes these events to update property availability, ensuring eventual consistency. Reviews are handled similarly: the Review Service publishes review events to Kafka, which the Moderation Service consumes to enforce content policies. Kafka decouples services, enabling scalability and fault tolerance. This vertical flow emphasizes asynchronous event-driven design for booking and review workflows, while search remains synchronous for low latency.

Primary Focus

✓

Practice

(1/5)
1. In the routing request flow, at Step 4 the Routing Engine queries the Road Graph Service for shortest path data. What happens if the Road Graph Service returns stale cached data due to delayed updates?
easy
A. The Routing Engine fails the request and returns an error to the user
B. The Routing Engine recalculates the path ignoring the stale data
C. The Routing Engine requests fresh data synchronously from the live traffic API
D. The Routing Engine returns a suboptimal route with outdated ETA estimates

Solution

  1. Step 1: Trace Routing Engine behavior at Step 4

    The Routing Engine relies on Road Graph Service for path and ETA; stale data leads to incorrect routing.
  2. Step 2: Understand error handling on stale data

    Routing Engine does not silently accept stale data (B) or recalculate ignoring it (A); it fails gracefully (D) to avoid misleading users.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Routing Engine fails on stale Road Graph data to prevent wrong routes [check]
Hint: Routing Engine fails on stale graph data to avoid bad routes [check]
Common Mistakes:
2. In a MongoDB data model using the bucket pattern for time-series data, at step 3 of the write flow, the system checks if the current bucket document is full. What happens if the bucket is full at this step?
easy
A. A new bucket document is created and the write is appended there to maintain document size limits.
B. The write is rejected and the client must retry with a new bucket ID.
C. The existing bucket document is updated by splitting it into two smaller documents automatically.
D. The write is appended to the existing bucket document regardless of size, risking document growth beyond limits.

Solution

  1. Step 1: Understand bucket pattern write flow

    Writes append to a bucket document until size or time limits are reached.
  2. Step 2: Behavior when bucket is full

    System creates a new bucket document to avoid exceeding MongoDB's 16MB document size limit.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    New bucket created to respect document size limits [check]
Hint: Full bucket triggers new document creation to avoid size limit [check]
Common Mistakes:
3. In the metrics collection system, at step 4 the Aggregation Worker receives a batch of metrics from Kafka. What happens if the Aggregation Worker detects a missing metric timestamp in this batch?
easy
A. The Aggregation Worker skips the missing timestamp metric and processes the rest of the batch
B. The Aggregation Worker inserts a default timestamp and continues processing
C. The Aggregation Worker pauses processing and waits for manual intervention
D. The Aggregation Worker discards the entire batch and requests a retry from Kafka

Solution

  1. Step 1: Aggregation Worker error handling

    Discarding entire batch (A) or pausing (C) causes unnecessary delays; default timestamps (D) risk data corruption.
  2. Step 2: Skipping invalid metrics

    Skipping only the invalid metric preserves throughput and data integrity for valid metrics.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Skip invalid metrics, process valid batch entries [check]
Hint: Skip bad metrics, keep batch flowing smoothly [check]
Common Mistakes:
4. At 10x scale, which component in a Raft cluster is most likely to become the bottleneck first, and why?
hard
A. The client load balancer, because it cannot distribute requests evenly at large scale
B. Followers, because they must store all log entries locally, increasing disk I/O linearly
C. The network, because Raft requires all nodes to broadcast heartbeats simultaneously, saturating bandwidth
D. The leader, because it handles all client requests and replicates logs to every follower, creating CPU and network bottlenecks

Solution

  1. Step 1: Identify Raft leader responsibilities

    The leader serializes all client writes and replicates logs to followers, causing CPU and network load concentration.
  2. Step 2: Analyze scaling impact

    At 10x scale, leader's CPU and network become bottlenecks before followers or network saturate.
  3. Final Answer:

    Option D -> Option D
  4. Quick Check:

    Leader handles all writes and replication -> first bottleneck at scale [check]
Hint: Raft leader handles all writes and replication -> bottleneck at scale [check]
Common Mistakes:
5. At 10x scale, which component is most likely to fail first due to the exact lookup requirement, and why?
hard
A. The backend database, because it cannot handle the increased exact lookup queries without Bloom filter filtering
B. The network layer, because increased traffic from exact lookups saturates bandwidth
C. The Bloom filter component, because its false positive rate grows linearly with scale, causing excessive backend queries
D. The cache layer, because it cannot store all keys for exact lookups at 10x scale

Solution

  1. Step 1: Understand Bloom filter scaling behavior

    Bloom filter false positive rate increases with scale unless filter size grows proportionally, causing more backend queries.
  2. Step 2: Analyze component failure likelihood

    Backend (A) fails eventually but Bloom filter inefficiency causes overload first. Network (C) and cache (D) are bottlenecks but secondary to Bloom filter false positive explosion.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Bloom filter false positives grow with scale, triggering backend overload first [check]
Hint: Bloom filter false positives grow with scale, overload backend first [check]
Common Mistakes:
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard