Introduction
Modern network applications are increasingly reliant on a complex hierarchy of libraries for remote procedure calls (RPCs), serialization, and messaging. While high-performance libraries like DPDK offer significant speedups, they often impose rigid "deployment assumptions"—such as requiring exclusive CPU core access—that limit portability across diverse cloud environments. Developers are typically forced to choose between portable but slow standard kernel sockets or fast but brittle specialized libraries. Bertha is a reconfigurable network stack designed to eliminate this trade-off by allowing communication libraries to be swapped at runtime or deployment without modifying application code.
The Chunnel Abstraction
At the heart of Bertha is the Chunnel (Channel + Tunnel), a modular abstraction representing a single unit of network functionality, such as encryption, sharding, or a hardware driver. These Chunnels are composable, allowing developers to build a "Chunnel Stack" tailored to specific application needs.
A key feature of this architecture is the select type. Instead of hardcoding a single implementation, developers can specify multiple valid options for a layer. For instance, a stack might be configured to use either a standard Kernel UDP socket or a high-performance DPDK-based one, depending on the available environment. Bertha leverages Rust’s type system to ensure these stacks are composed safely, preventing incompatible layers from being connected.
Dynamic Reconfiguration and Negotiation
Bertha supports both unilateral changes (local driver swaps) and multilateral changes (requiring peer agreement, like serialization formats). To handle the latter, Bertha employs a Negotiation Protocol where endpoints exchange stack configurations at the start of a connection to ensure compatibility. To minimize latency, Bertha can "remember" successful configurations for zero-RTT subsequent connections.
For local performance optimizations, Bertha can perform Stateful Reconfiguration on the fly. This process ensures that switching from one implementation to another does not drop packets or corrupt the connection state.
As shown in the figure above, the system establishes a connection, locks the current implementation to prevent race conditions, transfers internal state (e.g., sequence numbers or active port lists) from the old Chunnel to the new one, and finally updates the active field before releasing the lock. This handover is remarkably efficient, typically resulting in only a brief latency spike of approximately 68µs.
Performance and Evaluation
Bertha’s impact on performance is substantial. In benchmarks involving a sharded key-value store, the ability to dynamically enable client-side sharding led to a 16x increase in throughput while maintaining a strict 50µs latency target. In publish-subscribe workloads, switching ordering guarantees based on subscriber count reduced median latency by 63%.
Crucially, the overhead of this abstraction layer is minimal. While tiny 64-byte packets see a 27% overhead in complex stacks, this drops to just 4% for standard 128-byte packets and becomes negligible as packet size increases. This demonstrates that the flexibility of a reconfigurable stack does not come at the cost of raw performance.
Conclusion
Bertha successfully decouples network application logic from underlying deployment environments. By providing a type-safe, composable framework for network functionality, it enables applications to remain portable while automatically leveraging high-performance hardware and libraries whenever they are available.
Summary updated