rbperf: Understanding Ruby with BPF Javier Honduvilla Coto - - PowerPoint PPT Presentation

rbperf understanding ruby with bpf
SMART_READER_LITE
LIVE PREVIEW

rbperf: Understanding Ruby with BPF Javier Honduvilla Coto - - PowerPoint PPT Presentation

rbperf: Understanding Ruby with BPF Javier Honduvilla Coto <javierhonduco@fb.com> October 28th-29th, 2020 Why BPF? Why BPF? - Flexibility Why BPF? - Flexibility - Low overhead Why BPF? - Flexibility - Low overhead - Continuous


slide-1
SLIDE 1

rbperf: Understanding Ruby with BPF

Javier Honduvilla Coto <javierhonduco@fb.com>

October 28th-29th, 2020

slide-2
SLIDE 2

Why BPF?

slide-3
SLIDE 3

Why BPF?

  • Flexibility
slide-4
SLIDE 4

Why BPF?

  • Flexibility
  • Low overhead
slide-5
SLIDE 5

Why BPF?

  • Flexibility
  • Low overhead
  • Continuous profiling
slide-6
SLIDE 6

Why BPF?

  • Flexibility
  • Low overhead
  • Continuous profiling
  • No modifications of the tracee
slide-7
SLIDE 7

rbperf

slide-8
SLIDE 8

rbperf

  • Profile Ruby programs
slide-9
SLIDE 9

rbperf

  • Profile Ruby programs
  • Trace complex Ruby programs execution
slide-10
SLIDE 10

rbperf – on-CPU profiling

  • $ rbperf record --pid=124 cpu
  • $ rbperf report [...]
slide-11
SLIDE 11

rbperf – Rails on-CPU profile

slide-12
SLIDE 12

rbperf – tracing write(2) calls

  • $ rbperf record \
  • -pid=124 event \
  • -tracepoint=syscalls:sys_enter_write
  • $ rbperf report [...]
slide-13
SLIDE 13

Architecture

  • 2. Event

(timer, syscall, etc) BPF code (bpf/rbperf.c) Read frame Driver (rbperf.py)

  • 1. Adds info

(pid to profile, thread address)

  • 3. Receives stacktrace
  • 4. Serialisation

and persistence BPF tail-calls Bounded loop

slide-14
SLIDE 14

Challenges

  • Implementing the stack walking for a dynamic language
slide-15
SLIDE 15

Challenges

  • Implementing the stack walking for a dynamic language
  • Supporting multiple Ruby versions
slide-16
SLIDE 16

Challenges

  • Implementing the stack walking for a dynamic language
  • Supporting multiple Ruby versions
  • Correctness testing
slide-17
SLIDE 17

Challenges

  • Implementing the stack walking for a dynamic language
  • Supporting multiple Ruby versions
  • Correctness testing
  • BPF safety features
slide-18
SLIDE 18

Future plans

  • Integrate in Facebook’s profiling infra
  • Rewrite OSS driver program
  • Make the OSS version awesome
  • Better documentation (including how to measure overhead)
  • Add more output formats
  • Open source GDB / drgn helper
  • Other tools?
  • Containers support?
  • Support request-oriented workloads?
slide-19
SLIDE 19

Thanks! :)

https://github.com/facebookexperimental/rbperf

javierhonduco@fb.com @javierhonduco