analyzing dpdk applications with ebpf
play

Analyzing DPDK applications with eBPF Sharpening the toolset - PowerPoint PPT Presentation

Analyzing DPDK applications with eBPF Sharpening the toolset Stephen Hemminger Fosdem, February 1, 2020 Microsoft 1 Table of Contents Introduction Packet Capture Tracing Lttng Bpftrace Performance Conclusion 2 Introduction Ancient


  1. Analyzing DPDK applications with eBPF Sharpening the toolset Stephen Hemminger Fosdem, February 1, 2020 Microsoft 1

  2. Table of Contents Introduction Packet Capture Tracing Lttng Bpftrace Performance Conclusion 2

  3. Introduction

  4. Ancient wisdom French proverb Mauvés ovriers ne trovera ja bon hostill Bad workers will never fjnd a good tool Chinese proverb To do a good job, a craftsman must sharpen his tools. 3

  5. Ancient wisdom French proverb Mauvés ovriers ne trovera ja bon hostill Bad workers will never fjnd a good tool Chinese proverb To do a good job, a craftsman must sharpen his tools. 3

  6. Methodology • Don’t focus on a tool set • Problem statement • Workload Characterization • USE • Utilization • Saturation • Errors See Linux tracing talks (Brendan Gregg et al) 4

  7. Methodology • Don’t focus on a tool set • Problem statement • Workload Characterization • USE • Utilization • Saturation • Errors See Linux tracing talks (Brendan Gregg et al) 4

  8. Methodology • Don’t focus on a tool set • Problem statement • Workload Characterization • USE • Utilization • Saturation • Errors See Linux tracing talks (Brendan Gregg et al) 4

  9. Methodology • Don’t focus on a tool set • Problem statement • Workload Characterization • USE • Utilization • Saturation • Errors See Linux tracing talks (Brendan Gregg et al) 4

  10. Methodology • Don’t focus on a tool set • Problem statement • Workload Characterization • USE • Utilization • Saturation • Errors See Linux tracing talks (Brendan Gregg et al) 4

  11. Capture vs Tracing 5 Capture DPDK Application pdump send ring receive tcpdump Tracing Tracer

  12. Packet Capture

  13. DPDK pdump • Packet copied and queued to ring • Secondary process sends to libpcap • Packets recorded in pcap format 6 DPDK Primary Application librte_pdump dpdk-pdump tool PCAP PMD dpdk_port0 capture.pcap Tra ffi c Generator

  14. Pdump limitations • No metadata (vlan, offmoad, ...) • Inaccurate timestamp • No direction information • Single port only • No fjltering • Poor performance 7

  15. Pdump limitations • No metadata (vlan, offmoad, ...) • Inaccurate timestamp • No direction information • Single port only • No fjltering • Poor performance 7

  16. Pdump limitations • No metadata (vlan, offmoad, ...) • Inaccurate timestamp • No direction information • Single port only • No fjltering • Poor performance 7

  17. Pdump limitations • No metadata (vlan, offmoad, ...) • Inaccurate timestamp • No direction information • Single port only • No fjltering • Poor performance 7

  18. Pdump limitations • No metadata (vlan, offmoad, ...) • Inaccurate timestamp • No direction information • Single port only • No fjltering • Poor performance 7

  19. Pdump limitations • No metadata (vlan, offmoad, ...) • Inaccurate timestamp • No direction information • Single port only • No fjltering • Poor performance 7

  20. PCAP Next Generation • Nanosecond resolution timestamp • System and Interface metadata • Multiple interfaces • Flags (direction, hash, ...) • Comments 8

  21. PCAP Next Generation • Nanosecond resolution timestamp • System and Interface metadata • Multiple interfaces • Flags (direction, hash, ...) • Comments 8

  22. PCAP Next Generation • Nanosecond resolution timestamp • System and Interface metadata • Multiple interfaces • Flags (direction, hash, ...) • Comments 8

  23. PCAP Next Generation • Nanosecond resolution timestamp • System and Interface metadata • Multiple interfaces • Flags (direction, hash, ...) • Comments 8

  24. PCAP Next Generation • Nanosecond resolution timestamp • System and Interface metadata • Multiple interfaces • Flags (direction, hash, ...) • Comments 8

  25. Packet fjltering with libpcap (003) jeq #0 (005) ret #65535 (004) ret jf 5 jt 4 #0x1f16168c [30] PCAP fjlter string: ip dst fosdem.org (002) ld jf 5 jt 2 #0x800 (001) jeq [12] (000) ldh cBPF program (6 insns): 9

  26. Packet fjltering cBPF ldw r0, [30] exit L10: mov32 r0, #0x1 L9: exit L8: mov32 r0, #0xffff L7: jne r0, #0x1f16168c, L9 L6: L5: Translated to eBPF jne r0, #0x800, L9 L4: ldh r0, [12] L3: mov r6, r1 L2: xor r7, r7 L1: xor r0, r0 L0: eBPF program (11 insns): 10

  27. Tracing

  28. Linux Trace toolkit • Easy to use • User Defjned Trace Points • Filtering • Common Trace Format • High performance 11

  29. Linux Trace toolkit • Easy to use • User Defjned Trace Points • Filtering • Common Trace Format • High performance 11

  30. Linux Trace toolkit • Easy to use • User Defjned Trace Points • Filtering • Common Trace Format • High performance 11

  31. Linux Trace toolkit • Easy to use • User Defjned Trace Points • Filtering • Common Trace Format • High performance 11

  32. Linux Trace toolkit • Easy to use • User Defjned Trace Points • Filtering • Common Trace Format • High performance 11

  33. Adding lttng tracepoint tx_burst , int ret ; ret = rte_eth_tx_burst ( port , queueid , m_table , n ) ; tracepoint ( l3fwd , port , /∗ Send burst queueid , n , ret ) ; i f ( u n l i k e l y ( ret < n )) return 0; } >tx_queue_id [ port ] ; 12 uint16_t int of packets on an output i n t e r f a c e ∗/ s t a t i c i n l i n e send_burst ( struct >tx_mbufs [ port ] . m_table ; lcore_conf ∗qconf , uint16_t n , uint16_t port ) { struct rte_mbuf ∗∗m_table = qconf − queueid = qconf − ^^Irte_pktmbuf_free_bulk(&m_table [ ret ] , n − ret ) ;

  34. Using eBPF from userspace • Origin: dtrace • Adds NOP locations and ELF section • Run code at tracepoint • Prerequisites uprobe Linux 3.14 (or later) kernel sys/sdt.h systemtap-std-dev 13

  35. Using eBPF from userspace • Origin: dtrace • Adds NOP locations and ELF section • Run code at tracepoint • Prerequisites uprobe Linux 3.14 (or later) kernel sys/sdt.h systemtap-std-dev 13

  36. Using eBPF from userspace • Origin: dtrace • Adds NOP locations and ELF section • Run code at tracepoint • Prerequisites uprobe Linux 3.14 (or later) kernel sys/sdt.h systemtap-std-dev 13

  37. Using eBPF from userspace • Origin: dtrace • Adds NOP locations and ELF section • Run code at tracepoint • Prerequisites uprobe Linux 3.14 (or later) kernel sys/sdt.h systemtap-std-dev 13

  38. Using eBPF from userspace • Origin: dtrace • Adds NOP locations and ELF section • Run code at tracepoint • Prerequisites uprobe Linux 3.14 (or later) kernel sys/sdt.h systemtap-std-dev 13

  39. Using eBPF from userspace • Origin: dtrace • Adds NOP locations and ELF section • Run code at tracepoint • Prerequisites uprobe Linux 3.14 (or later) kernel sys/sdt.h systemtap-std-dev 13

  40. Adding DTRACE probes s t a t i c ^^ I ^^ I r e t u r n ; ( u n l i k e l y (nb_rx == 0)) i f nb_rx ) ; rx_burst , DTRACE_PROBE1( testpmd , nb_pkt_per_burst ) ; pkts_burst , ^^ I ^^ I ^^ I >rx_queue , >rx_port , packets . ∗/ of /∗ Receive a burst nb_rx ; i , uint16_t ∗pkts_burst [MAX_PKT_BURST] ; rte_mbuf struct { fwd_stream ∗ f s ) pkt_burst_receive ( struct void 14 nb_rx = rte_eth_rx_burst ( fs − fs −

  41. Looking for USDT Use bpftrace to look for tracepoints in application $ sudo bpftrace -l "usdt:./build/app/testpmd" usdt:./build/app/testpmd:testpmd:rx_burst 15

  42. Running bpftrace [4, 8) | 5333977 |@@@@@@@@@@@@@@@@@ [32, 64) | 0 | [16, 32) | 0 | [8, 16) | 0 | | Build a histogram of the number of packets per loop 0 | [2, 4) | 0 | [1] 16001930 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@| [0] @: ^C Attaching 1 probe... { @ = hist(arg0); }' $ sudo bpftrace -e 'usdt:./build/app/testpmd:rx_burst 16

  43. Performance

  44. Caveats • Limited hardware - x85 with 25G NIC • One ofg test • Untuned • Limited scope • Testpmd - 64 byte packets • Immediate drop • Current DPDK 19.11 • Single queue active 17

  45. Caveats • Limited hardware - x85 with 25G NIC • One ofg test • Untuned • Limited scope • Testpmd - 64 byte packets • Immediate drop • Current DPDK 19.11 • Single queue active 17

  46. Caveats • Limited hardware - x85 with 25G NIC • One ofg test • Untuned • Limited scope • Testpmd - 64 byte packets • Immediate drop • Current DPDK 19.11 • Single queue active 17

  47. Caveats • Limited hardware - x85 with 25G NIC • One ofg test • Untuned • Limited scope • Testpmd - 64 byte packets • Immediate drop • Current DPDK 19.11 • Single queue active 17

  48. Caveats • Limited hardware - x85 with 25G NIC • One ofg test • Untuned • Limited scope • Testpmd - 64 byte packets • Immediate drop • Current DPDK 19.11 • Single queue active 17

  49. Caveats • Limited hardware - x85 with 25G NIC • One ofg test • Untuned • Limited scope • Testpmd - 64 byte packets • Immediate drop • Current DPDK 19.11 • Single queue active 17

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend