Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
On Sept 4th 2020, I got pinged on a revert PR to fix a 150% slowdown on the Shopify monolith. It was a two-line change reverting the addition of a Sorbet signature on a Shop method, implicating Sorbet as the suspect. That was the start of a journey that took me through a deeper understanding of the Sorbet, Rails and Ruby codebases. The fix is in Ruby 3.0 and I can sleep better now. This talk will take you on that journey with me. Along the way, you will find tools and tricks that you can use for debugging similar problems. We will also delve into some nuances of Ruby, which is always fun.
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
The video titled "The Curious Case of the Bad Clone" features Ufuk Kayserilioglu's investigation into a performance issue experienced by the Shopify monolith, specifically a 150% slowdown linked to a Sorbet signature in Ruby. This journey illustrates the intricacies of debugging in the Ruby, Rails, and Sorbet ecosystems. Ufuk meticulously outlines the steps taken to identify the culprit behind the slowdown, detailing how a seemingly innocuous Sorbet signature was implicated. **Key points discussed include:** - **Initial Performance Investigation:** The issue arose when a performance hit from 100 to 250 milliseconds was reported due to a newly added Sorbet signature, which prompted further investigation. - **Understanding Sorbet:** Sorbet is described as a gradual type checker for Ruby. Ufuk discusses how its runtime component allows type validation, which was essential for understanding the slowdown. - **Ruby's `method_added` Hook:** The presentation dives into the `method_added` hook and how it relates to performance when new methods are defined, particularly those triggering type validations at runtime. - **Identifying the Performance Impact:** Through profiling, Ufuk discovered that multiple unnecessary calls to `method_added` resulted in significant overhead. The method's behavior during cloning operations was examined as it contributed to the slowdown. - **Collaboration with Experts:** Ufuk highlights his discussions with Rafael Franca, an expert in Rails internals, to uncover deeper issues related to Active Support's callback methods that were impacting performance. - **Root Cause Analysis:** The investigation led to the discovery of a flaw in the Ruby cloning mechanism, specifically concerning Singleton classes. This flaw caused unexpected behavior when cloning objects, leading to performance degradation. - **Resolution in Ruby 3.0:** The findings culminated in a pull request that addressed these issues, resulting in a fix for Ruby 3.0, showcasing the collaborative aspect of debugging and enhancing performance in open-source communities. - **Conclusion:** The session wraps up by discussing how the changes implemented improved the performance and reliability of Ruby applications. The overall experience emphasizes the importance of detailed investigation, community collaboration, and understanding of underlying mechanisms in coding frameworks.
Suggest modifications
Cancel