news.volyx.in

Making the Tokio scheduler 10x faster (tokio.rs)

813 points by steveklabnik · 2558 days ago · 148 comments on HN

Article summary

The article discusses the improvements made to the Tokio scheduler, a Rust asynchronous runtime, which resulted in a 10x speedup. The new scheduler implementation focuses on reducing overhead and improving performance. The article also covers the design of the scheduler, including the use of a work-stealing algorithm and the importance of minimizing synchronization. The improvements are expected to benefit use cases like Hyper and Tonic.

Main themes

  • Scheduler Design
  • Work-Stealing Algorithm
  • Concurrency
  • Performance Optimization
  • Rust Async Runtime

What commenters say

  • The benchmark results show that the improved scheduler can handle a high volume of requests, but may be limited by network bandwidth.
  • Preemptive scheduling is not currently planned for Tokio, as it focuses on cooperative preemption via await points.
  • Some commenters question the need for multiple processors, suggesting that a single-threaded scheduler could be sufficient.
  • The use of a custom AtomicU32 in the loom library is necessary to achieve the desired performance and safety guarantees.
  • The article's discussion of mechanical sympathy and hardware utilization is relevant to the design of high-performance concurrent systems.
  • The trade-offs between fairness, simplicity, and performance in scheduler design are complex and depend on the specific use case.
  • The idea of preempting syscalls or FFI calls is challenging and may require significant performance penalties or complex implementation techniques.