How we completely rearchitected Mussel, our storage engine for derived data, and lessons learned from the migration from Mussel V1 to V2.
Overview
Airbnb completely rearchitected Mussel, their core key-value store for derived data, migrating from v1 to v2 with a NewSQL backend. The article details why the rearchitecture was needed, the new Kubernetes-native architecture with a stateless Dispatcher and Kafka-based write pipeline, and how they migrated over a petabyte of data across thousands of tables with zero downtime using a blue/green strategy with dual writes and shadow reads.
What You'll Learn
How to design a blue/green migration strategy for a petabyte-scale key-value store with zero downtime
Why replacing static hash partitioning with dynamic range sharding and presplitting improves performance at scale
How to use Kafka as a replication log for dual-write consistency during live database migrations
When to trade off data freshness versus cost by choosing between primary and secondary replicas
How to build a topology-aware TTL expiration service that scales across large data namespaces
Prerequisites & Requirements
- Understanding of distributed systems concepts including consistency models, partitioning, and replication
- Familiarity with key-value store architectures and their read/write patterns
- Knowledge of Kubernetes concepts including StatefulSets, manifests, and automated rollouts
- Understanding of Apache Kafka as a messaging and replication system
- Experience with large-scale data migration or database operations(optional)
Key Questions Answered
How did Airbnb migrate a petabyte of data with zero downtime?
What is Mussel and why did Airbnb rebuild it?
How does Mussel v2's Dispatcher architecture work?
What challenges arise when migrating from eventually consistent to strongly consistent storage?
How does Mussel v2 handle bulk data loading at scale?
What is the role of Kafka in Mussel v2's architecture?
How does Mussel v2 handle data expiration and TTL at scale?
What performance can Mussel v2 achieve simultaneously?
Key Statistics & Figures
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Key Actionable Insights
1Use a blue/green migration strategy with per-table granularity and automatic circuit breakers when migrating critical storage systems. This approach allows you to validate correctness through shadow reads, gradually shift traffic, and instantly revert to the old system if issues arise — all without impacting availability.Airbnb migrated over a petabyte of data across thousands of tables with zero downtime by making every migration step reversible and fine-tunable per table based on risk profile.
2When switching from hash-based to range-based partitioning, presplit target tables based on data sampling to prevent hotspots during ingestion. Inserting large consecutive data into range-based systems can overload specific nodes, so understanding data distribution upfront is critical.Airbnb sampled v1 backup data to create pre-defined shard layouts on v2, ensuring balanced ingestion traffic across backend nodes during migration.
3Persist writes to Kafka before applying them to the backend database to create an event-driven architecture that absorbs traffic bursts, ensures durability, and simplifies operational concerns. This pattern also enables dual-write capabilities during migrations and provides a natural replication mechanism.Kafka's proven stable p99 millisecond latency made it invaluable during migration, serving as the intermediary for write reliability throughout the entire process.
4Design your key-value store's consistency model to be configurable per namespace or use case. Some workloads prioritize data freshness using primary replicas, while others can tolerate staleness by reading from secondary replicas to save cost and improve performance.Mussel v2 gives callers a simple dial to toggle stale reads on a per-namespace basis, allowing teams to optimize for their specific SLA requirements rather than being locked into one consistency level.
5Implement topology-aware data expiration that shards cleanup work into range-based subtasks processed concurrently, rather than relying on storage engine compaction cycles. Schedule these tasks to limit impact on live queries while maintaining data hygiene at scale.V1's compaction-based TTL struggled at scale. V2's parallel expiration service with scheduled subtasks provides the same retention functionality with far greater efficiency and transparency.
6Use Kubernetes StatefulSets for bootstrap and migration workloads that need persistent local state and periodic checkpointing. This allows long-running data migration jobs (hours to days) to survive pod restarts and make incremental progress rather than restarting from scratch.The bootstrap step was the most time-consuming part of the migration pipeline, and StatefulSets with checkpointing were essential for efficiently handling large tables.