1. On performance analyzing again:
Gathering and visualizing flamegraphs in
realtime in Linux environment
Alex Chistyakov, DataArt
Linux Piter 2016, Russia, SPb.
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 1 / 51
2. Who I am (very quickly)
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 2 / 51
• Senior SW Developer @ DataArt
• More than 18 years of professional experience
• Researcher @ ISST Lab, ITMO
• Used to be a DevOps Engineer and still probably am
• Can’t quit making presentations w/lots of bullets (that’s
terrible, I know)
3. Performance optimization is not that hard
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 3 / 51
4. Ever heard of a ’comfort zone’?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 4 / 51
• It’s crucial to be out of it to learn something new
5. Ever heard of a ’comfort zone’?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 5 / 51
• It’s crucial to be out of it to learn something new
• So I made this presentation in TeX
6. Ever heard of a ’comfort zone’?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 6 / 51
• It’s crucial to be out of it to learn something new
• So I made this presentation in TeX
• With lots of bullets, you know
7. Ever heard of a ’comfort zone’?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 7 / 51
• It’s crucial to be out of it to learn something new
• So I made this presentation in TeX
• With lots of bullets, you know
• Because I’m not ready yet to leave my comfort zone
entirely
8. Ever heard of a ’comfort zone’?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 8 / 51
• It’s crucial to be out of it to learn something new
• So I made this presentation in TeX
• With lots of bullets, you know
• Because I’m not ready yet to leave my comfort zone
entirely
• Damn, TeX seems to be my new comfort zone ;(
9. Okay, flashback to LP 2015 (w/no bullets)
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 9 / 51
10. Fast-forward to 2016
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 10 / 51
Brendan Gregg declared Linux DTrace-complete!
11. A great step forward for mankind...
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 11 / 51
...but I’m a cat
12. So, what is this all about?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 12 / 51
• Modern GNU/Linux
13. So, what is this all about?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 13 / 51
• Modern GNU/Linux
• A web application
14. So, what is this all about?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 14 / 51
• Modern GNU/Linux
• A web application
• Collecting flamegraphs
15. So, what is this all about?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 15 / 51
• Modern GNU/Linux
• A web application
• Collecting flamegraphs
• Visualizing collected flamegraphs
16. Okay, but what are these flame... things?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 16 / 51
Did you attend LP 2015?
17. Doing flamegraphs in 2016 is extremely easy
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 17 / 51
18. A hicker needs good boots
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 18 / 51
19. So, we need a language
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 19 / 51
20. The obvious choice
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 20 / 51
21. Why Lisp?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 21 / 51
• Homoiconicity
22. Why Lisp?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 22 / 51
• Homoiconicity
• Macros
23. Why Lisp?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 23 / 51
• Homoiconicity
• Macros
• Immutability (?)
24. Why Lisp?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 24 / 51
• Homoiconicity
• Macros
• Immutability (?)
• Lambdas
25. But that was not too democratic, so...
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 25 / 51
...what about Golang?
26. Unfortunately, Golang loses
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 26 / 51
• Way too modern (uses design ideas from 1970s while Lisp
was born in 1958)
27. Unfortunately, Golang loses
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 27 / 51
• Way too modern (uses design ideas from 1970s while Lisp
was born in 1958)
• Not functional enough (as in ’functional programming’)
28. Unfortunately, Golang loses
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 28 / 51
• Way too modern (uses design ideas from 1970s while Lisp
was born in 1958)
• Not functional enough (as in ’functional programming’)
• Targets Java 1.2 and PHP 4.x market share (designed for
apes not humans)
30. Runtime matters!
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 30 / 51
• Static linking is a must
• Decent GC is a must
31. Runtime matters!
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 31 / 51
• Static linking is a must
• Decent GC is a must
• Resulting files should not be too big
32. Runtime matters!
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 32 / 51
• Static linking is a must
• Decent GC is a must
• Resulting files should not be too big
• Let’s consider measureable things only
33. So, Lisps then
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 33 / 51
• Common Lisp
• Scheme
34. Common Lisp
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 34 / 51
Statically linked file is over 30Mb (Golang does around 8Mb)
35. Scheme
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 35 / 51
Is minimalist by design (way too minimalist I’d say)
36. So, no boots then?
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 36 / 51
37. Nim to the rescue!
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 37 / 51
Nim (formerly Nimrod)
38. Nim: the good parts
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 38 / 51
• Strong typing
39. Nim: the good parts
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 39 / 51
• Strong typing
• Static typing
40. Nim: the good parts
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 40 / 51
• Strong typing
• Static typing
• Homoiconicity
41. Nim: the good parts
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 41 / 51
• Strong typing
• Static typing
• Homoiconicity
• Macro system (hygienic)
42. Nim: the good parts
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 42 / 51
• Strong typing
• Static typing
• Homoiconicity
• Macro system (hygienic)
• Immutability
43. Nim: the good parts
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 43 / 51
• Strong typing
• Static typing
• Homoiconicity
• Macro system (hygienic)
• Immutability
• Templates (generics)
44. Nim: runtime goodness
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 44 / 51
• Uses C as an IR
45. Nim: runtime goodness
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 45 / 51
• Uses C as an IR
• Per thread GC (as in Erlang)
46. Nim: runtime goodness
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 46 / 51
• Uses C as an IR
• Per thread GC (as in Erlang)
• Statically linked files < 1Mb (not stripped)
47. Project Kaldur
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 47 / 51
• Means ’cold’ in Faroese
• Because it’s quite cold now
• https://github.com/alexclear/kaldur
48. Project Kaldur
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 48 / 51
• Is live at http://185.37.61.240:5000
• Has a TODO list on Github
• Has an issues list on Github
49. Conclusions
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 49 / 51
• TeX is great!
• Nim is great too!
• Flamegraphs are great!
• Linux is great!
• Open source projects are great!
51. So long, and thanks for all the fish
Alex Chistyakov, DataArt Gathering and visualizing flamegraphs in realtime 51 / 51
• achistyakov@dataart.com
• https://telegram.me/lhommequipleure