High-level programming languages for Software-Defined Networking (SDN) promise to make managing complex networks as easy as writing modern software. However, for years, a massive performance gap existed: compilers for these languages often took tens of minutes to generate switch configurations, even for modest networks.
In this paper, Smolka et al. present a new compiler pipeline for NetKAT that doesn't just close this gap—it obliterates it, offering performance several orders of magnitude faster than previous state-of-the-art tools.
TL;DR
The authors introduce a high-performance compiler for NetKAT that leverages Forwarding Decision Diagrams (FDDs) and symbolic automata to translate high-level network policies into hardware-level forwarding tables. The system handles complex features like regular paths and network virtualization while reducing compilation times from tens of minutes to just a few seconds.
What Problem Does This Paper Address?
SDN allows programmers to define network behavior using high-level abstractions rather than manual switch configurations. NetKAT is a leading language in this space, based on a solid mathematical foundation (Kleene Algebra with Tests).
However, existing NetKAT compilers faced two major hurdles:
- The Combinatorial Explosion: Previous compilers used a simple translation to forwarding tables. Because these tables can't easily represent operations like negation or union, the number of rules grew exponentially with the size of the program.
- Global vs. Local Logic: Most compilers only handled "local" programs (describing what a single switch does). They struggled with "global" programs (describing end-to-end paths) or "virtual" programs (running on an abstract topology), which require the compiler to automatically generate and manage complex internal state (tags/labels).
Methods
The authors propose a three-stage compiler pipeline:
1. Local Compilation via FDDs
Instead of compiling directly to tables, the authors use Forwarding Decision Diagrams (FDDs). FDDs are a generalization of Binary Decision Diagrams (BDDs). While a BDD branches on individual bits, an FDD branches on entire packet header fields (e.g., dst_ip). The leaves of the FDD contain sets of actions. This representation allows for efficient algebraic operations (union, composition, negation) without the rule-count explosion seen in table-based approaches.
2. Global Compilation via Symbolic Automata
To handle "global" programs—which use regular expressions to describe paths—the compiler converts the program into a symbolic NetKAT automaton. The compiler then "determinizes" this automaton (similar to NFA-to-DFA conversion) and instruments it with a "program counter" (pc) field. This pc field acts as a tag that tracks the packet's state as it moves through the physical network.
3. Virtual Compilation via Game Theory
To support virtual networks, the compiler treats the mapping between virtual and physical topologies as a game graph. It searches for a "winning strategy"—a set of physical paths (the "fabric") that restores consistency between the virtual and physical packet locations after every hop.
Datasets
The authors evaluated their compiler using a mix of synthetic and real-world benchmarks:
- Fat-trees: Standard datacenter topologies ranging up to 60 pods (supporting 54,000 hosts).
- Topology Zoo: A collection of hundreds of real-world network topologies.
- SDX Benchmarks: Real-world policies from the Software-Defined Internet Exchange (SDX) project.
- Classbench: A standard suite for generating realistic firewall/ACL (Access Control List) rules.
Key Insights and Ideas
- Tables are the wrong IR: Forwarding tables are a "leaky abstraction" for a compiler's intermediate representation. FDDs provide a canonical, reduced form that makes optimization and fixed-point iteration (needed for Kleene star) much easier.
- Automata for State Management: Manually managing tags to track path state is error-prone. By treating global paths as regular languages, the compiler can use well-understood automata theory to generate the minimum necessary state automatically.
- Virtualization is a Search Problem: Compiling a virtual network isn't just about mapping ports; it's about finding a physical "fabric" that can simulate the virtual big-switch behavior regardless of the underlying physical complexity.
Key Results
- Massive Speedups: On the largest SDX benchmarks, the new compiler took 2 seconds, whereas the previous state-of-the-art (Pyretic) took over 10 minutes.
- Scalability: The compiler successfully generated tables for a 48-pod fat-tree (27,000 hosts) in about 30 seconds.
- Rule Efficiency: Using FDD-based optimizations, the compiler produced 30% fewer rules on average compared to a direct table implementation for ACLs.
- Global Overhead: Even when adding the complexity of global routing (which requires state tags), the resulting tables were no more than twice the size of simple local routing tables.
Limitations and Future Work
- Prototype Status: The authors note that while the local compiler is highly tuned, the global compiler is an "early prototype" with significant room for further state minimization.
- Single-Threaded: The current implementation is single-threaded and does not yet leverage multi-core architectures.
- Dynamic Updates: The paper focuses on static compilation. Future work includes integrating incremental algorithms to handle rapid network changes (e.g., link failures) without a full re-compile.
- Richer Primitives: The authors plan to extend the compiler to handle stateful and probabilistic network behaviors.
Summary updated