Abstract
High-level programming languages play a key role in a growing number of networking platforms, streamlining application development and enabling precise formal reasoning about network behavior. Unfortunately, current compilers only handle "local" programs that specify behavior in terms of hop-by-hop forwarding behavior, or modest extensions such as simple paths. To encode richer "global" behaviors, programmers must add extra state—something that is tricky to get right and makes programs harder to write and maintain. Making matters worse, existing compilers can take tens of minutes to generate the forwarding state for the network, even on relatively small inputs. This paper presents a new compiler for the NetKAT language that handles rich features including regular paths and virtual networks, and yet is several orders of magnitude faster than previous compilers. The compiler uses symbolic automata to calculate the extra state needed to implement "global" programs, and an intermediate representation based on binary decision diagrams to dramatically improve performance. We describe the design and implementation of three essential compiler stages: from virtual programs to global programs, from global programs to local programs, and from local programs to hardware-level forwarding tables. We present results from experiments on real-world benchmarks that quantify performance in terms of compilation time and forwarding table size.
Introduction
Software-Defined Networking (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 the mathematical foundation of Kleene Algebra with Tests. However, existing NetKAT compilers have historically faced two major hurdles: a combinatorial explosion in rule counts and difficulty managing "global" logic (end-to-end paths) versus "local" logic (single-switch behavior). These limitations often forced programmers to wait tens of minutes for compilation or manually manage complex internal state tags.
The NetKAT Compiler Pipeline
To address these challenges, the authors propose a three-stage compiler pipeline that transforms high-level intent into low-level hardware instructions efficiently.
1. Local Compilation via FDDs
Instead of compiling directly to tables, the compiler uses Forwarding Decision Diagrams (FDDs) as an intermediate representation. 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).
This representation allows for efficient algebraic operations like union, composition, and negation without the rule-count explosion seen in previous table-based approaches. FDDs provide a canonical, reduced form that makes optimization and fixed-point iteration (required for Kleene star operations) significantly easier.
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 and instruments it with a "program counter" (pc) field. This pc field acts as a tag that automatically tracks the packet's state as it moves through the physical network, removing the need for manual state management.
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.
Evaluation and Key Results
The compiler was evaluated using synthetic fat-tree topologies and real-world benchmarks from the Topology Zoo and SDX projects. The results demonstrate a massive performance leap:
- Massive Speedups: On the largest SDX benchmarks, the new compiler took just 2 seconds, whereas the previous state-of-the-art (Pyretic) required over 10 minutes.
- Scalability: The compiler successfully generated tables for a 48-pod fat-tree (27,000 hosts) in approximately 30 seconds.
- Rule Efficiency: FDD-based optimizations produced 30% fewer rules on average compared to direct table implementations for firewall policies.
- Global Overhead: Even with the added complexity of global routing and state tags, the resulting tables were no more than twice the size of simple local routing tables.
Conclusion and Future Work
This work demonstrates that high-level network abstractions do not have to come at the cost of compilation performance. By moving away from tables as a primary intermediate representation and leveraging automata theory, the NetKAT compiler achieves line-rate-ready configurations in seconds. Future work includes extending the compiler to support multi-core architectures, incremental updates for dynamic networks, and richer primitives for stateful or probabilistic behaviors.
Summary updated