Sampling Space-Saving Set Sketches

Homin K. Lee, Charles MassonarXiv 2024 · DOI

Abstract

Identifying "heavy distinct hitters"—labels associated with the largest number of unique items—is a critical task for monitoring massive, distributed data streams. This paper introduces the Sampling Space-Saving Set Sketch (SSSS), a novel algorithm that combines sketching and sampling techniques to provide high accuracy and fast query speeds. Unlike previous methods, SSSS is fully mergeable, memory-efficient, and maintains an invertible structure suitable for real-time reporting in distributed environments.

The Heavy Distinct Hitters Problem

In modern distributed systems, tracking simple "heavy hitters" (e.g., which IP sends the most packets) is insufficient for complex monitoring. Instead, operators often need to solve the heavy distinct hitters problem: identifying which labels (such as IP addresses or microservices) are associated with the highest number of unique items (such as destination IPs or user IDs). This capability is essential for DDoS detection, ad campaign monitoring, and infrastructure observability.

As illustrated in Figure 1, data in cloud-native environments is typically distributed across numerous independent workers or pods. To be effective in such a setting, a monitoring sketch must satisfy four primary requirements:

  1. Constant Memory: The sketch size must remain independent of the total data volume.
  2. Mergeability: Sketches from disparate nodes must be combinable without significant loss of accuracy.
  3. Invertibility: The algorithm must be able to report the heavy labels themselves, not just their existence.
  4. Accuracy and Throughput: It must handle high-velocity streams with minimal error and low latency.
A distributed architecture where monitoring agents send metrics to a central system.

The SSSS Algorithm

SSSS builds upon the classic Space-Saving algorithm, evolving it to handle distinct counts through three primary innovations:

  • Space-Saving Sets (SSS): Each entry in the sketch replaces a simple counter with a HyperLogLog (HLL) sketch. This allows the system to track unique item cardinalities rather than raw event counts.
  • Recycling: To mitigate over-counting when a new label displaces an old one, SSSS reuses the existing count-distinct structure rather than resetting it, preserving a more accurate baseline for the new entry.
  • Input Sampling (The "Secret Sauce"): To prevent "churn" caused by a high volume of small, insignificant sets, the authors implement a hash-based sampling gatekeeper. A new (label, item) pair is only admitted to the sketch if its probabilistic importance exceeds the current minimum cardinality in the sketch. This ensures that only sets with a high likelihood of being "heavy" can displace existing entries.

Performance and Accuracy

The authors evaluated SSSS against state-of-the-art competitors, including SpreadSketch and Count-HLL, using diverse real-world datasets such as CAIDA network traffic and KASANDR ad impressions.

SSSS consistently demonstrated superior performance across all key metrics. In terms of accuracy, SSSS achieved a Normalized Absolute Error (NAE) between 0.02 and 0.04 on difficult datasets, while rival methods often produced errors 10 to 100 times higher. Furthermore, SSSS proved to be significantly more memory-efficient, providing higher accuracy while utilizing 4-5x less memory than its competitors (see Figure 3).

Comparison of SSSS against Count-HLL and SpreadSketch showing superior accuracy and memory efficiency.

Beyond accuracy, SSSS offers a significant speed advantage. Because it maintains an explicit "top-K" list of heavy hitters, reporting results is nearly instantaneous, whereas non-invertible sketches require exhaustive querying to identify heavy labels.

Conclusion and Future Work

SSSS represents a significant advancement in distributed stream monitoring, offering a mergeable and invertible solution for the heavy distinct hitters problem. While current mathematical bounds focus on worst-case scenarios, future research may tighten these bounds for realistic data distributions. Additionally, extending the sampling logic to support "bounded-deletions" remains a promising path for adapting SSSS to more dynamic data environments.

Summary updated

BibTeX
@misc{lee2024sampling,
  author = {Homin K. Lee and Charles Masson},
  title = {{Sampling Space-Saving Set Sketches}},
  year = {2024},
  eprint = {2402.08604},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2402.08604},
}
Figure