Overview
Source: The System Design Newsletter — Neo Kim
Airbnb connects millions of hosts and guests globally. Its system must handle complex inventory search (location-based, date-based, dynamic pricing), real-time availability, payments, and trust/safety — all at global scale.
Key Concepts
Geospatial Indexing — Listings are indexed by location using spatial data structures (S2 cells, GeoHash, or PostGIS) to efficiently answer "find listings near me" queries.
Availability Calendar — Each listing has a calendar of blocked/available dates. Concurrent booking attempts must be handled safely (optimistic locking or distributed locks).
Dynamic Pricing (Smart Pricing) — ML-driven price recommendations adjust based on demand, seasonality, local events, and competitor pricing.
Core Components
- Search Service — Queries listing index (Elasticsearch) filtered by location, dates, guests, amenities, price. Returns ranked results.
- Listing Service — CRUD for host listings. Writes to primary DB and indexes Elasticsearch.
- Availability Service — Manages the date-based availability calendar. Prevents double-booking via atomic reservation logic.
- Booking Service — Orchestrates the reservation flow: hold availability → process payment → confirm booking.
- Payment Service — Handles guest charges and host payouts across multiple currencies.
- Review Service — Two-way reviews from guests and hosts. Reviews published after both parties submit or after a deadline.
- Messaging Service — In-platform communication between hosts and guests.
- Trust & Safety Service — Fraud detection, ID verification, content moderation.
Search & Discovery Flow
- Guest enters location, dates, guest count
- Search Service queries Elasticsearch with geo-filter + date availability filter
- Results ranked by relevance, price, reviews, and ML ranking model
- Listing photos served from CDN
- Prices computed in real-time (base price × dynamic pricing factor)
Booking Flow (Preventing Double-Booking)
- Guest selects listing + dates → "Hold" placed on availability (optimistic lock)
- Payment authorization requested
- If payment succeeds → availability record updated atomically → booking confirmed
- If payment fails → hold released
- Email/push notifications sent to both parties
Scale Considerations
- Elasticsearch for geo + full-text search on millions of listings
- CDN for listing photos (most traffic is reads)
- Read replicas for listing/review queries
- Distributed caching for hot listings (price, availability summary)
- Idempotency on booking and payment to handle retries safely
Key Trade-offs
Decision | Reasoning |
Elasticsearch for search | Supports geo-queries + full-text natively |
Optimistic locking for availability | High contention only on popular dates/listings |
Async review publication | Prevents bias — neither party sees the other's review first |
ML-based ranking | Balances host revenue and guest conversion |