SQUID: Faster Analytics via Sampled Quantile Estimation

Ran Ben Basat, Gil Einziger, Wenchen Han, Bilal Tayh

TL;DR

This paper introduces SQUID, a novel sampling-based approach for quantile estimation that significantly speeds up analytics tasks like finding the top-k elements in data streams. By using approximate quantiles instead of exact ones, SQUID achieves substantial performance gains, enabling efficient in-network caching and faster heavy-hitter detection.

What Problem Does This Paper Address?

Many data analytics tasks, especially those dealing with massive, high-speed data streams, rely on efficiently finding the "largest" or "most frequent" elements. A core sub-problem is quantile estimation, which is crucial for algorithms like q-MAX (finding the top-q values) and heavy-hitter detection. Existing methods for these tasks, while effective, often suffer from computationally expensive quantile calculations, creating a bottleneck. This is particularly problematic in hardware-based systems like network switches, where computational resources are limited, and even slight delays can significantly impact performance. The paper aims to bridge this gap by developing a faster and more practical quantile estimation technique.

Methods

The core innovation is SQUID (Sampled Quantile Estimation), a quantile-sampling approach. Instead of calculating an exact quantile, SQUID finds an approximate quantile by sampling a subset of the data. This dramatically reduces the computational cost.

Key techniques include:

  • Approximate Quantile Calculation: SQUID uses a randomized approach to find a "good enough" quantile, which is much faster than deterministic exact quantile methods. This is framed as a Las Vegas algorithm, guaranteeing correctness but with probabilistic runtime.
  • SQUID-HH (SQUID for Heavy Hitters): This component leverages SQUID for weighted heavy-hitter detection. It uses a Cuckoo hash table and a "water level" technique for implicit deletion of less frequent items, avoiding costly linear scans.
  • SQUID-LRFU (SQUID for Caching): This demonstrates SQUID's application in network-assisted caching. It enables score-based caching policies (like LRFU) to be implemented directly in hardware switches, offloading computation from slower backend servers.
  • Deamortization: The paper also discusses techniques to ensure that maintenance operations (required when the data structure fills up) occur with a bounded frequency, leading to O(1) amortized time per update.
  • AVX Vectorization: For software implementations, the authors utilize AVX instructions to further accelerate computations.

Datasets

The paper evaluates its methods on a variety of real-world and synthetic datasets:

  • Network Traces: CAIDA Anonymized Internet Traces (Caida16, Caida18), Data center network trace (Univ1).
  • Memory Access Traces: Windows server memory accesses (P1), Finance application memory accesses (F1), E-commerce memory accesses (Scarab Research), OLTP server memory accesses (OLTP), Caching applications (MergeP, S2).
  • Web Search Data: Queries from a web search engine (WS1).
  • Synthetic Datasets: Zipf distributions with varying parameters (0.9, 0.95, 0.99).

The paper also mentions the use of standard benchmarks for evaluating network applications.

Key Insights and Ideas

  • Approximate is Often Good Enough: The most significant insight is that for many streaming analytics tasks, an approximate quantile is sufficient to achieve high performance and accuracy, eliminating the need for expensive exact calculations.
  • Hardware Acceleration for Caching: SQUID unlocks the potential for sophisticated caching policies (like LRFU) to be implemented directly on programmable network switches (P4). This drastically reduces latency and backend load compared to traditional approaches.
  • Implicit Deletion for Efficiency: The "water level" technique in SQUID-HH allows for logical deletion of items, avoiding linear scans and improving both speed and accuracy in heavy-hitter detection.
  • Trade-offs are Quantifiable: The paper provides theoretical analysis and experimental evidence showing the trade-offs between accuracy, space, and speed, allowing for informed parameter tuning.

Key Results

  • Speedup: SQUID is up to 6.6x faster than the state-of-the-art q-MAX algorithm on real workloads. For network-wide heavy hitters, SQUID achieved up to 58% speedup.
  • Accuracy: SQUID-HH is more accurate than existing heavy-hitter algorithms like SMED, SMED-random, and ElasticSketch. In P4-based caching, SQUID achieves up to 16% higher hit ratios compared to P4LRU.
  • Quantile Estimation Error: SQUID achieves approximately one order of magnitude lower quantile estimation error than PPD in P4 switches.
  • Hardware Performance: The P4 implementation of SQUID for caching demonstrates competitive performance with low control traffic overheads, especially as array sizes increase.

Limitations and Future Work

  • Probabilistic Nature: SQUID is a Las Vegas algorithm, meaning its runtime is probabilistic. While the probability of failure is low and can be managed, it's not deterministic.
  • Parameter Tuning: While theoretical guidance is provided, optimal parameter tuning (like 'a' and 'y') can still require experimental evaluation.
  • P4 Limitations: Implementing complex algorithms like SQUID on P4 switches presents challenges due to the limited computational capabilities of the P4 data plane. The paper proposes workarounds, but these are still constrained.
  • Future Work: The authors suggest exploring further optimizations for P4 implementation, investigating more complex caching policies, and applying SQUID to other streaming analytics problems. The open-source code is provided for reproducibility and further research.

Summary updated

Abstract

Streaming algorithms are fundamental in the analysis of large and online datasets. A key component of many such analytic tasks is $q$-MAX, which finds the largest $q$ values in a number stream. Modern approaches attain a constant runtime by removing small items in bulk and retaining the largest $q$ items at all times. Yet, these approaches are bottlenecked by an expensive quantile calculation. This work introduces a quantile-sampling approach called SQUID and shows its benefits in multiple analytic tasks. Using this approach, we design a novel weighted heavy hitters data structure that is faster and more accurate than the existing alternatives. We also show SQUID's practicality for improving network-assisted caching systems with a hardware-based cache prototype that uses SQUID to implement the cache policy. The challenge here is that the switch's dataplane does not allow the general computation required to implement many cache policies, while its CPU is orders of magnitude slower. We overcome this issue by passing just SQUID's samples to the CPU, thus bridging this gap. In software implementations, we show that our method is up to 6.6x faster than the state-of-the-art alternatives when using real workloads. For switch-based caching, SQUID enables a wide spectrum of data-plane-based caching policies and achieves higher hit ratios than the state-of-the-art P4LRU.
BibTeX
@article{basat2024squid,
  author = {Ran Ben Basat and Gil Einziger and Wenchen Han and Bilal Tayh},
  title = {{SQUID: Faster Analytics via Sampled Quantile Estimation}},
  journal = {Proc. ACM Netw.},
  year = {2024},
  doi = {10.1145/3676873},
}
Figure