How iqiyi/dpvs works
Main Components
• Data Plane (DPVS Core): This is where high-speed packet processing occurs. It makes use of DPDK, and its integration is clearly visible in the “src” and “include” directories (e.g. core files for handling DPDK memory, mbuf management, RX/TX batching, etc.). Also, modules under “ipvs”, “ipset”, “ipv6”, “tc” show the implementation of load balancing algorithms (RR, WLC, WRR, MH, Conhash), connection tracking, and traffic control.
• DPDK Integration & Environment Setup: DPDK is fundamental. A distinct process for binding NIC devices using tools like dpdk-devbind.py exists, along with patch directories (patch/dpdk-24.11) where DPDK-specific modifications are applied. Hugepages and driver configurations (e.g. in the README’s “DPDK setup” section) belong here.
• Control & Management: This includes administration and runtime configuration through tools like dpip and ipvsadm. The configuration files in “conf” (with different dpvs.conf samples) and the header “conf/dpvs.conf.items” define the supported options. Also, dpvs-agent (in both “src” and “tools/dpvs-agent”) and the healthcheck components provide RESTful management and monitoring.
• Auxiliary Kernel/Interface Components: Although the DPVS engine bypasses the kernel for data path, there remain kernel modules (e.g., under “kmod”) for handling legacy KNI (or for the optional virtio-user replacement) and sample code for special modes (such as UOA).
• Testing & Documentation: The “test”, “doc”, and “tools” directories contain performance tests, sample scripts, and extensive documentation that are relevant for operational topology and system verification.
Relationships and Interactions
• Incoming traffic from physical NICs is bound and managed by DPDK. Packets enter the data plane of DPVS, where the core load-balancing engine (in “src”) processes the packets using various algorithms (with modules under “ipvs”, “ipset”, etc.).
• The engine interacts with its configuration (read from dpvs.conf and associated items) and receives runtime control commands via the management tools (dpip, ipvsadm, and dpvs-agent).
• The control plane (or management interfaces) provides an admin layer, enabling adjustments to the forwarding decisions (e.g., setting up VIPs, local IPs for FNAT, and adjusting algorithm parameters).
• Debugging and performance tools (found in “tools” and “test”) interface with the core to monitor and fine-tune performance.
Architectural Patterns
• Layer separation: There is a clear separation between the data plane (packet processing, forwarding) and the control/management plane (configuration, monitoring via REST API, command line utilities).
• Lockless / per-CPU architecture: The share‑nothing design (demonstrated by the modular, per‑CPU data structures found in “global_data”, “scheduler”, etc.) could be highlighted.
• Extensibility: The modular design (see distinct directories for ipset, ipvs, parser, etc.) illustrates a plug‑in approach for different forwarding modes and health-check mechanisms.
Relevant Technologies
• DPDK – basis for high-speed packet I/O and NIC binding.
• Linux networking (for hugepages, NIC configuration and kernel bypass).
• C Programming (core engine, config file parsing, and low-level packet processing)
• REST API and Golang components – in dpvs-agent for modern management.
• Tools and scripts (Makefiles, shell scripts in “scripts” and “tools”) which automate builds, dpdk patching, and configuration management.
– DPDK Libraries & Drivers (include mention of hugepages, NIC binding)
– DPVS Data Plane Engine (with sub-modules like IPVS, Traffic Control, IPset, Connection Management)
– Control & Management Plane (dpip, ipvsadm, dpvs-agent, healthcheck)
– Configuration Management (dpvs.conf and associated items)
– Auxiliary Kernel Modules (legacy KNI, kmod components)
• Labels that specify major design patterns (e.g., “Lockless per-CPU,” “Kernel bypass”) and note external dependencies (DPDK, hugepages, etc.).
Essential Architectural Elements
• Be as detailed as possible by drawing out each module as a distinct component where appropriate (for instance, representing the IPVS algorithm module separately from the IPset module).
• Dependencies on other systems (e.g., external REST calls via dpvs-agent, DPDK patches, build environment scripts).