Abstract
A sketch is a probabilistic data structure used to record frequencies of items in a multi-set. Sketches are widely used in various fields, especially those that involve processing and storing data streams. In streaming applications with high data rates, a sketch "fills up" very quickly. Thus, its contents are periodically transferred to the remote collector, which is responsible for answering queries. In this paper, we propose a new sketch, called Slim-Fat (SF) sketch, which has a significantly higher accuracy compared to prior art, a much smaller memory footprint, and at the same time achieves the same speed as the best prior sketch. The key idea behind our proposed SF-sketch is to maintain two separate sketches: a small sketch called Slim-subsketch and a large sketch called Fat-subsketch. The Slim-subsketch is periodically transferred to the remote collector for answering queries quickly and accurately. The Fat-subsketch, however, is not transferred to the remote collector because it is used only to assist the Slim-subsketch during the insertions and deletions and is not used to answer queries. We implemented and extensively evaluated SF-sketch along with several prior sketches and compared them side by side. Our experimental results show that SF-sketch outperforms the most widely used CM-sketch by up to 33.1 times in terms of accuracy.
Introduction
In modern high-speed networking, tracking the frequency of millions of items in real-time is a critical task. Probabilistic data structures known as sketches are preferred for this purpose due to their minimal memory requirements. However, traditional sketches like the Count-Min (CM) sketch face a fundamental "bandwidth-accuracy" dilemma. To maintain high accuracy, a sketch requires a large number of counters to minimize hash collisions. Conversely, in distributed monitoring systems, these sketches must be periodically transmitted from monitoring nodes (e.g., routers) to a central collector. Large sketches consume excessive bandwidth and collector memory, while small sketches suffer from significant over-estimation errors.
The Slim-Fat (SF) Architecture
The SF-sketch addresses this dilemma through a novel two-stage architecture. Instead of a single monolithic sketch, it maintains two distinct components:
- Slim-subsketch: A compact sketch designed for transmission. It is periodically sent to the remote collector and is the sole structure used to answer frequency queries.
- Fat-subsketch: A significantly larger sketch that remains local to the monitoring node. It is never transmitted, leveraging the relatively abundant local DRAM of modern hardware to improve the accuracy of the Slim-subsketch.
Conservative Update Logic
The primary innovation of the SF-sketch lies in its "Smart Update" or conservative update logic. When an item $e$ arrives, the system first updates the Fat-subsketch. Due to its larger size, the Fat-subsketch provides a much more accurate estimate of the item's true frequency.
This accurate estimate is then used to gate updates to the Slim-subsketch. A counter in the Slim-subsketch is only incremented if its current value is less than the estimate provided by the Fat-subsketch. This mechanism prevents the Slim-subsketch from being "polluted" by unnecessary increments caused by hash collisions, effectively filtering out noise before it is transmitted to the collector.
Experimental Evaluation
The SF-sketch was evaluated against state-of-the-art sketches (CM, CU, Count, and CML) using real-world network traffic and synthetic datasets (Uniform and Zipfian distributions).
Key Findings:
- Accuracy: SF-sketch achieved an average relative error up to 33.1 times lower than the standard CM-sketch. In uniform workloads, nearly 75% of items had a relative error of less than 1%.
- Throughput: The architecture maintains high performance. On a GPU, it achieved over 110 million queries per second (Mqps), while a 24-thread CPU reached 16.3 Mqps.
- Scalability: Accuracy gains remained consistent as the number of insertions increased, demonstrating superior convergence properties compared to existing methods.
Conclusion
SF-sketch successfully decouples the memory used for accuracy from the memory used for communication. By utilizing local memory to "clean" the data sent to a central collector, it provides a massive leap in accuracy without sacrificing query speed or increasing bandwidth requirements. This two-stage approach offers a promising template for future probabilistic data structures in resource-constrained distributed environments.
The source code for SF-sketch is available on GitHub.
Summary updated