RustConf 2023 - Profiling async applications in Rust

Profiling async Rust apps can be complex. Learn how `diagnose` and tracing approaches provide accurate performance information and overcome profiling challenges.

Key takeaways
  • Profiling asynchronous Rust applications is complex due to the non-deterministic nature of asynchronous code.
  • The diagnose macro can be used to wrap futures and provide profiling information.
  • Traditional sampling profilers are not suitable for asynchronous code as they rely on sampling the execution of a program at specific points in time, which is not feasible in asynchronous code where the order of execution is dynamic.
  • Using a tracing approach to profile asynchronous code can provide more accurate information about the performance of the application.
  • Generating stable load for profiling purposes can be challenging and can lead to inconsistent results.
  • 51% of the main function time is spent in the extend function, while 49% is spent in the string concatenation.
  • Buffer extension is faster than string concatenation in this particular example.
  • Interactive profiling can be difficult due to the dynamic nature of asynchronous code and the need to handle a large number of threads and concurrent tasks.
  • The Tokyo runtime can hide information about the execution of the program, making it more difficult to profile.
  • Tracing can be used to profile asynchronous code and provide information about the performance of the application.
  • Flame graphs can be used to visualize the execution of the program and identify performance bottlenecks.
  • Interactive profiling can be challenging due to the need to handle a large number of requests and concurrent tasks.
  • The diagnose macro can be used to provide profiling information for futures and asynchronous code.
  • Widely using profiling tools can lead to better tooling and a more mature ecosystem.
  • Interactive profiling can provide insights into the performance of the application and help identify performance bottlenecks.
  • The diagnose macro can be used to provide information about the performance of asynchronous code and help identify performance bottlenecks.