Get an improved navigation experience with a Chrominium based browser.
Dismiss
Ruby Video
Talks
Speakers
Events
Leaderboard
Sign in
Talks
Speakers
Events
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
Parallelizing tests is an opportune way of reducing the total runtime for a test suite. Rails achieves this by forking multiple separate workers that fetch tests from a queue. In Ruby 3, Ractors introduced new mechanisms for executing code in parallel. Can they be leveraged by a test framework? And how would that compare to current parallelization solutions? Let’s find the answers to these questions by building a test framework built on Ractors, from scratch. We’ll compare the current solutions for parallelization and what advantages or limitations Ractors bring when used in this context.
Date
Summary
Markdown supported
In the talk titled **"Parallel Testing with Ractors - Putting CPU's to Work,"** Vinicius Stock explores the use of Ractors in Ruby 3 for parallel test execution, a solution aimed at speeding up test suite runtimes. The session commences with an overview of Ractors, which were introduced in Ruby 3 to enable parallel execution. Vinicius proposes to build a testing framework utilizing Ractors while comparing it to existing parallelization methods. **Key Points Discussed:** - **Test Execution Strategies:** Vinicius outlines three approaches to parallelizing test execution: - **Grouping:** Tests are divided into groups assigned to different workers. However, this can lead to uneven workload distribution. - **Queue:** A queue system allows workers to pull tests dynamically, optimizing resource use. - **Work Stealing:** Workers can take tasks from busy peers to better balance the load. - **Current Parallelization Solutions:** The traditional approach, as seen in Rails, utilizes forking processes for parallel test execution, employing a shared queue managed by a separate process for inter-process communication. - **Ractors Architecture:** Ractors facilitate message passing and allow for the creation of worker pools. Vinicius demonstrates creating a test framework that uses a queue and Ractors for running tests. He emphasizes the improved communication efficiency and reduced overhead when using Ractors compared to traditional queue methods. - **Building the Framework:** Vinicius walks through implementing essential components of a test framework: - Execution control, utilities for assertions, and reporting mechanisms. - Challenges encountered, such as class variables and scope limitations within Ractors that necessitate the creation of multiple reporters for accurate test aggregation. - **Performance Comparison:** Initial tests indicate that Ractors outperform process-based solutions for smaller test suites due to reduced setup time, yet the performance difference diminishes as the suite size increases. - **Conclusion:** The parallel testing framework using Ractors not only enhances speed and utilizes CPU resources better but also allows for testing applications that create additional Ractors. Despite some limitations and bugs encountered during the demonstration, Vinicius encourages exploration of Ractors in development tools. Overall, the talk provides a thorough exploration of the applicability of Ractors for parallel testing, showcasing a practical test framework implementation, while highlighting the benefits and limitations of this approach in Ruby development.
Suggest modifications
Cancel