DPDK官网:http://www.dpdk.org/
What it is
DPDK is a set of libraries and drivers for fast packet processing. It was designed to run on any processors. The first supported CPU was Intel x86 and it is now extended to IBM Power 8, EZchip TILE-Gx and ARM. It runs mostly in Linux userland. A FreeBSD port is available for a subset of DPDK features.
DPDK is an Open Source BSD licensed project. The most recent patches and enhancements, provided by the community, are available in master branch.
Main libraries
- multicore framework
- huge page memory
- ring buffers
- poll-mode drivers
Usage
These libraries can be used to:
- receive and send packets within the minimum number of CPU cycles (usually less than 80 cycles)
- develop fast packet capture algorithms (tcpdump-like)
- run third-party fast path stacks
Some packet processing functions have been benchmarked up to hundreds million frames per second, using 64-byte packets with a PCIe NIC.
What it is not
DPDK is not a networking stack and does not provide functions such as Layer-3 forwarding, IPsec, firewalling, etc. Within the tree, however, various application examples are included to help developing such features.
Some support and services are provided by several companies.
DPDK是报文快速处理的库和驱动的集合,它的设计是可以运行在任何平台。最先支持的是Intel X86平台,现在已经扩展到IBM Power 8,EZChip TILE_Gx及 ARM。大多数情况下运行在linux的用户态空间。
UIO是实现用户空间下驱动程序的支撑机制,一般网卡收包是在内核里做的, 但DPDK可以把它移到应用层来做,DPDK使用UIO机制使网卡驱动程序(主要是intel自身的千兆igb与万兆ixgbe驱动程序)运行在用户态(驱动拿数据,绕过内核,跑在用户态,避免核心态到用户态的拷贝),并采用轮询和零拷贝方式从网卡收取报文,提高收发报文的效率。
HUGEPAGE的主要好处是通过利用大内存页提高内存的访问效率,DPDK在HUGEPAGE机制上构建内存管理系统,提高应用程序处理报文的性能。
CPU Affinity机制主要是让各个CPU各自干自己的事情,DPDK使用CPU Affinity机制将控制面线程以及各个数据面线程绑定到不同的CPU核,避免线程核间切换开销,节省反复调度的性能消耗。其工作模式类似于一个CPU核绑定一个死循环线程,专心处理各自的业务。比如两个网卡eth0和eth1都收包,可以让cpu0专心处理eth0,cpu1专心处理eth1,没必要cpu0一下处理eth0,一下又处理eth1,这样就提高了多核CPU的使用效率。