Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Instrumenting Async Runtime
Search
mox692
December 15, 2024
Programming
140
0
Share
Instrumenting Async Runtime
This is a presentation I gave in the Rust.Tokyo conference 2024.
mox692
December 15, 2024
More Decks by mox692
See All by mox692
Implementing Async MPMC Channel in Rust
kimuramotoyuki
0
53
Bug-Free Concurrency in Rust
kimuramotoyuki
0
26
Other Decks in Programming
See All in Programming
Inside Stream API
skrb
1
590
RailsTokyo 2026#4: AI様があれば、 Hotwireの弱点は消えるか?
naofumi
5
1k
Modding RubyKaigi for Myself
yui_knk
0
860
OCRを使ってゲームのアイテムをデータ化する
kishikawakatsumi
0
130
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
600
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
210
開発体験を左右するライブラリの API 設計 - GraphQL スキーマ構築ライブラリから考える #tskaigi
izumin5210
2
1.5k
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
1.2k
LLM Plugin for Node-REDの利用方法と開発について
404background
0
150
New "Type" system on PicoRuby
pocke
1
430
ユニットテストの先へ:テスト技法で要求・仕様を整理するJava開発実践 / Beyond_Unit_Testing_Practical_Java_Development_Techniques_for_Organizing_Requirements_and_Specifications
shimashima35
0
330
net-httpのHTTP/2対応について
naruse
0
420
Featured
See All Featured
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
200
エンジニアに許された特別な時間の終わり
watany
107
240k
How to Ace a Technical Interview
jacobian
281
24k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
GraphQLとの向き合い方2022年版
quramy
50
15k
Paper Plane
katiecoart
PRO
1
51k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
720
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
470
Transcript
Instrumenting Async Runtime Rust.Tokyo 2024 Motoyuki Kimura 1
• Rust Developer 🦀 • Used to use Scala •
A organization member of tokio-rs Hi, I’m Motoyuki(@mox692) 👋 2
Agenda • Share my attempt for async runtime tracing ◦
Recap monitoring ecosystem in Async Rust ◦ What is runtime tracing? ◦ How does it works? ◦ Lessons, challenges 3
Monitoring is important 4
How to achieve a monitoring? • Logging (println!, log! etc…)
• Capture a backtrace • System metrics etc … 5
What about async Rust? 6
… Sometimes, a bit tricky 7
8 Async Task Task1 Task2 Execution
9 Async Task Task1 Task2 Execution .await .await .await
10 Async Task Task1 Task2 .await .await .await Task1 Task1
Task2 Task2
11
12
13
Are there any async-aware tools available today? 14
• Metrics • Tokio-console • Taskdump 15
16 Runtime Metrics
17
18
19
20 Task dump
21 Task dump
Would this be enough? 22
23 Case1: Tasks are not distributed Thread Core
24 Case2: Long running tasks
25 Case2: Long running tasks
26 Case3: Not sure what happens behind the scene 😇
27 • Async runtime tend to be a blackbox •
It would be cool if we have a tool that focuses on the event occurred in the runtime
Prior Art? 28
29
30
31 Goroutine Backtrace
32
33
34 It is integrated into the Java Virtual Machine (JVM)
and causes almost no performance overhead, so it can be used even in heavily loaded production environments.
Can we do something similar with Rust? 35
36
Let’s do a demo to see how it goes 37
Demo time 38
How does it work? 39
High level archtecture 40 Gathering Runtime Event Tokio Runtime Visualize
Log File Runtime thread Runtime thread Runtime thread
41 Runtime Event
42 Runtime Event Runtime Parking Run Task
43 Runtime Event Backtrace Task Name Duration
Visualize 44
Visualize 45
46
Tracing × Perfetto 47
48
49 Hacking Runtime Internal !
50
51
52 Trace Store backtrace
Challenges 53
Backtrace 54
55 Invoked for every task run!!
56 Backtrace • It is crucial to be able to
get backtraces efficiently, • Because the locations where traces are obtained are often hot paths in the runtime 🔥
57 🤔
58
59
60
61
62
Other Subtleties • Symbolize • When to capture a backtrace?
◦ For now, capture backtraces when a future returns Pending ◦ … but this means that we cannot capture a backtrace if that future complete at first poll 63
Trace Log 64
65
66 Trace related stuff
Can we do better? 67
68 Continuous Monitoring with JDK Flight Recorder (JFR)
69 Execution tracer overhaul
70 Trace Log • Should be optimized by e.g., ◦
Using thread local buffer ◦ Using a dedicated trace format
71
72 worker-trace.md
73 Thank you!