Data-plane networking
Robert Graham (Errata Security)
BruCON 0x05 · Day 2
Overview
In his BruCON 2013 talk, "Data-plane networking," Robert Graham, founder of Errata Security, delivers a compelling critique of the fundamental architectural choices underpinning much of the internet's critical infrastructure and web applications. Graham argues that the prevailing software development paradigms, largely inherited from the 1990s, are fundamentally ill-suited to the demands of the modern, massively scaled, and increasingly hostile internet. He posits that a failure to update engineering "textbooks" has led to widespread vulnerabilities and scalability bottlenecks, drawing parallels to historical engineering disasters like the Tacoma Narrows Bridge collapse, the sinking of the Titanic, and the fall of the Twin Towers on 9/11 – events that irrevocably altered their respective fields' design principles.

Key moments
- 0:00 Introduction and talk overview
- 5:59 Internet textbooks fail to teach modern vulnerabilities
- 10:30 Apache's scalability limits: Moore's Law is not the answer
- 19:00 Bind DNS server vulnerable to a single smartphone
- 23:00 Rewriting textbooks: Bypassing kernel and managing memory
- 32:00 Advanced thread synchronization for extreme scalability
- 42:00 Performance results: Masscan 10x, DNS server 100x faster
- 46:20 Q&A: Intel DPDK for user-mode networking
Data-plane networking
Speakers: Robert Graham, Errata Security
Conference: BruCON
YouTube: https://www.youtube.com/watch?v=cYPmbrsvfxw
Overview
In his BruCON 2013 talk, "Data-plane networking," Robert Graham, founder of Errata Security, delivers a compelling critique of the fundamental architectural choices underpinning much of the internet's critical infrastructure and web applications. Graham argues that the prevailing software development paradigms, largely inherited from the 1990s, are fundamentally ill-suited to the demands of the modern, massively scaled, and increasingly hostile internet. He posits that a failure to update engineering "textbooks" has led to widespread vulnerabilities and scalability bottlenecks, drawing parallels to historical engineering disasters like the Tacoma Narrows Bridge collapse, the sinking of the Titanic, and the fall of the Twin Towers on 9/11 – events that irrevocably altered their respective fields' design principles.
Graham's presentation is a call to action for a radical rethinking of how network-facing applications are built. He advocates for adopting a "data-plane" approach, a concept borrowed from telecommunications, where the fast, high-volume handling of data is explicitly separated from slower, feature-rich control logic. To illustrate the efficacy of this paradigm, Graham delves into the technical specifics of his own projects, including the high-speed port scanner masscan and a custom DNS server, both engineered from the ground up to leverage direct hardware access, asynchronous event-driven designs, custom memory management, and advanced lock-free synchronization techniques.
The talk is significant because it challenges deeply ingrained assumptions about operating system abstraction and software architecture, offering concrete, performance-driven alternatives. By demonstrating how a single smartphone can theoretically overwhelm a standard DNS server and how common web servers like Apache fail under moderate load, Graham underscores the urgent need for a shift in engineering philosophy. His work provides a blueprint for building resilient, scalable, and performant systems capable of withstanding the relentless traffic and adversarial conditions of the contemporary internet, ultimately urging a rewrite of the foundational principles taught to the next generation of developers.
Background
▶ Watch: Introduction and talk overview (0:00)
The core premise of Graham's talk is that the internet, as it existed in 2013, faced a critical architectural debt stemming from foundational decisions made in the 1990s. This debt manifests in two primary areas: security and scalability. Graham highlights the persistent prevalence of vulnerabilities like SQL injection and buffer overflows, noting that contemporary computer science textbooks, such as those for web development or C programming, often fail to adequately address these issues. This educational gap means newly graduated engineers are entering the workforce without a fundamental understanding of why systems fail, perpetuating cycles of insecure and unscalable design.
A prime example of this architectural flaw is the ubiquitous use of Apache with mod_php. Graham contends that this stack, while effective for rapid prototyping in the early dot-com era, is inherently unsuited for production environments in the 2013 internet. The problem lies in Apache's default "one thread per connection" model, which struggles with scalability. As concurrent connections increase, Apache hits a performance wall, failing to handle more traffic even with significant hardware upgrades. This distinction between performance (how fast a single operation is) and scalability (how well a system handles increasing load) is central to Graham's argument. Moore's Law, which predicts exponential growth in processing power, does not magically solve architectural scalability issues; simply buying a faster server does not enable Apache to handle proportionally more connections.
This lack of scalability leaves systems vulnerable to mundane yet effective attacks, such as SEO bots, scrapers, and comment spam tools, which generate thousands of concurrent connections, effectively acting as denial-of-service agents. Graham illustrates this with the common scenario of a professional's blog, hosted on a standard VPS with Apache and WordPress, being taken down by bot traffic. The typical "solution" – moving to a larger host or using services like Cloudflare – merely puts a band-aid on the problem without addressing the underlying architectural deficiency.
Graham extends this critique to critical infrastructure like DNS. He points out that BIND, the most popular DNS server, exhibits similar scalability issues, struggling at relatively low packet rates (e.g., 40,000 packets per second). With the explosion of internet users (600 million in 2002 to 2.3 billion in 2012) and smart devices (225 million smartphones sold in one quarter in 2013, capable of 50,000 packets per second), a single modern smartphone connected via high-speed Wi-Fi (802.11ac) could theoretically overwhelm a BIND server.
To contextualize his proposed solutions, Graham introduces the concept of the data plane from telecommunications. Originating in the 1950s with manual switchboard operators and formalized in the 1970s with digital telephone switches (where the first Unix computers acted as control planes), this paradigm separates the control plane (managing configuration, slower, feature-rich) from the data plane (high-speed, raw traffic handling, often hardware-accelerated). Graham argues that internet services need a similar separation, using fast, specialized front-ends (like Nginx, Lighttpd, Varnish, or hardware devices) to handle the data plane, while traditional backend systems (Apache, databases, business logic) serve as the control plane, shielded from direct internet exposure. This historical context underscores the idea that these problems are not new, and effective solutions exist in other engineering domains.
Key Findings
▶ Watch: Apache's scalability limits: Moore's Law is not the answer (10:30)
Robert Graham's talk reveals several key findings that challenge conventional wisdom in network application development and highlight the urgent need for a paradigm shift:
- Outdated Architecture is Pervasive: Much of the internet's foundational software, including popular web servers like Apache and critical DNS servers like BIND, is built on architectural principles from the 1990s. These designs, particularly the "one thread per connection" model, are inherently unscalable and vulnerable to the demands of the modern internet, which features billions of devices and constant adversarial traffic.
- Scalability vs. Performance Misconception: There's a widespread misunderstanding that simply increasing hardware resources (e.g., faster CPUs, more RAM) will solve scalability issues. Graham demonstrates that for poorly designed applications, performance improvements do not translate linearly into increased connection handling capacity, leading to diminishing returns and systems that still "fall over" under load.
- The Need for Asynchronous, Event-Driven Design: The solution to scalability lies in asynchronous, event-driven architectures, exemplified by web servers like Nginx. This model, which uses a small number of threads (e.g., one per CPU core) to manage a vast number of connections, offers consistent performance regardless of connection count, a stark contrast to Apache's performance degradation.
- Direct Hardware Access for Extreme Throughput: Bypassing the operating system's kernel network stack and directly interacting with the Network Interface Card (NIC) hardware is crucial for achieving truly high packet rates (millions to tens of millions of packets per second). Technologies like PF_RING DNA or Intel DPDK enable this, drastically reducing latency and overhead.
- Optimized Memory Management is Critical for Large Datasets: For applications dealing with large, memory-resident datasets (like DNS zones), traditional operating system memory management can introduce significant performance bottlenecks due to page table cache misses. Employing huge pages (e.g., 2MB pages instead of 4KB) can dramatically reduce these misses, leading to substantial speed improvements.
- Lock-Free and Shared-Nothing Synchronization for Multi-core Scaling: Conventional multi-threading techniques relying on mutexes often fail to scale beyond a few CPU cores due to cache contention. Graham advocates for advanced synchronization primitives like ring buffers (for efficient inter-thread communication) and Read-Copy Update (RCU) (for highly concurrent read-mostly data structures), along with the principle of "avoiding data sharing" altogether, to achieve linear scalability across many cores.
- Demonstrated Superiority with Custom Tools: Graham's own projects, masscan (a port scanner) and a custom DNS server, serve as proof-of-concept for these principles. Masscan achieves 25 million packets per second, orders of magnitude faster than kernel-based alternatives like Z-map (1.3 million pps). His DNS server is shown to be 100 times faster than BIND and 10 times faster than other high-performance DNS servers, demonstrating the practical impact of these architectural changes.
Technical Deep Dive
▶ Watch: Rewriting textbooks: Bypassing kernel and managing memory (23:00)
Graham's technical deep dive focuses on specific strategies and implementations that enable the "data-plane" approach to networking, contrasting them with conventional methods.
Asynchronous Event-Driven Design
The fundamental shift Graham advocates is from the traditional "one thread per connection" model, common in servers like Apache, to an asynchronous, event-driven design. In the former, each incoming connection spawns a new thread or process, leading to significant overhead and resource contention as the number of connections grows. This model hits a scalability wall where adding more CPU power yields diminishing returns in terms of concurrent connections.
In contrast, an event-driven architecture, exemplified by Nginx, dedicates a small, fixed number of threads (typically one per CPU core). These threads don't block waiting for I/O; instead, they register interest in events (like data arriving on a socket) and are notified when those events occur. This allows a single thread to efficiently manage thousands or even millions of concurrent connections, maintaining consistent performance regardless of load. Graham's performance graphs dramatically illustrate this, showing Apache's throughput plummeting as connections increase, while Nginx's remains flat.
Direct Network Interface Card (NIC) Access
A critical bottleneck in high-performance networking is the operating system's TCP/IP stack. When a packet arrives, it traverses a complex path through the kernel (as visually depicted by Graham's "convoluted path" diagram of the Linux kernel), involving multiple layers of processing, memory copies, and context switches before reaching a user-space application. While modern Linux kernels (e.g., version 3.4+) have improved, handling up to 2 million packets per second on low-end systems, this is insufficient for the desired 10 million or 100 million packets per second.
To bypass this overhead, Graham utilizes technologies that provide Direct NIC Access. His project uses PF_RING DNA (Direct NIC Access), which replaces the standard network driver, effectively disconnecting the NIC from the kernel and linking it directly to a user-mode application via a shared library. This allows the application to directly send and receive packets to and from the hardware, bypassing the entire kernel stack. Other solutions exist, such as Intel's Data Plane Development Kit (DPDK), which offers a similar approach.
Modern NICs further enhance this by supporting stream splitting. They can divide incoming network traffic into multiple virtual network cards or queues, each delivering data to a specific CPU core and thread. This is particularly powerful because it means each thread receives its network data without having to share or synchronize access with other threads at the application layer, significantly simplifying multi-threaded network programming and eliminating cache contention related to network I/O. For stateful protocols like TCP, NICs can use hashing (e.g., on TCP/IP tuples) to ensure that all packets belonging to a single connection are directed to the same thread and core.
Custom Memory Management
When dealing with very large datasets that reside in RAM, such as the entire .com DNS zone file (8GB raw, requiring 16GB for an in-memory hash table), standard operating system memory management can introduce substantial performance penalties. Graham explains that for 16GB of allocated memory with the default Linux page size of 4KB, the operating system requires 32MB of page tables. Since a typical CPU's cache (e.g., 8MB) cannot hold these page tables, every random memory access (like a DNS query for an uncached domain) results in a cache miss for the page table itself, adding significant latency (up to 100-200 nanoseconds per miss).
The solution is to use huge pages. By configuring the operating system to use larger page sizes (e.g., 2MB instead of 4KB), the number of required page tables is drastically reduced. For 16GB of RAM, 2MB huge pages would only require 64KB of page tables, which easily fits within the CPU's cache. This simple change can reduce random memory access time by 50%, directly translating to a significant speed increase for applications like a DNS server that perform frequent random lookups.
Advanced Thread Synchronization
Traditional multi-threading often relies on mutexes to protect shared data. While essential for correctness, mutexes are a major bottleneck for scalability. When multiple threads contend for a mutex, it leads to cache bouncing, where data protected by the mutex is repeatedly moved between different CPU caches, wasting cycles and slowing down the entire application. Graham observes that many multi-threaded applications scale well up to a few cores but then slow down as more cores are added due to mutex contention.
Graham proposes three key strategies for advanced thread synchronization:
- Avoid Data Sharing: The most effective technique is to design applications so that threads operate on their own private data as much as possible, minimizing the need for shared access. For example, in
masscan, each transmit thread maintains its own private packet counter, which is only summed up by a separate reporting thread once per second. This prevents constant cache bouncing. Linux kernel versions (e.g., 2.6 to 3.x) adopted this for network interface counters.
- Ring Buffers (FIFO Queues): These are circular data structures where one thread (the producer) adds data to one end, and another thread (the consumer) removes data from the other. What makes them "awesome" is their inherent synchronization properties: if there's a single producer and a single consumer, no special synchronization (not even atomic operations) is required. The producer and consumer operate on different parts of the ring, avoiding cache contention. This technique is used in PF_RING itself (synchronizing hardware with user-mode applications) and is the foundation for message passing between threads in highly scalable languages like Erlang. Graham uses ring buffers to connect transmit and receive threads in
masscan, allowing asynchronous operation while passing necessary control messages (like ACKs for TCP banners).
- Read-Copy Update (RCU): This technique is ideal for data structures that are read very frequently but updated infrequently, such as DNS records. When an update occurs (e.g., changing an IP address for a domain), the updating thread does not modify the existing record. Instead, it creates a copy of the record, applies all changes to the copy, and then atomically swaps a pointer to point to the new version. Existing reader threads continue to access the old version of the data until they naturally "see" the new pointer, ensuring they always get a consistent view. The old copy is only reclaimed after all active readers have finished with it. RCU requires no special synchronization for readers and is used extensively throughout the Linux kernel (e.g., in Linux 3.6+).
By implementing these advanced techniques, Graham's custom software achieves linear scalability with increasing CPU cores, overcoming the limitations of traditional mutex-based designs.
Demo / Proof of Concept
▶ Watch: Advanced thread synchronization for extreme scalability (32:00)
Robert Graham supports his architectural assertions with concrete demonstrations of his own tools, masscan and a custom DNS server, showcasing their dramatically superior performance compared to conventional alternatives.
Masscan: High-Speed Port Scanner
Graham's masscan is a port scanner designed to scan the entire internet in minutes. It embodies the principles of direct hardware access, asynchronous design, and efficient synchronization.
- Performance: Graham demonstrates
masscanblasting out 25 million packets per second on a quad-core desktop with two 10 Gigabit Ethernet cards. This is achieved by bypassing the Linux kernel's network stack via PF_RING DNA. He notes that the theoretical maximum for a single 10 Gigabit link is around 15 million packets per second, so his setup with two cards is pushing the limits, close to the theoretical 30 million packets per second. - Comparison to Z-map: Graham explicitly compares
masscanto Z-map, another high-speed scanner. While praising Z-map's design and associated paper, he highlights that Z-map, which relies on the Linux kernel's network stack, is limited to about 1.3 million packets per second.masscanis therefore roughly 10 times faster than Z-map, illustrating the profound impact of direct NIC access. - Architectural Efficiency:
masscanutilizes a pair of transmit and receive threads per core, connected by ring buffers, to manage the asynchronous sending and receiving of packets. This "shared-nothing" approach, combined with private packet counters per thread, eliminates cache contention and allows for linear scalability. - Limitations: Graham acknowledges that
masscanis not a direct replacement for tools like Nmap. Nmap focuses on scanning a host at a time, providing detailed OS identification and service enumeration.masscan, by contrast, scans a port at a time across a vast range of IPs, and while it can grab banners, its OS identification capabilities are limited. It excels at wide-area, high-speed discovery rather than in-depth host analysis.
Custom DNS Server
Graham's custom DNS server further exemplifies his "data-plane" design principles, focusing on raw query-response throughput.
- Performance: The server achieves 6 million packets per second per core for repeated queries. It scales linearly, meaning a four-core system can handle 24 million packets per second. However, with cache misses (i.e., requests for random, non-cached domain names in a large database), performance roughly halves, underscoring the importance of optimized memory management.
- Comparison to BIND: Graham states his server is an astounding 100 times faster than BIND, which he showed struggles at 40,000 packets per second. This dramatic difference highlights BIND's unsuitability for direct internet exposure under modern load.
- Comparison to Other DNS Servers: Even against other faster DNS servers like PowerDNS and NSD, Graham's server is 10 times faster.
- Architectural Features: The DNS server incorporates huge pages for efficient memory management of large zone files (like the .com domain), reducing page table cache misses. It also leverages Read-Copy Update (RCU) for updating DNS records, allowing high-concurrency reads without locking.
- Limitations: Graham is clear that his DNS server is "far from complete." It lacks a master database and is designed to act as a slave or mirror to an existing authoritative master (like BIND). This aligns with his "data-plane" philosophy: the master BIND server handles the complex control plane functions (database updates, zone transfers), while the custom server acts as a fast, feature-poor data plane, serving queries directly to the internet. This model, he notes, was actually anticipated in the original DNS design of the 1980s.
Together, these demonstrations provide compelling evidence that by adopting a data-plane architecture, developers can build network applications that are orders of magnitude more performant and scalable than those built with traditional, kernel-dependent, mutex-heavy approaches.
Defensive Implications
▶ Watch: Q&A: Intel DPDK for user-mode networking (46:20)
Robert Graham's talk offers profound defensive implications, urging security professionals and infrastructure architects to fundamentally re-evaluate their approaches to system design and deployment. The core message is to assume a hostile, high-volume internet and build accordingly.
- Upgrade Core Infrastructure: The most immediate implication is to phase out outdated and unscalable software stacks. Apache and mod_php should be relegated to development or internal, protected environments, not exposed directly to the public internet. Defenders should migrate to modern, event-driven alternatives like Nginx (often paired with FastCGI for PHP applications) or other high-performance web servers that are designed for scalability. This reduces the attack surface and improves resilience against common bot traffic that can act as a de facto denial-of-service.
- Rethink DNS Architecture: For critical DNS services, the traditional model of exposing a single, feature-rich BIND server directly to the internet is a recipe for disaster. Defenders should implement a data-plane/control-plane separation. Fast, specialized DNS servers (like Graham's prototype, NSD, or PowerDNS) should serve as the public-facing data plane, acting as mirrors or slaves. The authoritative master BIND server, which handles updates and complex zone management (the control plane), should be isolated behind these high-performance front-ends, never directly exposed to the internet. This dramatically improves resilience against DNS-based denial-of-service attacks, which can be launched even from a single powerful device.
- Embrace Modern Engineering Principles: Defenders need to advocate for, and potentially implement, the architectural shifts Graham describes:
- Asynchronous, Event-Driven Design: Prioritize this model for any network-facing application to ensure scalability.
- Direct NIC Access: Investigate and utilize technologies like PF_RING DNA or Intel DPDK for applications requiring extreme packet processing rates (e.g., intrusion detection systems, firewalls, load balancers, high-volume proxies). This can enable monitoring or filtering at speeds previously thought impossible with commodity hardware.
- Optimized Memory Management: For systems handling large in-memory datasets, configure and leverage huge pages to improve cache efficiency and overall performance.
- Advanced Thread Synchronization: Promote the use of lock-free techniques like ring buffers and Read-Copy Update (RCU), and the principle of avoiding data sharing, to build applications that scale linearly across multi-core processors without performance degradation.
- Prioritize Security in Education and Training: Graham's talk highlights a fundamental flaw in technical education. Security professionals should push for updated curricula in universities and internal training programs to adequately cover modern security vulnerabilities (SQL injection, buffer overflows) and, critically, the principles of building scalable, resilient network software. New engineers must be taught how systems fail and how to design robust architectures from the outset, rather than learning through costly production failures.
- Design for Hostility: The internet is a hostile environment. Every system exposed to it should be designed with the explicit assumption that it will be subjected to high volumes of malicious or resource-intensive traffic. This means moving beyond "prototype" thinking and building "production-ready" systems that are inherently hardened against common attack vectors and scalability challenges from day one. Services like Cloudflare, while useful, should be viewed as an additional layer of defense, not a substitute for fundamentally sound architecture.
By adopting these defensive implications, organizations can move from reactive patching and band-aid solutions to proactive, architecturally sound deployments that are better equipped to handle the scale and threats of the contemporary internet.
Key Takeaways
- The foundational software architectures widely used on the internet (e.g., Apache, BIND) are outdated and inherently unscalable, unable to cope with the billions of devices and hostile traffic of the modern web.
- Simply adding more hardware (Moore's Law) does not solve architectural scalability issues; a shift to asynchronous, event-driven designs (like Nginx) is crucial for consistent performance under high load.
- Achieving extreme network throughput (tens of millions of packets per second) requires bypassing the operating system's kernel network stack and directly accessing the NIC hardware using technologies like PF_RING DNA or Intel DPDK.
- For applications managing large in-memory datasets, optimizing memory access with huge pages significantly reduces page table cache misses, leading to substantial performance gains.
- Multi-core scalability demands advanced lock-free synchronization techniques like ring buffers and Read-Copy Update (RCU), along with a design philosophy of avoiding data sharing between threads, to prevent cache contention.
- A "data-plane" architectural approach, separating fast, feature-poor traffic handlers from slower, feature-rich control logic, is essential for building resilient and performant internet infrastructure, mirroring proven telecom designs.
About the Speaker(s)
Robert Graham is the founder of Errata Security, a well-known information security firm. He is an outspoken and influential voice in the security community, frequently sharing his insights on his blog at blog.erratasec.com and on Twitter as @erratarob. Graham is recognized for his deep technical expertise in networking and security, often challenging conventional wisdom and advocating for fundamental architectural changes. His work includes the development of high-performance tools like masscan, a port scanner capable of scanning the entire internet rapidly, and a custom, highly optimized DNS server, both of which serve as practical demonstrations of the advanced networking and synchronization principles he advocates.