Pro Yearly is on sale from $80 to $50! »

TBD

 TBD

Closing day talk I gave at RubyC in Kiev: http://rubyc.eu/

Further read:
- The Flame Graph: http://queue.acm.org/detail.cfm?id=2927301
- flamegraph gem: https://github.com/SamSaffron/flamegraph
- rack-mini-profiler: https://github.com/MiniProfiler/rack-mini-profiler
- ruby-prof-flamegraph: https://github.com/oozou/ruby-prof-flamegraph

5a5fcbae333f071dc7a28f4958509db5?s=128

Miha Rekar

June 04, 2016
Tweet

Transcript

  1. @mr_foto If you can read this you’re too close TBD

  2. TO BE DETERMINED T B D @mr_foto

  3. TO BE DETERMINED T B D

  4. None
  5. None
  6. None
  7. [YOU] [PARTY]

  8. WHOIS ! Software Developer

  9. WHOIS ! Software Developer " Ruby Slovenia organizer

  10. WHOIS ! Software Developer " Ruby Slovenia organizer # Long

    Distance Runner
  11. WHOIS ! Software Developer " Ruby Slovenia organizer # Long

    Distance Runner $ Event Photographer
  12. WHOIS ! Software Developer " Ruby Slovenia organizer # Long

    Distance Runner $ Event Photographer ☕ Coffee Connoisseur
  13. WHOIS ! Software Developer " Ruby Slovenia organizer # Long

    Distance Runner $ Event Photographer ☕ Coffee Connoisseur & Special
  14. FLAME GRAPHS

  15. WHY AND WHAT • How SW is consuming CPU •

    DTrace is verbose and unreadable • Brendan Gregg • combine stack traces with common paths
  16. None
  17. None
  18. None
  19. 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
  20. MOAR EXPLAINING Function

  21. MOAR EXPLAINING Function

  22. MOAR EXPLAINING Stack Depth

  23. MOAR EXPLAINING Stack Depth

  24. MOAR EXPLAINING Stack Depth

  25. MOAR EXPLAINING Ordered by Alphabet

  26. MOAR EXPLAINING Total Time on CPU

  27. MOAR EXPLAINING Total Time on CPU

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

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

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

  31. Q&A A: a() → b() → c() → e() →

    f() f() was called by e(), e() was called by c(),…
  32. Q&A Q: How does b() compare to g()?

  33. Q&A A: b() looks like it is running (present) about

    10 times more often than g()
  34. Q&A Q: Why are we running f()?

  35. Q&A A: code path branches can reveal key functions:
 a()

    choose the b() path
 c() choose the e() path look for branches
  36. FOR REAL

  37. REAL WORLD EXAMPLE • Sam Saffron • gem 'flamegraph' Flamegraph.generate(filename)

    do # your work here end
  38. 1.083 (± 0.0%) i/s - 33.000 in 30.861265s ORIGINAL

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

    CACHE KRAMDOWN
  40. 10.140 (± 9.9%) i/s - 292.000 in 30.025553s | 9.4x

    improvement MEMOIZATION & CO.
  41. FURTHER READ • The Flame Graph
 http://queue.acm.org/detail.cfm?id=2927301 • flamegraph gem


    https://github.com/SamSaffron/flamegraph • rack-mini-profiler
 https://github.com/MiniProfiler/rack-mini-profiler • ruby-prof-flamegraph
 https://github.com/oozou/ruby-prof-flamegraph
  42. None
  43. http://mr.si/
 @mr_foto THANK YOU http://rug.si/
 @RubySlovenia

  44. None