Introduction
Network operators face a persistent challenge in telemetry: balancing the granularity of data against the overhead of collection. Traditional flow-level monitoring (like NetFlow) is often too coarse to detect subtle performance issues or attacks, while packet-level capture generates a volume of data that is impossible to process or store at line rate.
Sonata addresses this "Goldilocks" dilemma by introducing a query-driven approach that bridges the gap between raw data collection and real-time analysis. By allowing operators to define high-level queries, the system ensures that analysis requirements directly dictate how hardware collects data in real-time.
Methods and Architecture
Sonata provides a unified programming abstraction that allows operators to express telemetry requirements using familiar dataflow operators like map, filter, reduce, distinct, and join. The system then intelligently partitions these queries between programmable hardware (e.g., P4-enabled switches) and software stream processors (e.g., Spark or Flink).
Iterative Refinement
A core innovation of Sonata is "iterative refinement." To conserve limited switch memory, the system initially monitors traffic at a coarse granularity, such as /8 IP prefixes. Upon detecting an anomaly or a "heavy hitter," Sonata automatically reconfigures hardware filters to "zoom in" on finer-grained traffic (e.g., /32 prefixes) in the subsequent time window.
State Management and Optimization
To handle stateful operations within hardware constraints, Sonata utilizes probabilistic data structures like Bloom filters and Count-Min sketches. Furthermore, Sonata treats query planning as a cost-based optimization problem. It builds a graph of all possible partitioning and refinement plans, using historical traffic data to select the path that minimizes the load on both the switch and the stream processor.
Key Results
The system was evaluated using real-world traffic traces from a large Internet Exchange Point (IXP), a major ISP, and a campus network. Key findings include:
- Scalability: Sonata reduces the tuple load on stream processors by over 4x compared to systems that only perform basic hardware filtering.
- State Efficiency: By coordinating refinement across hierarchies, Sonata reduces required switch state by more than 2x compared to uncoordinated sketching systems.
- Developer Productivity: Complex telemetry tasks, such as detecting DNS reflection attacks, can be expressed in just 16 lines of Sonata code, compared to roughly 400 lines of low-level P4 code.
- Detection Speed: The system's workload-driven plans detect events of interest significantly faster than static, workload-agnostic refinement strategies.
Limitations and Future Work
While Sonata significantly advances telemetry, it faces certain hardware constraints; complex mathematical operations (like entropy estimation) still require offloading to software. Additionally, iterative refinement introduces a delay of at least one window interval, which may be too slow for millisecond-level burst detection. Future work involves refining the query optimizer to better handle sudden, radical shifts in traffic patterns.
Summary updated