How Uber ensures Apache Cassandra®’s tolerance for single-zone failure

Long Pan, Gopal Mor, Jaydeepkumar Chovatia, Shriniket Kale, Gabriele Di Bernardo
12 min readadvanced
--
View Original

Overview

This article discusses how Uber has implemented single-zone failure tolerance (SZFT) for its Apache Cassandra® database, ensuring high availability even in the event of a zone failure. It details the challenges faced during this transition and the strategies employed to achieve a robust and resilient Cassandra deployment.

What You'll Learn

1

How to implement single-zone failure tolerance in Apache Cassandra

2

Why proper rack configuration is crucial for data availability

3

How to manage live and historical data synchronization during a cluster migration

4

When to apply automated traffic switching in database operations

Prerequisites & Requirements

  • Understanding of Apache Cassandra architecture and replication strategies
  • Familiarity with Cassandra management tools like nodetool(optional)

Key Questions Answered

How does Uber ensure Apache Cassandra's availability during a single zone failure?
Uber achieves availability during a single zone failure by implementing a single-zone failure tolerance (SZFT) strategy, which involves distributing data replicas evenly across multiple zones. This ensures that even if one zone fails, sufficient replicas remain accessible in other zones to maintain service continuity.
What challenges did Uber face when transitioning to a multi-rack setup?
The transition to a multi-rack setup posed challenges such as the impracticality of in-place transitions due to hotspot issues and the need for careful planning to ensure all replicas are distributed correctly across zones. Uber addressed these challenges by creating new Cassandra rings and implementing a phased migration strategy.
What is the rebuild procedure for achieving single-zone failure tolerance?
The rebuild procedure involves several phases: provisioning new multi-rack nodes, syncing live and historical data, switching traffic to the new nodes, and finally decommissioning the old nodes. This structured approach ensures zero downtime and maintains data integrity throughout the migration.
Why was the old Cassandra setup at Uber not SZFT?
The old setup was not SZFT because all nodes were assigned the same default rack value, which led to replicas being placed in the same zone. This configuration risked data unavailability during a zone failure, prompting the need for a more robust multi-rack strategy.

Key Statistics & Figures

Replication factor
3
This replication factor ensures that data is available across multiple zones, allowing for single-zone failure tolerance.
Duration of rollout
months
The rollout was completed on the vast majority of the Cassandra fleet over several months without major incidents.

Technologies & Tools

Database
Apache Cassandra®
Used as the primary database service for Uber's OLTP workloads.

Key Actionable Insights

1
Implement a multi-rack setup for your Cassandra deployment to enhance availability.
By ensuring that replicas are distributed across different racks or zones, you can mitigate the risk of data loss during zone failures. This is particularly crucial for applications requiring high availability.
2
Utilize the nodetool rebuild command for data synchronization during migrations.
This command allows you to stream historical data from old nodes to new ones, ensuring that all data is replicated correctly without downtime. It's essential for maintaining data integrity during transitions.
3
Automate traffic switching between Cassandra rings to minimize client-side changes.
By enhancing your Cassandra clients to handle traffic switching dynamically, you can reduce the operational overhead and improve the user experience during migrations.

Common Pitfalls

1
Failing to properly configure rack awareness can lead to data unavailability during zone failures.
If all replicas are placed in the same zone, a failure in that zone can result in data loss. It's crucial to configure the rack properties correctly to ensure replicas are distributed across multiple zones.

Related Concepts

Cassandra Replication Strategies
Database Migration Techniques
High Availability In Distributed Systems