Cheetah: Accelerating Database Queries with Switch Pruning

Muhammad Tirmazi, Ran Ben Basat, Jiaqi Gao, Minlan Yu

Abstract

Cheetah is a high-performance query processing system that accelerates distributed databases by offloading data "pruning" to programmable network switches. By filtering out irrelevant data at line rate before it reaches the master server, Cheetah reduces query completion times by 40% to 200% compared to Spark SQL while maintaining 100% correctness.

Introduction

Modern distributed database systems, such as Spark SQL, are increasingly bottlenecked by software processing overhead as network speeds reach 100Gbps and beyond. While hardware accelerators like FPGAs and GPUs have been proposed, they often introduce high costs and integration complexity. Programmable switches (e.g., Barefoot Tofino) offer a compelling alternative due to their terabit-per-second throughput and strategic position in the data path. However, their resource-constrained nature—limited memory and simple arithmetic units—prevents them from running full SQL engines. Cheetah addresses this by introducing the pruning abstraction, where the switch acts as a high-speed filter to discard data that cannot contribute to the final query result.

System Architecture

Cheetah's architecture integrates programmable switches into the distributed query execution pipeline. The switch does not perform full query offloading; instead, it performs the "heavy lifting" of dropping entries guaranteed to be irrelevant.

The Cheetah system architecture, showing the interaction between the query planner, Spark/Cheetah masters and workers, and the programmable switch.

The master server subsequently processes the significantly smaller, "pruned" dataset. To ensure correctness, Cheetah employs "safe" over-forwarding: it is acceptable for the switch to forward some irrelevant rows (which the master will later filter), but it must never drop a valid row. This allows the use of small, "lossy" data structures like Bloom filters in the switch.

Hardware-Friendly Pruning Algorithms

Cheetah implements several specialized algorithms designed for the rigid processing pipelines of programmable switches:

  • DISTINCT: Uses a multi-row LRU cache (a $d \times w$ matrix) to identify and drop previously seen values.
  • TOP N: Filters out values smaller than the current $N$-th largest using threshold-based counters.
  • JOIN: Employs two-pass Bloom filters to prune rows lacking a match in the joining table.
  • SKYLINE: Maps high-dimensional data to scalars via projection, enabling Pareto-curve filtering with simple comparisons.
Illustration of the hardware-friendly DISTINCT algorithm using a multi-row cache to track and prune duplicate entries.

For memory-intensive queries, Cheetah utilizes randomized algorithms with probabilistic guarantees, allowing users to balance memory usage against pruning efficiency. To maintain reliability, a custom protocol on top of UDP distinguishes between legitimately pruned data and actual network packet loss.

Evaluation and Results

The system was evaluated using industry-standard benchmarks, including the Big Data Benchmark and TPC-H (Query 3), alongside large-scale synthetic datasets such as a 31.7 million row uservisits table.

Key findings include:

  • Massive Speedups: Cheetah reduced query completion times by 40% to 200% compared to Spark SQL.
  • High Pruning Efficiency: For TOP N and DISTINCT queries, Cheetah often pruned over 99% of the data using only a few megabytes of switch memory.
  • Scalability: The performance advantage over Spark increases with dataset size. While Spark remains CPU-bottlenecked, Cheetah shifts the bottleneck to the network, allowing performance to scale with hardware upgrades (e.g., moving from 10G to 20G NICs).

Conclusion

Cheetah demonstrates that programmable switches can significantly accelerate database queries through the pruning abstraction. By offloading the initial data filtering to the network fabric, the system overcomes traditional software bottlenecks. Future work includes optimizing packet packing, handling complex aggregates like SUM, and coordinating pruning across multi-switch network topologies.

Summary updated

BibTeX
@inproceedings{tirmazi2020cheetah,
  author = {Muhammad Tirmazi and Ran Ben Basat and Jiaqi Gao and Minlan Yu},
  title = {{Cheetah: Accelerating Database Queries with Switch Pruning}},
  booktitle = {SIGMOD},
  year = {2020},
  url = {https://openreview.net/forum?id=XHA84YHFPi},
}
Figure