name: inverse layout: true class: center, middle, inverse --- #DPDK [@xiaomi.com] .footnote[sa-dev [yubo@xiaomi.com](mailto:yubo@xiaomi.com)] --- ## DPDK(Data Plane Development Kit)简介 --- layout: false .left-column[ ## What is it? ] .right-column[ 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. ```shell #linux -> remote linux $ping 10.235.99.38 PING 10.235.99.38 (10.235.99.38) 56(84) bytes of data. 64 bytes from 10.235.99.38: icmp_seq=1 ttl=64 time=0.425 ms 64 bytes from 10.235.99.38: icmp_seq=2 ttl=64 time=0.366 ms 64 bytes from 10.235.99.38: icmp_seq=3 ttl=64 time=0.469 ms 64 bytes from 10.235.99.38: icmp_seq=4 ttl=64 time=0.344 ms 64 bytes from 10.235.99.38: icmp_seq=5 ttl=64 time=0.350 ms #linux -> remote dpdk $ping 1.1.1.1 PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data. 64 bytes from 1.1.1.1: icmp_seq=1 ttl=64 time=0.108 ms 64 bytes from 1.1.1.1: icmp_seq=2 ttl=64 time=0.163 ms 64 bytes from 1.1.1.1: icmp_seq=3 ttl=64 time=0.083 ms 64 bytes from 1.1.1.1: icmp_seq=4 ttl=64 time=0.102 ms 64 bytes from 1.1.1.1: icmp_seq=5 ttl=64 time=0.112 ms ``` ] --- .left-column[ ## What is it? ## Main libraries ] .right-column[ - multicore framework - huge page memory - ring buffers - poll-mode drivers ] --- .left-column[ ## What is it? ## Main libraries ## Usage ] .right-column[ 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 ```shell #10 Gigabit Ethernet(10,000,000,000bps/14,880,952pps) 10,000,000,000(bps) / ((7+1+64+12)*8)(b/p) = 14,880,952 pps 14,880,952 * 80 hz = 1,190,476,190hz = 1.108GHz ``` ] --- .left-column[ ## What is it? ## Main libraries ## Usage ## What it is not ] .right-column[ 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. ] --- .left-column[ ## What is it? ## Main libraries ## Usage ## What it is not ## Tips ] .right-column[ - 避免上下文切换(中断/系统调用) - memory pool - poll-mode accesses the rx/tx descriptors directly without any interrupts - 解耦去锁 - ring buffers - Read/Write Splitting - atomic - other - huge page - NUMA ] --- ## dpdk在小米 - 2015-03-15 ~ 2015-12-23 mi_iptraffic `丁冠军` - 2015-06-03 ~ 2015-09-24 porpoise/listener `喻波` - 2016-04-12 ~ 2016-10-17 dpvs `喻波,黄骜哲` --- template: inverse ## dpvs(Data Plane Virtual Server)简介 --- name: how .left-column[ ## What is it? ] .right-column[ 基于[dpdk][dpdk_org]开发的类[lvs][lvs]负载均衡软件,并集成ospf协议 对tcp/fullnat的转发,vs_in()成功转发一个报文的平均cpu开销在4500cycle左右, 使用intel i7-4790的pc,单核理论最大值在0.85mpps左右 ] ---
--- ## FEATURE - runtime - interface - icmp, arp - route - syncookie/tcp - lvs - persistent - synproxy - fullnat - schedulers - tcp/udp - ospf support - dpdk - multicore framework - huge page memory - ring buffers - poll-mode drivers - other - non-blocking concurrent - memory pool - ipvsdm/keepalived support - config file parser(bison/flex) - package(rpm, deb) build support --- ## TODO - drop entry/drop packet - checksum in hardware - IPv6 support - mtu check/ip fragmentation --- ## References - [https://www.kernel.org/doc/htmldocs/uio-howto/index.html](https://www.kernel.org/doc/htmldocs/uio-howto/index.html) - [https://www.ibm.com/developerworks/cn/linux/kernel/interrupt/](https://www.ibm.com/developerworks/cn/linux/kernel/interrupt/) - [http://dpdk.org][dpdk_org] - [http://dpdk.org/doc/guides/prog_guide][grog_guide] - [http://dpdk.org/doc/guides/sample_app_ug/index.html][samples] ## Resources - [git://dpdk.org/dpdk](http://dpdk.org/browse/dpdk) - [git://dpdk.org/apps/pktgen-dpdk](http://dpdk.org/browse/apps/pktgen-dpdk/) --- template: inverse ## Thank You .footnote[sa-dev [yubo@xiaomi.com](mailto:yubo@xiaomi.com)] [lvs]:http://www.linuxvirtualserver.org/ [dpdk_org]:http://dpdk.org [grog_guide]:http://dpdk.org/doc/guides/prog_guide [samples]:http://dpdk.org/doc/guides/sample_app_ug/index.html [dpvs_img]:https://yubo.github.io/doc/img/dpvs.svg