heavykeeper-rs
Top-K Heavykeeper algorithm for Top-K elephant flows
This is based on the paper HeavyKeeper: An Accurate Algorithm for Finding Top-k Elephant Flows by Junzhi Gong, Tong Yang, Haowei Zhang, and Hao Li, Peking University; Steve Uhlig, Queen Mary, University of London; Shigang Chen, University of Florida; Lorna Uden, Staffordshire University; Xiaoming Li, Peking University
Example
See examples/basic.rs for a complete example, or examples/ip_files.rs for an example of counting top-k IP flows in a file.
Basic usage:
use TopK;
// create a new TopK with k=10, width=1000, depth=4, decay=0.9
let mut topk: = new;
// add some items
topk.add;
topk.add;
// check the counts
for node in topk.list
Other Implementations
| Name | Language | Github Repo |
|---|---|---|
| SegmentIO | Go | https://github.com/segmentio/topk |
| Aegis | Go | https://github.com/go-kratos/aegis/blob/main/topk/heavykeeper.go |
| Tomasz Kolaj | Go | https://github.com/migotom/heavykeeper |
| HeavyKeeper Paper | C++ | https://github.com/papergitkeeper/heavy-keeper-project |
| Jigsaw-Sketch | C++ | https://github.com/duyang92/jigsaw-sketch-paper/tree/main/CPU/HeavyKeeper |
| Redis Bloom Heavykeeper | C | https://github.com/RedisBloom/RedisBloom/blob/master/src/topk.c |
| Count-Min-Sketch | Rust | https://github.com/alecmocatta/streaming_algorithms |
| Sliding Window HeavyKeeper | Go | https://github.com/keilerkonzept/topk |
Running
Word Count Example
A word count program that demonstrates the HeavyKeeper algorithm can be found at examples/word_count.rs.
Usage
Running the basic example
Running the IPv4 example
Run the benchmarks
Benchmark the sample word count app
Test Data
For information about test data format and how to obtain or generate test data, please see data/README.md.
License
This project is dual licensed under the Apache/MIT license.