#Backend

Dynamically Splitting Wide Partitions in Cassandra for Time Series Workloads

Dynamically Splitting Wide Partitions in Cassandra for Time Series Workloads
01

Summary

From Seconds to Milliseconds: How Netflix Tames Cassandra Wide Partitions

Inside the dynamic partitioning strategy that solved data skew and tail latency in Netflix's massive TimeSeries datasets.

This article explores how Netflix tackled the bottleneck of wide partitions in Cassandra within their petabyte-scale TimeSeries data layer. It details the journey from manual infrastructure scaling to building a self-healing, dynamic partitioning architecture that adapts to shifting workloads.

  • 01Real-time partition histogram monitoring using Cassandra virtual tables and background workers
  • 02Asynchronous detection pipeline that triggers split events via Kafka during the read path
  • 03Transparent query re-routing using high-performance in-memory Bloom filters to minimize overhead
  • 04Rigid data integrity checks using pre/post-split checksums and offline Spark verification jobs
  • 05Phased rollout strategy with shadow mode to build confidence before full production traffic cutover

RECOMMENDATION

Essential reading for backend and data engineers dealing with database skew or partition management in Cassandra. It provides a blueprint for abstracting complex storage optimizations without disrupting application-level logic.

The Problem

Netflix's TimeSeries abstraction layer experienced performance degradation where 'wide partitions' caused by data skew led to read latencies spiking into seconds and causing system instability.

The Solution

The team implemented a two-pronged approach: table-level re-partitioning for future time slices and an asynchronous 'Dynamic Partitioning per ID' pipeline that detects, splits, and reroutes reads via in-memory Bloom filters.

The Result

Average read latency for oversized partitions dropped from seconds to low double-digit milliseconds, significantly reducing thread queuing and read timeouts across the clusters.

Trade-off

The solution requires additional storage space because original partitions are retained as a fallback, and it introduces higher architectural complexity due to the asynchronous split logic and metadata management.

03

Key Concepts

Concept · 01

Wide Partitions

A condition in Cassandra where a single partition contains an excessive number of rows, causing read/write performance to degrade.

  • Identified as the root cause for multi-second tail latencies and GC pauses in Netflix's high-throughput clusters.
Concept · 02

Bloom Filter

A space-efficient probabilistic data structure used to rapidly test whether an element is a member of a set.

  • Used to store keys of split partitions in-memory, allowing servers to check if a read needs redirection in microseconds.
Concept · 03

Monte Carlo Simulation

A mathematical technique used to estimate the possible outcomes of an uncertain event by running multiple random trials.

  • Integrated into the Netflix provisioning pipeline to produce optimal infrastructure configurations based on anticipated workload inputs.