ByteByteGo 01月08日
How Airbnb Built a Key-Value Store for Petabytes of Data
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

文章介绍了Airbnb数据存储的发展,包括衍生数据的重要性、面临的挑战,以及Mussel等解决方案的架构和特点。

🎯衍生数据由Spark等处理,对Airbnb服务至关重要

🚧访问数据面临可靠性、可用性等挑战,Mussel应运而生

📂HFileService曾是解决方案,但存在诸多限制

🌟Nebula改进了HFileService,也有一些不足

💻Mussel架构具有多种特性,解决了前序方案的问题

Disclaimer: The details in this post have been derived from the Airbnb Technical Blog. All credit for the technical details goes to the Airbnb engineering team. The links to the original articles are present in the references section at the end of the post. We’ve attempted to analyze the details and provide our input about them. If you find any inaccuracies or omissions, please leave a comment, and we will do our best to fix them.

Airbnb's services rely on more than just raw data. They also depend on derived data.

But what is derived data?

It is information computed from massive offline datasets processed by tools like Spark or real-time event streams from systems like Kafka. This derived data is crucial for enabling personalized features, such as tailoring a user’s experience based on activity history and other similar features.

See the diagram below that shows the role of derived data in Airbnb’s overall service architecture.

However, accessing this data efficiently poses unique challenges.

This is where Mussel comes in. 

Built to meet these stringent requirements, it’s a key-value store designed to ensure Airbnb’s services can retrieve the right data at the right time.

In this article, we’ll understand the architecture of Mussel and learn how Airbnb built this key-value store to manage petabytes of data.

Evolution of Derived Data Storage at Airbnb

Mussel wasn’t the first solution that Airbnb used to store derived data. Before the brand-new key-value store became a reality, there were other solutions implemented by the Airbnb engineering team. 

Let’s go through the main stages of this evolution:

Stage 1: Unified Read-Only Key-Value Store

During the early stages of Airbnb's journey to handle derived data effectively, they faced several technical challenges. Existing tools like MySQL, HBase, and RocksDB couldn't meet the demanding requirements such as:

To address these needs, Airbnb created HFileService in 2015. It was a custom solution built using HFile, which is a building block for HBase and based on Google’s SSTable. 

See the diagram below for the architecture of HFileService:

Here's how it worked:

While HFileService solved many problems, it had significant limitations:

Stage 2: Real-Time and Derived Data Store (Nebula)

In the second stage of evolution, Airbnb introduced Nebula, a system designed to bridge the gap between batch-processed data and the growing need for real-time data access. 

See the diagram below to understand the architecture of Nebula.

Nebula brought several important enhancements to improve upon the limitations of its predecessor, HFileService.

Despite the advantages, Nebula also had some limitations such as:

Mussel Architecture

In 2018 the Airbnb engineering team built a new key-value store called Mussel. 

​​The architecture of Mussel was designed to address the scalability and performance limitations of previous solutions.

See the diagram below that shows the architecture of Mussel:

Let’s look at each feature of Mussel’s architecture in more detail:

Partition Management with Apache Helix

Mussel increased the number of shards (data partitions) from 8 to 1024 to support Airbnb’s expanding data needs. These shards are smaller subsets of data distributed across multiple servers, ensuring that no single server is overwhelmed by too much data.

The data was partitioned into those shards by the hash of the primary keys. They used Apache Helix to automate the management of these shards. It determined which physical servers stored each shard and balanced the load dynamically.

This removed the need for manual intervention, making the system more efficient and scalable.

Leaderless Replication with Kafka

Mussel used Kafka as a write-ahead log for every write operation. 

Kafka divided the log into 1024 partitions, aligning with the shard structure in Mussel so that each shard’s data was processed in order. This ensured that all updates were recorded and replicated consistently.

Mussel also followed a leaderless replication approach. 

Unlike systems with a designated “leader” node for each shard, Mussel allowed any node holding a shard replica to handle read requests. Write operations, however, synchronized across nodes using Kafka logs to maintain consistency.

This design smoothed out spikes in write traffic and prioritized high availability for read-heavy workloads common at Airbnb. The data was eventually consistent, but it was acceptable for the derived data use cases.

Unified Storage Engine with HRegion

Mussel replaced DynamoDB, simplifying the architecture by extending HFileService to handle real-time and batch data in a unified system.

Instead of HFile, Mussel used HRegion, a component of HBase, as its key-value storage engine. This was because HRegion offered:

In HRegion, each client table was mapped to a column family. This grouped related data logically and helped Mussel support advanced queries such as:

Over time, HRegion created multiple small files from writes and deleted or expired data. To optimize performance, these files needed to be merged using a process called compaction.

Mussel divided its nodes into:

Helix managed scheduled rotations between these node types, ensuring the system maintained high read availability and efficient compaction.

Bulk Load Support

They supported two types of bulk load pipelines from the data warehouse to Mussel via Airflow jobs:

Mussel used Spark to process data from Airbnb’s data warehouse, converting it into HFile format. These files were uploaded to S3 (cloud storage), where each Mussel storage node downloaded and loaded them into HRegion using the bulk loading API.

Instead of reloading the entire dataset daily, Mussel loaded only the incremental changes (delta data). This reduced the daily data load from 4TB to just 40–80GB, significantly improving efficiency and reducing operational costs.

Adoption and Performance of Mussel

Mussel has become a core component of Airbnb’s data infrastructure, supporting a wide range of services that rely on key-value storage. It serves as the backbone for applications requiring reliable, low-latency access to derived data.

Some performance metrics regarding Mussel are as follows:

Conclusion

Mussel demonstrates the evolution of a robust key-value store, addressing critical challenges like scalability, low latency, and operational complexity. 

Its impressive metrics and widespread adoption within Airbnb demonstrate how it has become a critical enabler for high-performance data-driven services. 

Mussel serves Airbnb’s current use case quite well. However, the Airbnb engineering team is also committed to enhancing Mussel to support use cases such as read-after-write consistency, auto-scaling, and traffic-based repartitioning.

References:


SPONSOR US

Get your product in front of more than 1,000,000 tech professionals.

Our newsletter puts your products and services directly in front of an audience that matters - hundreds of thousands of engineering leaders and senior engineers - who have influence over significant tech decisions and big purchases.

Space Fills Up Fast - Reserve Today

Ad spots typically sell out about 4 weeks in advance. To ensure your ad reaches this influential audience, reserve your space now by emailing sponsorship@bytebytego.com.
















Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Airbnb 数据存储 Mussel 衍生数据
相关文章