Slide 1

Slide 1 text

! @mr_foto

Slide 2

Slide 2 text

COMING HERE

Slide 3

Slide 3 text

COMING HERE

Slide 4

Slide 4 text

COMING HERE

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

WHOIS @mr_foto # Software Developer $ Ruby Slovenia organizer % Long Distance Runner & Event Photographer ☕ Coffee Connoisseur ⌨ Keyboard Enthusiast ) Special

Slide 7

Slide 7 text

*FLAME GRAPHS*

Slide 8

Slide 8 text

WHY AND WHAT • Interactive visualization of stack traces • From beginners to experts • Can be used for many things • How SW is consuming CPU • Brendan Gregg

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

FLAME GRAPHS EXPLAINED • each box represents a function (a merged stack frame) • y-axis (vertical) shows stack depth • top function led directly to the profiling event • everything beneath it is ancestry (explains why) • x-axis (horizontal) shows the sample sorted alphabetically • box width shows the total time it was on-CPU

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

SAMPLING • Time interval • Observe what’s going on • Which action caused current action • Real-world example

Slide 15

Slide 15 text

SAMPLING My Day Reading Emails

Slide 16

Slide 16 text

My Day Reading Emails Replying to Emails SAMPLING

Slide 17

Slide 17 text

My Day Writing Code SAMPLING

Slide 18

Slide 18 text

My Day Writing Code Writing Tests SAMPLING

Slide 19

Slide 19 text

My Day Writing Code Writing Tests Running Tests SAMPLING

Slide 20

Slide 20 text

My Day Writing Code Writing Tests Running Tests Fixing Tests SAMPLING

Slide 21

Slide 21 text

My Day Writing Code Running Tests SAMPLING

Slide 22

Slide 22 text

My Day Making Espresso SAMPLING

Slide 23

Slide 23 text

SAMPLING My Day Reading Emails

Slide 24

Slide 24 text

My Day Writing Code SAMPLING

Slide 25

Slide 25 text

My Day Writing Code Running Tests SAMPLING

Slide 26

Slide 26 text

My Day Reading Emails Replying to Emails SAMPLING

Slide 27

Slide 27 text

SAMPLING

Slide 28

Slide 28 text

GROUPING

Slide 29

Slide 29 text

GROUPING

Slide 30

Slide 30 text

GROUPING My Day Reading Emails Replying Writing Code ☕ Writing Tests Running Running Fix

Slide 31

Slide 31 text

MOAR EXPLAINING Function

Slide 32

Slide 32 text

MOAR EXPLAINING Stack Depth

Slide 33

Slide 33 text

MOAR EXPLAINING Stack Depth

Slide 34

Slide 34 text

MOAR EXPLAINING Ordered by Alphabet

Slide 35

Slide 35 text

MOAR EXPLAINING Total Time on CPU

Slide 36

Slide 36 text

Q&A Q: Which function is on CPU the most?

Slide 37

Slide 37 text

Q&A A: f() top edge shows what is on CPU directly

Slide 38

Slide 38 text

Q&A Q: Why is f() on CPU?

Slide 39

Slide 39 text

Q&A A: a() → b() → c() → e() → f() f() was called by e(), e() was called by c(),…

Slide 40

Slide 40 text

Q&A Q: How does b() compare to g()?

Slide 41

Slide 41 text

Q&A A: b() looks like it is running (present) about 10 times more often than g()

Slide 42

Slide 42 text

Q&A Q: Why are we running f()?

Slide 43

Slide 43 text

Q&A A: code path branches can reveal key functions:
 a() choose the b() path
 c() choose the e() path look for branches

Slide 44

Slide 44 text

FOR REAL

Slide 45

Slide 45 text

REAL WORLD EXAMPLE • Sam Saffron • gem 'flamegraph' Flamegraph.generate(filename) do # your work here end

Slide 46

Slide 46 text

1.083 (± 0.0%) i/s - 33.000 in 30.861265s ORIGINAL

Slide 47

Slide 47 text

8.368 (±12.0%) i/s - 244.000 in 30.037836s | 7.5x improvement CACHE KRAMDOWN

Slide 48

Slide 48 text

10.140 (± 9.9%) i/s - 292.000 in 30.025553s | 9.4x improvement MEMOIZATION & CO.

Slide 49

Slide 49 text

NOW WHAT? • You’re here • Ask me • Ask someone smarter than me • Ask anyone else • Read/watch blog posts/videos

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

http://mr.si/
 @mr_foto THANK YOU http://rug.si/
 @RubySlovenia