TL;DR
SNF (Serverless Network Functions) is a high-performance framework that allows cloud providers to offer stateful network functions as a true serverless service. By decoupling how work is assigned (using "flowlets") from how it is billed (per-packet) and using proactive peer-to-peer state sharing, SNF achieves massive latency reductions (up to 19,600x) compared to traditional serverless approaches while maintaining high resource efficiency.
What Problem Does This Paper Address?
Network Functions (NFs)—like firewalls, load balancers, and intrusion detection systems—are moving to the cloud. Ideally, they should run on serverless platforms (Function-as-a-Service) to benefit from automatic scaling and "pay-as-you-go" billing.
However, existing serverless platforms are a poor fit for NFs for two main reasons:
- The Granularity Gap: If you trigger a function for every single packet, the overhead is astronomical. If you pin a function to a whole "flow" (a long-lived connection), you lose the ability to scale quickly and end up paying for idle time between packets.
- The State Bottleneck: NFs are "stateful"—they need to remember previous packets to make decisions. Standard serverless platforms force functions to be stateless, storing data in slow external databases (like S3 or Redis), which adds unacceptable latency to packet processing.
Methods
The authors introduce SNF, which bridges these gaps using two primary architectural shifts:
- Flowlet-based Work Assignment: Instead of assigning work per-packet or per-flow, SNF uses flowlets—bursts of packets within a flow separated by small idle gaps. This allows the system to move work between compute units frequently (improving load balancing) without the overhead of per-packet scheduling.
- Decoupled Billing and Programming: While work is assigned at the flowlet level, the user is still billed per-packet, and the developer still writes code as if processing one packet at a time (
process_pkt()). This preserves the intuitive serverless model. - Ephemeral Statefulness: Rather than using a slow external store, SNF keeps state in the local memory of the compute unit.
- Proactive P2P Replication: During the idle gaps between flowlets, SNF "guesses" which compute units might handle the next burst and proactively replicates the necessary state to them in a peer-to-peer fashion.
- Weighted Greedy Bin-Packing: A custom controller algorithm packs flowlets into the minimum number of compute units possible, prioritizing units that already have the required state locally.
Datasets
The researchers evaluated SNF using:
- Real-world Packet Traces: Two traces captured on a WAN link between a university and AWS EC2. These include a mix of 1.7K to 199K concurrent connections with varying packet sizes.
- Synthetic Workloads: Used specifically to test "adversarial flowlets" (sudden spikes in traffic) and fault tolerance.
- Five Stateful NFs: They re-implemented a NAT, Load Balancer (LB), Intrusion Detection System (IDS), UDP Whitelister, and QoS Traffic Policer to test the system's versatility.
Key Insights and Ideas
- Breaking the "Event" Coupling: In standard FaaS, the "event" (e.g., an HTTP request) is the unit of work, the unit of billing, and the unit of scaling. SNF proves that for high-performance streaming, these must be decoupled.
- The "Flowlet" is the Sweet Spot: Flowlets provide 3.36x more opportunities to rebalance work than flow-based systems, allowing for much tighter "packing" of resources and better handling of "elephant" flows that would otherwise overwhelm a single CPU.
- State is Local, but Mobile: By treating state as "ephemeral" and moving it during idle times, SNF achieves the performance of a stateful system with the elasticity of a stateless one.
Key Results
- Latency: SNF reduced 75th-percentile processing latency by 2,900x to 19,600x compared to "smart" flow-based allocation.
- Tail Latency: Proactive state management improved 99th-percentile tail latency by 12–15x over state-of-the-art external state solutions.
- Efficiency: SNF can match resource provisioning to actual traffic demand at a fine-grained timescale of 100ms, ensuring cloud providers don't waste hardware and users don't overpay.
- Fault Tolerance: The system supports fast recovery (140µs to pull state from a logger), which is 22.8x to 183.6x faster than alternative recovery methods.
Limitations and Future Work
- Distributed NF Chains: The current prototype focuses on single NFs or chains that fit within a single compute unit. The authors plan to explore NFs spread across multiple physical machines in the future.
- Cross-Flow State: While SNF handles per-flow state (like a NAT table entry) brilliantly, "cross-flow" state (like global statistics across all users) still requires some form of external synchronization, which wasn't the primary focus here.
- Controller Scalability: For massive 100Gbps+ workloads, a single controller might become a bottleneck. While the paper discusses a "Global Resource Manager" to handle multiple controllers, this adds complexity to the architecture.
Summary updated