| 研究生: |
汪宗諺 Wang, Tsung-Yen |
|---|---|
| 論文名稱: |
Rust 程式的非同步執行內容之追蹤方法論 Tracing Asynchronous Execution Contexts for Rust Programs |
| 指導教授: |
涂嘉恒
Tu, Chia-Heng |
| 學位類別: |
碩士 Master |
| 系所名稱: |
電機資訊學院 - 資訊工程學系 Department of Computer Science and Information Engineering |
| 論文出版年: | 2022 |
| 畢業學年度: | 110 |
| 語文別: | 英文 |
| 論文頁數: | 52 |
| 中文關鍵詞: | Rust 程式語言 、效能分析/追蹤 、程式語言非同步模型 、效能分析/追蹤工具 |
| 外文關鍵詞: | Rust Programming Language, Performance Profiling/Tracing, Asynchronous Programming Model, Performance Profiling/Tracing Tool |
| 相關次數: | 點閱:144 下載:16 |
| 分享至: |
| 查詢本校圖書館目錄 查詢臺灣博碩士論文知識加值系統 勘誤回報 |
隨著高效能程式的發展, 如何充分的利用硬體資源也成為了一個相當重要的主題,
Rust 程式語言提供了非同步的執行模型 來幫助我們更加善用硬體資源, 但因為非
同步執行模型的使用, 開發人員在實際了解程式行為和效能分析上十分困難, 因此我
們提出了一套方法論以及相對應框架的實作來解決這些問題。本論文建構了一套對
使用者友善且自動化的方法來追蹤與分析使用非同步模型的 Rust 程式。基於現有的
追蹤工具 uftrace 以及視覺化工具 Traceviewer , 並搭配本論文中依據 futurers
執行模型所建立的解析程式, 可以產生出 Rust 非同步程式碼的追蹤結果。利用這
個追蹤的結果, 開發人員能夠觀察採用不同的 Rust async runtimes 的程式在非同
步模型下的行為, 發現因為誤用非同步模型而造成的非預期行為, 同時開發人員也能
夠利用它快速的找出一些潛在效能問題, 像是 “Blocking Issue” 或者平行度不佳的
情況。總結來說, 本論文提出了一套追蹤 Rust 非同步程式內容的方法與實做, 利用
uftrace 動態追蹤的方式以及自動化的插入程式碼, 且利用 statemachine based 的解
析程式解析追蹤資料。利用我們們實做的框架, 開發者可以快速的觀察到非同步程式
碼的執行行為, 同時也可以發現因為使用非同步程式模型產生的潛在效能問題像是
“Blocking Issue” 以及平行度不佳等問題。
With the development of high-performance applications, getting the most out of the hardware resources become an important topic, Rust programming language provides the asynchronous programming model to let the developers get the most out of the hardware resources. However, because of the usage of the asynchronous programming model, it is hard to understand the asynchronous execution context and the performance of the program. Hence, we propose a tracing methodology and the implementation of the framework to solve these problems. In this thesis, we propose a userfridenly and automatic tracing methodology to trace the asynchronous context of Rust programs. The tracing framework is based on the opensource tracing tool uftrace and visualization tool Traceviewer, simultaneously integrating them with a parser that is constructed from the library “futurers”. With the tracing results, we can get the real behavior of the asynchronous execution context (i.e. whether a future is polled expectedly or not). Furthermore, we can see if there are any potential points
for performance improvement such as the “Blocking Issue” or the poor parallelism with the tracing result as well. In summary, we propose a tracing methodology and its corresponding implementation for Rust asynchronous execution context tracing. The implementation of our tracing framework leverages uftrace for instrumenting the programs dynamically and automatically and uses a statemachine based parser to process the tracing data. So the developers can use our framework to observe the behavior of async context rapidly and find out potential performance issues such as “Blocking Issue” and poor parallelism.
[1] Asynchrony. [Online]. Available: (computer_programming) https://en.wikipedia.org/wiki/Asynchrony_
[2] Uftrace function graph tracer for c/c++/rust. [Online]. Available: https://github.com/
namhyung/uftrace
[3] Traceviewer analysis and visualization tool. [Online]. Available: http://google.
github.io/traceviewer/
[4] Futures and promises. [Online]. Available: https://en.wikipedia.org/wiki/Futures_and_
promises
[5] The async ecosystem. [Online]. Available: https://rustlang.github.io/asyncbook/08_
ecosystem/00_chapter.html
[6] A. Ryhl, “Async: What is blocking?” 2020. [Online]. Available: https://ryhl.io/blog/asyncwhatisblocking/
[7] Executors and system io. [Online]. Available: https://rustlang.github.io/asyncbook/
02_execution/05_io.html
[8] Gecko. [Online]. Available: https://en.wikipedia.org/wiki/Gecko_software
[9] Firefox. [Online]. Available: https://en.wikipedia.org/wiki/Firefox
[10] Amazon s3. [Online]. Available: https://aws.amazon.com/s3/
[11] Aws. [Online]. Available: https://en.wikipedia.org/wiki/Amazon_Web_Services
[12] cloudflare. [Online]. Available: https://en.wikipedia.org/wiki/Cloudflare
[13] zenoh. [Online]. Available: https://zenoh.io/
[14] Mozilla. [Online]. Available: https://zh.m.wikipedia.org/zhtw/Mozilla
[15] stackoverflow. [Online]. Available: https://stackoverflow.com/
[16] ownership. [Online]. Available: https://doc.rustlang.org/book/ch0401whatisownership.html
[17] Callback hell. [Online]. Available: http://callbackhell.com/
[18] Eclipse foundation. [Online]. Available: Foundation https://en.wikipedia.org/wiki/Eclipse_
[19] Data distribution services. [Online]. Available: https://en.wikipedia.org/wiki/Data_
Distribution_Service
[20] Message queing telemetry transport. [Online]. Available: https://en.wikipedia.org/
wiki/MQTT
[21] asyncstd. [Online]. Available: https://github.com/asyncrs/asyncstd
[22] tokio runtime. [Online]. Available: https://github.com/tokiors/tokio
[23] types-of-future. [Online]. Available: https://cfsamson.github.io/booksfuturesexplained/1_futures_in_rust.html
[24] epoll. [Online]. Available: https://en.wikipedia.org/wiki/Epoll
[25] kqueue. [Online]. Available: https://en.wikipedia.org/wiki/Kqueue
[26] Iocp. [Online]. Available: https://en.wikipedia.org/wiki/Input/output_completion_port
[27] Task wakeups with waker. [Online]. Available: https://rustlang.github.io/asyncbook/
02_execution/03_wakeups.html
[28] cppreference.com: std::async. [Online]. Available: https://en.cppreference.com/w/cpp/thread/async
[29] Net async tool. [Online]. Available: https://docs.microsoft.com/zhtw/visualstudio/
profiling/analyzeasync?view=vs2022
[30] chrome developer tool. [Online]. Available: https://developer.chrome.com/docs/devtools/
[31] asyncprofile. [Online]. Available: https://github.com/ConradIrwin/asyncprofile
[32] asyncio. [Online]. Available: https://docs.python.org/3/library/asyncio.html
[33] Panopticon. [Online]. Available: https://github.com/kunalb/panopticon
[34] go tool trace. [Online]. Available: https://github.com/golang/go/blob/master/src/runtime/trace/trace.go
[35] Perftool. [Online]. Available: https://perf.wiki.kernel.org/index.php/Main_Page
[36] flamegraphrs. [Online]. Available: https://github.com/flamegraphrs/flamegraph
[37] tokiotracing. [Online]. Available: https://github.com/tokiors/tracing
[38] opentelemetry. [Online]. Available: https://opentelemetry.io/
[39] tokioconsole. [Online]. Available: https://github.com/tokiors/console
[40] Implementation of our work. [Online]. Available: https://github.com/eddie9712/RustAsyncContextTracer
[41] stream trait. [Online]. Available: https://rustlang.github.io/asyncbook/05_streams/
01_chapter.html
[42] Flume channel. [Online]. Available: https://github.com/zesterer/flume
[43] Tokio tutorial. [Online]. Available: https://tokio.rs/tokio/tutorial