← All posts

Apr 2026 · 15 min read · System Design, Observability, Backend

How Airbnb Stores 50 Million Metrics Per Second

A Deep Dive into Time Series Databases, Ingestion Pipelines, and the Compression Magic Behind 2.5 Petabytes of Observability Data

Based on Airbnb's Engineering Blog: "Building a Fault-Tolerant Metrics Storage System at Airbnb" (April 2026)


The Scale Problem

Modern software is instrumented everywhere. Every API call, every database query, every cache hit. Each one emits a tiny measurement. At Airbnb's scale, this adds up fast:

1,300,000,000    active time series at any moment (1.3 billion)
50,000,000       samples ingested every second (50 million)
2,500,000        GB of logical data stored (2.5 petabytes)

When Airbnb decided to move from a hosted third-party metrics provider to an internally operated system, they had to answer three hard questions:

  1. How do you get 50M data points per second into the system without dropping any?
  2. Where do you actually store 2.5 petabytes, and in what format?
  3. How do you query across a billion time series fast enough for a dashboard to load?

This post walks through each answer, and the clever engineering behind them.


Part 1: Key Concepts

Before diving in, let's demystify the terminology.

What is a "Tenant"?

Think of an apartment building. One building, many residents, each with their own locked door, their own space. The building owner manages everything, but tenants don't interfere with each other.

In Airbnb's system, a tenant = one service/application. With ~1,000 services (payments, search, booking, etc.), each gets its own logical slice of the shared infrastructure.

┌─────────────────────────────────────────────┐
│           Shared Metrics Cluster            │
│                                             │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │ payments │  │  search  │  │ booking  │   │
│  │ service  │  │   api    │  │ service  │   │
│  │ (tenant) │  │ (tenant) │  │ (tenant) │   │
│  └──────────┘  └──────────┘  └──────────┘   │
│                                             │
│     Each tenant: isolated, rate-limited,    │
│     independently monitored                 │
└─────────────────────────────────────────────┘

Airbnb chose service-level tenants (not team-level) because teams reorganize frequently, but services are stable. This also enables precise cost attribution: in the future, teams can be billed for exactly how much observability infrastructure they consume.

What is a "Time Series"?

A time series is a stream of (timestamp, value) pairs with labels attached:

http_requests_total{service="payments", status="200", region="us-east-1"}

timestamp    value
─────────────────
1714200000   5,432
1714200015   5,489
1714200030   5,501
1714200045   5,498
     ...      ...

A single time series = one unique combination of metric name + all its labels. With 1.3 billion of these active at once, even a tiny per-series overhead adds up to enormous scale.

What is "Blast Radius"?

When something breaks in a distributed system, blast radius = how many things get hurt.

❌ Single cluster failure:
   ALL 1,000 tenants lose observability
   Blast radius: ENTIRE company

✅ Multi-cluster failure:
   Only tenants in THAT cluster are affected
   Blast radius: ~100-200 tenants

Airbnb's architecture was designed to minimize blast radius at every layer.


Part 2: The Write Path (How Data Gets In)

Step 1: Services Emit Metrics

Every service emits metrics in one of three formats that coexisted at Airbnb:

┌─────────────────────────────────────────────────────┐
│                  Service Fleet                      │
│                                                     │
│  ┌──────────┐   ┌──────────┐   ┌──────────────┐     │
│  │  StatsD  │   │  OTLP    │   │  Prometheus  │     │
│  │ (legacy) │   │(modern)  │   │   format     │     │
│  └────┬─────┘   └────┬─────┘   └──────┬───────┘     │
│       │              │                │             │
└───────┼──────────────┼────────────────┼─────────────┘
        │              │                │
        └──────────────▼────────────────┘
                   vmagent

Step 2: vmagent, the Aggregation Funnel

Before data hits storage, it goes through vmagent, which does two critical things:

Aggregation: If 500 pods all emit the same counter 10x/second, vmagent collapses that into a single aggregated value. Without this, storage costs would be 500x higher.

Protocol normalization: It accepts StatsD, OTLP, and Prometheus formats and converts everything to Prometheus Remote Write, the single protocol the storage layer understands.

BEFORE vmagent:
pod-1: http_requests=100
pod-2: http_requests=98
pod-3: http_requests=103
... (500 pods) ...
→ 500 writes/scrape

AFTER vmagent:
http_requests{aggregated=true} = 50,300
→ 1 write/scrape

Reduction: 500x fewer writes to storage

Step 3: Thanos Receiver, Ingestion with Shuffle Sharding

Aggregated metrics arrive at Thanos Receivers (ingesters). This is where shuffle sharding routes each tenant's data to their own subset of nodes.

                    Incoming metrics
                    (50M samples/sec)
                          │
                    ┌─────▼──────┐
                    │   Router   │  ◄── shuffle sharding
                    └─────┬──────┘      assigns tenant → nodes
                          │
          ┌───────────────┼───────────────┐
          │               │               │
    ┌─────▼─────┐   ┌─────▼─────┐   ┌────▼──────┐
    │ Receiver 1│   │ Receiver 2│   │ Receiver 3│
    │           │   │           │   │           │
    │ tenant: A │   │ tenant: B │   │ tenant: C │
    │ tenant: D │   │ tenant: A │   │ tenant: B │
    │           │   │ tenant: D │   │ tenant: D │
    └───────────┘   └───────────┘   └───────────┘

Each tenant writes to 2-3 receivers (replication factor)
Tenant A → Receivers 1 & 2
Tenant B → Receivers 2 & 3
Tenant C → Receiver 3 only
Tenant D → Receivers 1, 2 & 3

Why shuffle sharding instead of consistent hashing?

With consistent hashing, Tenant A is always on nodes 1 & 2. If Tenant A causes a DDoS or runaway metric cardinality explosion, nodes 1 & 2 die, and every other tenant on those nodes loses observability.

With shuffle sharding, tenant-to-node assignments are randomized. The probability that any two tenants share all the same nodes becomes very small. A noisy tenant can only damage tenants with overlapping node assignments, a much smaller blast radius.

Node failure scenario:

  Consistent hashing:          Shuffle sharding:
  
  Node 1 ──► DOWN              Node 1 ──► DOWN
  Node 2 ──► DOWN              Node 2 ──► DOWN
                               Node 3 ──► OK ✓
  Tenants affected:            Node 4 ──► OK ✓
  EVERYONE on nodes 1&2        
                               Tenants affected:
                               Only those assigned
                               to nodes 1 AND 2
                               (statistically few)

Inside a Receiver: WAL + In-Memory TSDB

When data lands on a receiver, two things happen simultaneously:

Incoming remote write
        │
        ├──► Write-Ahead Log (WAL)
        │    on persistent disk
        │    "crash journal"
        │    → survives node restart
        │
        └──► In-memory TSDB head
             fast, queryable immediately
             → flushed to disk every 2 hours

The WAL is the safety net. If a receiver crashes mid-write, on restart it replays the WAL and recovers everything in memory. No data loss.


Part 3: The Database (How Data Is Stored)

There is no MySQL, no Postgres, no Cassandra here. Airbnb uses a purpose-built time series storage engine.

Prometheus TSDB: Purpose-Built for Time Series

A general-purpose database is optimized to handle many different access patterns. Prometheus TSDB makes one bet: all you ever do is read and write (timestamp, value) pairs, indexed by metric name + labels, in time order.

That single assumption unlocks dramatic optimizations.

The Block-Based Storage Layout

Data is organized into immutable blocks, each covering a 2-hour window:

Disk layout:
/data/
  ├── 01HXK2M... (block: 2024-04-27 00:00 – 02:00)
  │   ├── chunks/
  │   │   ├── 000001   ← compressed time series data
  │   │   └── 000002
  │   └── index        ← label → chunk mapping
  │
  ├── 01HXK4N... (block: 2024-04-27 02:00 – 04:00)
  │   ├── chunks/
  │   └── index
  │
  └── 01HXK6P... (block: 2024-04-27 04:00 – 06:00)
      ├── chunks/
      └── index

Blocks are immutable once written. This makes them perfect for compression (you know all the data, so you can compress optimally) and for shipping to S3 (they never change, so S3's eventual consistency isn't a problem).

Hot Tier vs Cold Tier

Timeline ──────────────────────────────────────────►

│◄── last 2 hours ──►│◄───── rest of history ──────► │
│                    │                               │
│   In-memory TSDB   │      S3 Object Storage        │
│   + local SSD      │      (unlimited, cheap)       │
│                    │                               │
│   ~microsecond     │      ~millisecond             │
│   query latency    │      query latency            │
│                    │                               │
│   Expensive        │      ~$23/TB/month            │
│   (RAM + NVMe)     │      (S3 standard)            │

Every 2 hours: blocks sealed, compressed, uploaded to S3

Compaction: Making Old Data Queryable Fast

Over time, many small 2-hour blocks get merged:

Day 1:  [00-02][02-04][04-06]...[22-24]   ← 12 blocks
                    │
                    ▼ compaction
Day 2:  [─────── day 1 ────────]           ← 1 block
                    │
                    ▼ compaction  
Week 1: [────────── week ──────────────]   ← 1 block

Fewer, larger blocks = faster range queries. Querying "show me last week's data" scans 1 block instead of 84.


Part 4: The Compression (How 16 Bytes Becomes 1.75)

This is where it gets genuinely beautiful.

The Naive Math (The Problem)

64-bit timestamp  +  64-bit float value  =  16 bytes/sample

50,000,000 samples/second × 16 bytes = 800 MB/second
                                     = 67 TB/day
                                     = 24 PB/year

💸 Unsustainable.

Trick 1: Delta-of-Delta Encoding (Timestamps)

A metric scrape happens every 15 seconds, like clockwork:

Raw timestamps:
1714200000
1714200015   (+15)
1714200030   (+15)
1714200045   (+15)
1714200060   (+15)

Delta encoding:
base: 1714200000, deltas: [15, 15, 15, 15]

Delta-of-delta encoding:
base: 1714200000, first delta: 15, dod: [0, 0, 0, 0]

When the delta-of-delta is 0 (perfectly regular scrape), it encodes to just 1 bit. When there's a small variation (e.g., network jitter), it needs a few more bits. Rarely does a timestamp need more than 32 bits.

Encoding          Bits used    When
─────────────────────────────────────────────
delta-of-delta=0      1 bit    Perfect regularity (most common)
small variation      10 bits   Minor jitter
medium variation     13 bits   Notable jitter
large variation      33 bits   Exceptional case

Average: ~1.5 bits per timestamp
vs 64 bits naive
→ ~43x compression on timestamps alone

Trick 2: XOR Encoding (Values)

Real-world metric values don't jump wildly between samples. CPU goes from 42.3% to 42.7%. Latency goes from 230ms to 231ms. This smoothness is exploitable.

XOR of two similar floating-point numbers produces a result with lots of leading and trailing zeros:

42.3 in IEEE 754:
  0 10000000100 0101001100110011001100110011001100110011001101

42.7 in IEEE 754:
  0 10000000100 0101100110011001100011001100110011001100110011

XOR result:
  0 00000000000 0000101010101010101011110111000000000000000000
  │◄──────────────────────────────────────────────────────►│
  │  many leading zeros │ meaningful bits │ trailing zeros  │

TSDB only stores: [leading_zero_count][meaningful_bits][trailing_zero_count]

For smooth metrics, only a handful of bits in the middle actually change. The compression encodes just those bits plus two small numbers as bookends.

Gorilla paper (Facebook) results on production data:
  ┌─────────────────────────────────────────┐
  │ 96% of samples compress to ≤ 26 bits   │
  │ vs 64 bits naive                        │
  │ → ~2.5x compression on values           │
  └─────────────────────────────────────────┘

The Combined Result

              Naive       After Compression
              ──────      ─────────────────
Timestamp     64 bits     ~1.5 bits
Value         64 bits     ~12 bits
              ───────     ─────────────────
Total         128 bits    ~13.5 bits
              (16 bytes)  (~1.69 bytes)

Compression ratio: ~9.5x

50M samples/sec × 1.69 bytes = ~85 MB/second
                              = ~7 TB/day
                              = ~2.5 PB/year ✓

This matches Airbnb's real number. The compression math is the reason 2.5 petabytes is actually achievable at reasonable cost.


Part 5: The Read Path (How Queries Work)

PromQL: The Query Language

PromQL is purpose-built for time series arithmetic. A few examples:

# Per-second request rate over 5-minute window
rate(http_requests_total{service="payments"}[5m])

# 95th percentile latency
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))

# Requests per second across all services
sum by (service) (rate(http_requests_total[1m]))

The Query Journey

Engineer opens Grafana dashboard
              │
              │ PromQL query
              ▼
         Thanos Querier
              │
      ┌───────┴────────┐
      │                │
      ▼                ▼
 Thanos Receiver   Store Gateway
 (hot data:        (cold data:
  last 2 hours)     S3 blocks)
      │                │
      └───────┬────────┘
              │ merge + deduplicate
              ▼
         Thanos Querier
              │
              ▼
    Result returned to Grafana

The Querier is the brain. It knows where hot and cold data live and fans the query out to both simultaneously. From Grafana's perspective, it made one query; all the stitching is transparent.

Cross-Cluster Queries via Promxy

When tenants span multiple clusters (Airbnb's multi-cluster strategy), a layer above the Querier handles federation:

Grafana
   │
   ▼
Promxy  ◄── custom Airbnb extensions:
   │        - native histogram support
   │        - query fanout optimization
   │
   ├──► Cluster A (Thanos Querier)
   ├──► Cluster B (Thanos Querier)
   └──► Cluster C (Thanos Querier)

Important caveat: Cross-cluster queries are 5–10x more expensive than single-cluster queries. Airbnb learned this the hard way: a few expensive federated queries could degrade read reliability across multiple clusters.

Isolating Critical vs. Ad-Hoc Reads

Not all reads are equal. Alerting rules that wake engineers up at 3am should never be starved by someone's expensive exploratory dashboard query.

Read traffic split:

┌─────────────────────────────────────────────────┐
│ Evaluation queries (alerts, recording rules)     │
│ Priority: CRITICAL                               │
│ Dedicated query workers                          │
│ Run every 30 seconds, non-negotiable             │
└─────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────┐
│ Ad-hoc queries (Grafana dashboards, CI jobs)     │
│ Priority: NORMAL                                 │
│ Separate worker pool                             │
│ Subject to per-tenant guardrails                 │
└─────────────────────────────────────────────────┘

These two pools never share resources.
A heavy dashboard can't starve your on-call alerts.

Per-Tenant Guardrails

Every tenant has limits that prevent "noisy neighbor" problems:

Write guardrails:
  - Max active time series per tenant
  - Max ingestion rate (samples/sec)
  - Max number of alerting/recording rules

Read guardrails:
  - Max series fetched per query
  - Max data volume per query (e.g., 500MB)
  - Max query time range
  - Evaluation interval limits

Part 6: The Full Architecture

Putting it all together:

┌──────────────────────────────────────────────────────────────────┐
│                    1,000 Services at Airbnb                       │
│   StatsD / OTLP / Prometheus metrics emitted continuously         │
└──────────────────────┬───────────────────────────────────────────┘
                       │
                       ▼
┌──────────────────────────────────────────────────────────────────┐
│                       vmagent fleet                               │
│   - Accepts all 3 metric formats                                  │
│   - Aggregates 500 pods → 1 data point                           │
│   - Normalizes to Prometheus Remote Write                         │
└──────────────────────┬───────────────────────────────────────────┘
                       │  Prometheus Remote Write (HTTP)
                       ▼
┌──────────────────────────────────────────────────────────────────┐
│              Thanos Receivers (Ingesters)                         │
│   - Shuffle sharding routes tenant → subset of nodes             │
│   - Per-tenant TSDB instances (isolation)                        │
│   - WAL on disk (crash safety)                                   │
│   - In-memory head (fast recent queries)                         │
│   - Per-tenant write guardrails enforced here                    │
└──────────┬────────────────────────────────────────────┬──────────┘
           │  every 2 hours                             │
           │  sealed blocks                             │  real-time
           ▼  uploaded                                  │  StoreAPI
┌──────────────────────┐                    ┌───────────▼──────────┐
│    AWS S3             │                   │   Thanos Querier      │
│  (cold storage)       │◄──────────────────│                       │
│  2.5 PB of blocks     │  Store Gateway    │   - Fans out queries  │
│  compressed TSDB      │  reads S3 blocks  │   - Merges hot+cold   │
│  ~$23/TB/month        │  for old queries  │   - Deduplicates      │
└──────────────────────┘                   └───────────┬───────────┘
                                                       │
                                            ┌──────────▼───────────┐
                                            │       Promxy          │
                                            │  Cross-cluster proxy  │
                                            │  Custom Airbnb exts   │
                                            └──────────┬────────────┘
                                                       │
                                            ┌──────────▼───────────┐
                                            │       Grafana         │
                                            │  Dashboards + alerts  │
                                            └───────────────────────┘

Key Engineering Decisions & Why

DecisionAlternative ConsideredWhy They Chose This
Tenant = service, not teamTenant = teamTeams reorganize; services are stable
Shuffle shardingConsistent hashingRandom overlap = smaller blast radius per failure
Multi-clusterSingle large clusterLimits blast radius, enables regional expansion
vmagent for aggregationRecording rules, Veneur, VectorBuilt-in streaming aggregation, small codebase, easy to customize
TSDB + S3 (hot/cold)Single storage tierOrders-of-magnitude cost difference between RAM and object storage
Separate alert vs. ad-hoc query pathsShared query poolCritical alerts must never be starved by dashboard queries

What You Should Take Away

This system is not exotic. It's a set of well-understood principles applied with discipline:

  1. Separate your data by who owns it (multi-tenancy with guardrails). One team's bugs shouldn't take down everyone's observability.

  2. Use the right storage for the right temperature: RAM for the last 2 hours, SSDs for the last day, S3 for everything else.

  3. Exploit domain knowledge in compression: generic gzip doesn't know timestamps are regular. Domain-specific encoding does, and it's 9x better.

  4. Isolate failure domains at every layer: shuffle sharding at ingestion, multi-cluster at the macro level, separate read paths for different priorities.

  5. Build for the boring path, not the happy path: WALs, zone-awareness, and per-tenant limits all exist to make failure survivable, not to make success faster.

The result: a system that ingests 50 million samples per second, stores 2.5 petabytes, and serves real-time dashboards and alerts, built almost entirely on open-source components (Thanos, Prometheus, vmagent, Promxy) with Airbnb's engineering effort focused on the glue, the guardrails, and the operational discipline.


Sources: Airbnb Engineering Blog: Building a fault-tolerant metrics storage system · Airbnb Migration to OpenTelemetry (InfoQ) · Thanos Documentation · Gorilla: Facebook's Time Series Database (2015)