The power of both choices: Practical load balancing for distributed stream processing engines

Muhammad Anis Uddin Nasir, Gianmarco De Francisci Morales, David García-Soriano, Nicolas Kourtellis, Marco Serafini

TL;DR

This paper introduces Partial Key Grouping (PKG), a novel load balancing technique for distributed stream processing engines (DSPEs) that tackles the challenge of skewed data distributions. By combining the "power of two choices" with a new "key splitting" approach and local load estimation, PKG significantly reduces load imbalance, leading to improved throughput and reduced latency in real-world deployments.

What Problem Does This Paper Address?

Distributed stream processing engines (DSPEs) are crucial for handling massive, real-time data streams. A common requirement in these systems is to maintain state across the stream, which typically involves grouping data by a common key. This "key grouping" is often implemented using hashing, but it suffers from a significant problem: load imbalance. When certain keys appear much more frequently than others (a skewed distribution), the processing elements (PEs) responsible for those keys become overloaded, while others remain idle. This leads to inefficient resource utilization and poor performance.

Existing solutions like "shuffle grouping" (round-robin distribution) offer better load balancing but are unsuitable for stateful computations. Other approaches like operator migration are complex to implement and maintain in distributed systems. This paper addresses the need for a practical, scalable, and effective load balancing solution for stateful DSPEs that can handle skewed data distributions.

Methods

The paper proposes Partial Key Grouping (PKG), a novel stream partitioning scheme built upon two core techniques:

  • Key Splitting: This technique relaxes the strict "one key, one PE" rule of traditional key grouping. Instead of mapping a key to a single processing element instance (PEI), PKG maps each key to two candidate PEIs. This allows the system to leverage the "power of two choices" (POTC) principle.
  • Local Load Estimation: To implement POTC in a distributed setting without expensive global coordination, PKG uses a decentralized approach. Each source PE independently estimates the load of downstream PEIs based on the messages it has sent. This local estimation proves surprisingly effective in achieving global load balance.

By combining these, PKG allows sources to dynamically choose the least loaded PE for each message from two candidates, adapting to changing data distributions and avoiding the need for centralized state or complex rebalancing routines.

Datasets

The authors evaluated PKG using a combination of real-world and synthetic datasets:

  • Real-world Datasets:
    • Wikipedia (WP): Page visit logs from January 2008.
  • Twitter (TW): Sampled tweets from July 2012, with keys derived from words within tweets.
  • Cashtags (CT): A Twitter dataset with keys derived from cashtags, used to study shifts in key popularity.
  • Synthetic Datasets:
    • LN1, LN2: Datasets generated using a log-normal distribution, commonly used to model skewed data.
  • Graph Datasets:
    • LiveJournal (LJ), Slashdot0811 (SL1), Slashdot0902 (SL2): Datasets representing directed graphs, used to test robustness to skewed input partitioning at the sources.

Key Insights and Ideas

  • "Power of Two Choices" is not enough: While POTC theoretically improves load balancing, a naive application to key grouping (static POTC) requires impractical state management. PKG's key splitting is crucial for making POTC practical in DSPEs.
  • Local is Good Enough: The paper demonstrates that decentralized, local load estimation by each source is sufficient to achieve near-optimal global load balancing, avoiding the overhead of global coordination.
  • Key Splitting is the Game Changer: The combination of POTC with key splitting, rather than just POTC alone, is what enables PKG to achieve significantly better load balancing than traditional key grouping.
  • PKG bridges the gap: PKG offers a sweet spot between strict key grouping (good for stateful, but imbalanced) and shuffle grouping (good balance, but bad for stateful). It provides good balance while still supporting stateful computations.
  • Skewed sources don't break PKG: The technique is robust even when the input stream is unevenly distributed among the sources themselves.

Key Results

  • Reduced Load Imbalance: PKG reduces load imbalance by up to several orders of magnitude compared to standard hashing (key grouping).
  • Improved Throughput and Latency: In a real Storm cluster deployment, PKG achieved up to a 60% improvement in throughput and up to a 45% reduction in latency for an example application (streaming top-k word count).
  • Memory Efficiency: Compared to shuffle grouping, PKG requires significantly less memory (approximately half) for stateful applications.
  • Robustness: PKG performs well across various datasets with different skew levels and is robust to skewed input partitioning at the sources.
  • Local Estimation Effectiveness: PKG with local load estimation performed nearly as well as the global oracle variant, demonstrating the practicality of the decentralized approach.

Limitations and Future Work

  • Applicability: PKG is best suited for associative functions and monoids, similar to what can be expressed with combiners in MapReduce. Functions like computing the median are not easily expressed with PKG.
  • Atomicity: The paper acknowledges that PKG does not strictly maintain the atomicity of processing for a given key (as it's split across two PEs). The question of whether good load balance can be achieved without sacrificing this atomicity is posed as a future research direction.
  • Rebalancing: While PKG avoids complex rebalancing, the paper notes that rebalancing is a common technique in other systems and its practicality in DSPEs remains an open question.
  • Further Research: The authors suggest exploring the necessary conditions for achieving good load balance and investigating other potential primitives for DSPEs that could effectively express algorithms while ensuring efficiency.

Summary updated

BibTeX
@inproceedings{nasir2015power,
  author = {Muhammad Anis Uddin Nasir and Gianmarco De Francisci Morales and David García-Soriano and Nicolas Kourtellis and Marco Serafini},
  title = {{The power of both choices: Practical load balancing for distributed stream processing engines}},
  booktitle = {ICDE},
  year = {2015},
  url = {https://openreview.net/forum?id=nr8PxIS3whW},
}
Figure