Parallel Stream Processing Against Workload Skewness and Variance

Junhua Fang, Rong Zhang, Tom Z. J. Fu, Zhenjie Zhang, Aoying Zhou, Junhua Zhu

TL;DR

This paper introduces a hybrid workload partitioning framework for distributed stream processing that combines standard hashing with a small, dynamic routing table. By explicitly rerouting only a handful of "hot" keys while letting hashing handle the rest, the system can rapidly rebalance itself during sudden data spikes with minimal memory and migration overhead.

What Problem Does This Paper Address?

In the world of big data, stream processing engines (like Apache Storm or Spark Streaming) need to distribute incoming data across many worker threads. The standard way to do this is key-based partitioning: all data with the same ID (key) goes to the same worker. Usually, a simple hash function handles this distribution.

However, real-world data is rarely uniform. You often encounter workload skewness (a few "hot" keys, like a viral hashtag, represent the bulk of the traffic) and workload variance (which keys are "hot" changes over time). When this happens, one worker gets slammed while others sit idle, creating a bottleneck that slows down the entire pipeline. Existing solutions are often too slow to react to short-term fluctuations or too "heavyweight," requiring massive data migrations that can be more expensive than the imbalance itself.

Methods

The authors propose a Mixed Routing Strategy. Instead of choosing between rigid hashing or a massive, slow-to-update routing table, they use both:

  • Implicit Routing: A standard hash function handles the vast majority of keys.
  • Explicit Routing: A small, optimized routing table overrides the hash function for a select few keys that are causing imbalances.

To manage this, they developed the Mixed Algorithm, which solves a multi-objective optimization problem: balancing the load, keeping the routing table small, and minimizing the cost of moving "state" (historical data) between workers.

Key technical innovations include:

  • LLFD (Least-Load Fit Decreasing): A specialized heuristic that sorts "heavy" keys and assigns them to the least-loaded workers. It includes a clever "Adjust" function to ensure that moving a hot key doesn't just create a new bottleneck elsewhere.
  • Compact Representation: To handle millions of unique keys without slowing down, the system groups keys into 6-dimensional vectors based on their characteristics (e.g., current worker, hash worker, CPU cost, memory cost).
  • Value Discretization: They use a "half-linear-half-exponential" (HLHE) method to simplify the range of CPU and memory costs, allowing the controller to make decisions in milliseconds rather than seconds.
The overall workflow of the rebalance control component.

Datasets

The researchers evaluated their system on the Apache Storm platform using four distinct workloads:

  1. Synthetic Data: Generated Zipf distributions where they could precisely control skewness and the rate of change.
  2. Social Data: A 5-day feed from a microblogging service (5 million tuples, 180,000 keys) used for word count tasks.
  3. Stock Data: 3-day stock exchange records (6 million tuples) used for complex "self-join" operations.
  4. TPC-H: A revised version of the standard industry benchmark Query 5, adapted for continuous streaming.

Key Insights and Ideas

  • The 80/20 Rule for Routing: You don't need to manage every key to achieve balance. Explicitly routing just the top "problematic" keys provides nearly optimal load balancing with negligible memory overhead.
  • Migration vs. Computation Trade-off: For stateful tasks like joins, moving a key is expensive because you have to move its history. The "Mixed" algorithm intelligently prioritizes moving keys that have a high computational load but a small memory footprint.
  • Heuristics over Brute Force: The authors proved that while the optimization problem is NP-hard, their LLFD heuristic produces results that are theoretically guaranteed to be within a tight bound of the absolute best possible balance.
  • Handling "Re-overloading": A common pitfall in load balancing is moving a giant task to a small worker, only to have that worker become the new bottleneck. The "Adjust" phase in their algorithm proactively prevents this "ping-pong" effect.
A running example of how the algorithm moves keys to achieve balance.

Key Results

  • Throughput Boost: The "Mixed" algorithm achieved up to 2x higher throughput compared to standard Storm hashing and existing state-of-the-art methods like Readj.
  • Lower Latency: By eliminating bottlenecks, the system significantly reduced the average time it took to process individual data tuples.
  • Rapid Response: In "scale-out" tests (adding new workers to a running system), the Mixed algorithm rebalanced the workload in seconds, whereas the baseline Readj took over 5 minutes—a lifetime in high-speed streaming.
  • Scalability: Thanks to the compact representation, the controller could generate new migration plans for millions of keys in under a second.

Limitations and Future Work

While highly effective, the authors note that their current heuristics, though robust, could be further refined to understand their optimality under even more general assumptions. Additionally, they aim to bridge the gap between their lightweight routing approach (for short-term spikes) and heavyweight resource scaling (for long-term growth) to create a truly "all-weather" load balancer for the cloud.

Summary updated

BibTeX
@inproceedings{fang2017parallel,
  author = {Junhua Fang and Rong Zhang and Tom Z. J. Fu and Zhenjie Zhang and Aoying Zhou and Junhua Zhu},
  title = {{Parallel Stream Processing Against Workload Skewness and Variance}},
  booktitle = {HPDC},
  year = {2017},
  doi = {10.1145/3078597.3078613},
}
Figure