Inspiration
Many network performance testing tools depend on DPDK (Data Plane Development Kit), which requires complex setup and strict hardware requirements. Additionally, existing tools like Trex are Python-based, making dependency management cumbersome.
xdperf was born from the desire to create "a high-performance traffic generator that works without DPDK, runs as a single binary, and can flexibly generate arbitrary packets."
What it does
xdperf is a high-performance network traffic generation tool that leverages XDP (eXpress Data Path).
- Client/Server modes: Supports send-only, receive-only, and bidirectional measurements
- WASM plugin system: Define arbitrary packet formats through plugins
- High throughput: Achieves millions of pps through XDP kernel bypass
- PPS control: Rate limiting with target pps (packets per second)
- Statistics: Real-time send/receive statistics and NIC-level statistics display
How we built it
Architecture:
- eBPF/XDP layer (C): The xdp_tx program reads packet templates from eBPF maps and transmits directly via XDP_TX
- Control layer (Go): Loads and manages BPF programs using the cilium/ebpf library, and includes a template generator that takes the desired packets and processing logic as input to produce the packet to be injected.
- Plugin layer (TinyGo and Go →WASM): Executes packet generation logic on the wazero runtime
Challenges we ran into
- Fighting the BPF Verifier: Code optimizations like loop unrolling and bounds checking were necessary to pass the BPF verifier
- Supporting both TinyGo and Go as WASM plugins: Ensuring that both TinyGo-compiled and Go-compiled WASM modules run reliably on wazero was particularly difficult.Differences in runtime behavior, memory model, and build constraints required substantial engineering effort.
- Per-CPU map design: Managing packet indices during parallel execution across multiple CPUs required a design where each CPU maintains independent state
- Packet size adjustment: Handling edge cases when dynamically changing packet size with bpf_xdp_adjust_tail()
Accomplishments that we're proud of
- DPDK-free: Works without special drivers or hardware configuration
- Single binary: Easy deployment thanks to Go implementation
- Plugin extensibility: Safe and flexible packet generation through WASM
- Client/Server modes: Supports bidirectional network measurement
- Designed the Template feature that provides a clean boundary between plugins and the host
What we learned
- How XDP works: High-speed path that bypasses the kernel network stack
- eBPF programming: Map operations, verifier constraints, per-CPU variable handling
- WASM hosting: Executing WASM modules within Go using wazero
- gopacket: Low-level packet construction in Go
What's next for xdperf
- More protocol plugins: Add plugins for TCP, ICMP, QUIC, etc.
- Distributed testing: Coordinated traffic generation from multiple nodes
- GUI/Dashboard: Visualization of real-time statistics
- Latency measurement: Add RTT measurement functionality