Peter Zhu
Posts
-
2024-07-09 •
Peter Zhu
Finding Memory Leaks in the Ruby Ecosystem
Until recently, Ruby lacked a mechanism for detecting native-level memory leaks from within Ruby and native gems. This meant that it was hard to analyze Ruby applications that suffered from memory leaks, causing them to consume increasing amounts of memory until the system runs out and terminates the application. In this blog post, we'll be looking at the RUBY_FREE_AT_EXIT feature, which allows memory leak checkers to find memory leaks in Ruby and in native gems. -
2024-04-24 •
Peter Zhu
Autotuner: How to Speed Up Your Rails App
Ruby's garbage collector is designed to be adaptable, scaling from short Ruby scripts to running apps that serve millions of requests per second. While it's designed to be adaptable, it may not work optimally for every use case. For this reason, Ruby's garbage collector supports many parameters that can be used to tune it. However, the use of these parameters requires knowledge into how the garbage collector works on the inside. Learn how the Autotuner gem can analyze your app's traffic and provide suggestions for tuning the garbage collector. -
2023-08-08 •
Peter Zhu
Two Garbage Collection Improvements Made Our Storefronts 8% Faster
At Shopify, we are constantly improving the performance of Ruby for everyone. Based on analysis of and experiments on one of our largest and highest traffic apps, we found two improvements in Ruby's garbage collector that significantly improved our garbage collector performance, which in turn reduced our response times by 8%. -
2023-06-16 •
Peter Zhu
Open Sourcing Shopify's Ruby Builds
We’ve open sourced shopify-ruby-definitions, which contains definitions to build the Ruby we use at Shopify in development, testing, and production. Our builds of Ruby are API compliant with the vanilla Rubies, but with additional bug fixes and performance improvements we’ve backported from the next major version.
-
2023-06-08 •
Peter Zhu
Automatically Find Memory Leaks in Native Gems
It's not uncommon for Rails developers to encounter memory leaks, which causes the system to run out of memory and kill the app. Often, this is caused by native gems that forgot to clean up memory. Let's fix this problem using ruby_memcheck, a gem that automatically finds memory leaks in native gems.