DPDK Slab Allocator and applied it to zero-copy stack

展开查看详情

1. x DPDK Slab Allocator and zero-copy LINGJUN.ZHU ALIBABA

2.Topics • Why we need DPDK Slab? • How does DPDK Slab work? • Performance • Applied it to zero-copy 2

3.Why we need DPDK Slab? • rte_malloc / rte_free  unfixed-size buffer  spinlock for multi-thread  lowest performance 3

4.Why we need DPDK Slab? • Mempool  fixed-size buffer  No spinlock for multi-thread  Best performance 4

5.Why we need DPDK Slab? • DPDK application’s requirements:  unfixed-size buffer  No spinlock for multi-thread  Best performance 5

6.How does DPDK Slab work? • DPDK Slab supports the below features:  unfixed-size buffer  No spinlock for multi-thread  Meta information  Get meta info from any address 6

7.How does DPDK Slab work? 7

8.How does DPDK Slab work? • DPDK Slab API interfaces: • DPDK zbuf API interfaces: 8

9.DPDK Slab Vs Rte_malloc rte_slab_malloc Vs rte_malloc rte_slab_free Vs rte_free Allocate Lantency Free Lantency Alloc 1000 Times (Time: us) Free 1000 Times (Time: us) 120 700 100 600 80 500 400 60 300 40 200 20 100 0 0 512 1024 2048 4096 8192 512 1024 2048 4096 8192 Alloc Memory Size (Size: B) Free Memory Size (Size: B) rte_malloc rte_slab_malloc rte_free rte_slab_free rte_slab_malloc better than rte_malloc: 75% rte_slab_free better than rte_free: 90% 9

10. DPDK Slab Vs Mempool rte_slab_malloc Vs rte_mempool_get rte_slab_free Vs rte_mempool_put Allocate Lantency Free Lantency 1000次释放时间 单位:微妙us Alloc 1000 Times (Time: us) 30 30 25 25 20 20 15 15 10 10 5 5 0 0 512 1024 2048 4096 8192 512 1024 2048 4096 8192 释放内存大小 单位:字节B Allocate Memory Size (Size:B) rte_mempool_put rte_slab_free rte_mempool_get rte_slab_malloc Note: mempool no-local cache rte_slab_malloc worse than rte_mempool_get: 27% rte_slab_free worse than rte_mempool_put: 28% 10

11.Applied DPDK Slab to zero-copy Zero Copy Application • zero-copy from application, Luna Stack, DPDK to NIC. Tx Rx It’s not DPDK to NIC. Alibaba Luna Stack Latency Rte Zbuf • 1/3 kernel TCP • nearly as fast as RDMA Rte slab library DPDK PMD Driver NIC 11

12.Q&A 12

13.“ Thank You! ”