Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Instrumenting Async Runtime
Search
mox692
December 15, 2024
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
64
Bug-Free Concurrency in Rust
kimuramotoyuki
0
44
Other Decks in Programming
See All in Programming
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
2
880
ジョジョの世界をXRで再現する
mofurune
0
160
Workers Cache を知る
syumai
0
360
作って学ぶSpring BootのAuto Configuration / JJUG Night Seminar 2026-10-19
rshindo
0
150
Rでドレミ/Do-Re-Mi_with_R
florets1
0
130
golang-bob.pdf
iwatsukayura
0
130
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Kaigi on Rails 2026, Tokyo, Japan
marcoroth
2
220
Simple Storage Service(S3) is not simple
iwatsukayura
0
290
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
190
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
390
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
KiroのSpecで「五目並べ」を作ってみる
satoshi256kbyte
1
380
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Design in an AI World
tapps
1
350
The Cost Of JavaScript in 2023
addyosmani
55
10k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
Designing for Performance
lara
612
70k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.9k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
We Have a Design System, Now What?
morganepeng
55
8.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.2k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
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!