Case study · Stack

How Airbnb grew from a Rails monolith into services on Kubernetes

Airbnb started as a single Ruby on Rails app and, as the engineering team grew past a few hundred people, split it into Java services. Today it runs on AWS and Kubernetes, with a React and TypeScript web app, native iOS and Android apps, and data tools it built and open sourced, like Airflow and Superset.
Copy this stackairbnb.com Marketplace for stays and experiences · United States · founded 2008

Language

  • Javainfoq.com

    Main language of the backend services that replaced the monolith.

    Why: Multithreading let services handle requests in parallel, which the single-threaded Ruby monolith could not.

  • TypeScriptmedium.com

    Official language for frontend web code.

UI library

  • Reactmedium.com

    Builds the airbnb.com web interface, rendered on the server through Hypernova.

Hosting

  • AWSairbnb.tech

    Cloud where Airbnb runs, including EBS volumes for its databases.

  • Kubernetesairbnb.tech

    Self-managed clusters that run services, Viaduct and even distributed databases.

  • Istioairbnb.tech

    Service mesh carrying tens of millions of requests per second at peak since 2019.

Database

  • MySQLairbnb.tech

    Main relational database, spread across hundreds of clusters.

Mobile framework

  • Swiftairbnb.tech

    Language of the native iOS app.

  • Kotlinairbnb.tech

    Language of the native Android app and of Viaduct's typed API.

Animation

  • Lottieairbnb.tech

    In-house library that plays high-quality animations in the native apps.

Build and runtime

  • Bazelairbnb.tech

    Build system for the JVM monorepo of Java, Kotlin and Scala code.

    Why: Gradle builds had become too slow and flaky, and Bazel brings sandboxing plus shared remote caching for every repo.

Data fetching

  • GraphQLairbnb.tech

    Powers Viaduct, the in-house layer that gives every team one interface to all data.

  • Kafkaairbnb.tech

    Replication log that makes writes durable in Airbnb's key-value store.

    Why: Its stable millisecond p99 latency made it reliable enough to carry writes through migrations.

  • Apache Airflowairflow.apache.org

    Schedules data pipelines as graphs of tasks; it was created at Airbnb.

Backend framework

  • Ruby on Railsinfoq.com

    Framework of Monorail, the original monolith behind airbnb.com.

Analytics

  • Apache Supersetairbnb.tech

    Business intelligence app that Airbnb created and open sourced.

How they built it

Monorail: when the monolith became the bottleneck

For years Airbnb ran on Monorail, its Ruby on Rails monolith. Around 2015, with more than 200 engineers shipping about 200 commits a day, deploys were blocked for about 15 hours a day on average because of reverts and rollbacks. A single shared database meant a change in one place often broke something unrelated.

Deploy trains stretched to hours and nobody was sure who owned what. In the words of engineer Jessica Tai, Monorail deploys were a huge pain point that was dragging down developer productivity.

Sources:infoq.com

The move to services in Java

Airbnb then broke Monorail into services. Java and Ruby were both allowed, but many services went to Java because multithreading let them run requests in parallel, which the single-threaded Ruby monolith could not. Every service described its API in Thrift, which generated Java and Ruby clients and standard metrics and alerts.

By 2018 more than 250 services and 1,000 endpoints were on the framework. Deploys went from hours to minutes, weekly deploys rose from 3,000 to 10,000, and the search page got about 3 times faster.

Sources:infoq.com

Web on React and TypeScript, mobile back to native

On the web, Airbnb moved away from fully server-rendered Rails pages to React, rendered on the server by its own Node service, Hypernova. Later it made TypeScript the official language for frontend web work and wrote ts-migrate to convert millions of lines at once.

On mobile, Airbnb bet on React Native and then announced in 2018 that it would sunset it and focus on native development. The apps are now written in Swift and Kotlin, with in-house libraries like Epoxy for building screens and Lottie for animations.

Sources:medium.com medium.com medium.com airbnb.tech

AWS, Kubernetes and a GraphQL layer over everything

Airbnb runs on AWS with self-managed Kubernetes clusters, and even spreads distributed databases across three clusters, each in a different availability zone, so a bad deploy only hits one zone. Its main relational fleet is MySQL, hundreds of clusters handling millions of queries per second, recently upgraded from 5.7 to 8.0.

To tame the sprawl of services, Airbnb built Viaduct, a GraphQL layer that gives every team one place to read any data. Its huge JVM monorepo of Java, Kotlin and Scala code now builds with Bazel, after a move off Gradle that took 4.5 years.

Sources:airbnb.tech airbnb.tech airbnb.tech airbnb.tech

Data tools that became open source standards

Several tools other companies now rely on came out of Airbnb's data team. Maxime Beauchemin started Airflow there in October 2014 to schedule data pipelines, and it was open sourced in 2015. Superset, a business intelligence app, came from the same place.

More recently Airbnb released Chronon, a platform that serves data to machine learning models.

Sources:airflow.apache.org airbnb.tech

Also detected on their website

Found on the homepage with the open Wappalyzer rules (HTML, scripts and headers). It shows what runs in the browser, not the whole backend.

  • Akamai
  • Akamai Bot Manager
  • Arkose Labs
  • C3.js
  • Envoy
  • GeeTest
  • HSTS
  • HTTP/3
  • Klarna Checkout
  • Nginx
  • PayPal
  • Plaid
  • RequireJS
  • Ruby