Cora: Accelerating Stateful Network Applications with SmartNICs

Shaoke Xi, Jiaqi Gao, Mengqi Liu, Jiamin Cao, Fuliang Li, Kai Bu, Kui Ren, Minlan Yu, Dennis Cai, Ennan ZhaiarXiv 2024 · DOI

Abstract

Offloading stateful network applications to SmartNICs is challenging due to hardware complexity, limited memory, and dynamic traffic patterns. Cora is a novel compiler and runtime system that treats application state as a first-class citizen. By leveraging a sophisticated performance model and a reactive runtime, Cora optimizes state partitioning between SmartNICs and host CPUs. Experimental results demonstrate that Cora can save up to 94% of host CPU cores while improving network function throughput by up to 82% compared to traditional offloading methods.

Introduction

Modern data centers face immense traffic volumes, pushing traditional CPUs to their limits. While SmartNICs offer a promising offloading target, stateful applications—such as load balancers and firewalls—present significant hurdles. These applications require maintaining state across packets, which is difficult to manage given the limited high-speed memory and processing constraints of SmartNIC hardware. Existing "all-or-nothing" offloading strategies often fail to handle dynamic traffic bursts or complex state operations effectively, leading to suboptimal performance or wasted resources.

Cora System Architecture

Cora addresses these challenges through a "state-first" approach to partitioning. The system consists of a compiler and a runtime component designed to work in tandem.

The Cora system architecture, featuring a performance-aware compiler and a reactive runtime.

The Cora Compiler utilizes a frontend to identify "state blocks" in P4 programs. A key innovation is the Roofline Performance Model, which accurately predicts SmartNIC throughput by accounting for memory tiers, operation types, and lock contention. The compiler uses heuristic algorithms to determine the optimal placement of state blocks based on traffic volume and computational efficiency.

Complementing the compiler, the Cora Runtime monitors the system's health using per-core idle time as a hardware-level indicator of load. This allows the system to dynamically migrate "elephant flows" between the NIC and the CPU in response to real-time traffic fluctuations, ensuring stability during bursts.

State-First and Fine-Grained Partitioning

Unlike traditional offloaders that focus primarily on code instructions, Cora prioritizes how traffic interacts with memory. This perspective allows for fine-grained partitioning, where a single state table can be split across the NIC and CPU.

Cora's fine-grained partitioning strategies across different hardware and traffic scenarios.

By analyzing flow distributions, Cora can keep high-volume traffic on the NIC while offloading the "long tail" of infrequent flows to the CPU. This hybrid approach maximizes the utility of the NIC's limited resources. Furthermore, the system is hardware-agnostic, adapting its partitioning strategy to the specific characteristics of different SmartNIC architectures, such as the Netronome Agilio or NVIDIA BlueField-2.

Evaluation and Key Results

The researchers evaluated Cora using real-world Facebook network traces and synthetic Memcached traffic. Microbenchmarks were conducted across hundreds of scenarios to validate the performance model.

Key findings include:

  • Resource Efficiency: Cora achieved up to 94% CPU core savings for target throughputs, outperforming baseline solutions by nearly 2x.
  • Throughput Gains: Network functions like DPVS load balancing saw throughput improvements between 44.9% and 82.3% under identical resource constraints.
  • Model Precision: The Roofline performance model demonstrated high accuracy, with an average relative error of less than 10%.
  • Dynamic Agility: The reactive runtime successfully managed tens of thousands of flow migrations within seconds, preventing packet drops during sudden traffic spikes.

Conclusion and Future Work

Cora effectively mitigates the "stateful headache" of SmartNIC offloading by focusing on state management and performance modeling. While the system shows great promise, challenges remain in predicting cache locality on ARM-based architectures and scaling to multi-NIC environments. Future work may explore optimizing for power consumption or prioritizing latency for specific high-priority traffic classes.

Summary updated

BibTeX
@misc{xi2024cora,
  author = {Shaoke Xi and Jiaqi Gao and Mengqi Liu and Jiamin Cao and Fuliang Li and Kai Bu and Kui Ren and Minlan Yu and Dennis Cai and Ennan Zhai},
  title = {{Cora: Accelerating Stateful Network Applications with SmartNICs}},
  year = {2024},
  eprint = {2410.22229},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2410.22229},
}
Figure