In 2023, the author discussed how Shopify’s Ruby monolith’s garbage collector was fine-tuned, implementing out-of-band garbage collection to reduce major collection latency impact. Despite massive latency improvements, the heuristics used were unsatisfactory, prompting the disabling of major GC entirely. A new feature was developed, preventing the automatic triggering of major collection during a request cycle. The implementation, released in Ruby 3.4.0-preview2, resulted in significant improvements in GC time, median latency, and overall service latency. The straightforward implementation utilized hooks from Pitchfork for effectiveness. Future steps involve optimizing minor collections to further reduce time spent in GC during requests.
https://railsatscale.com/2024-10-23-next-generation-oob-gc/