TuneMyGC optimal MRI Ruby 2.1+ Garbage Collection


How can I know the best GC settings for my Ruby app?

The Ruby garbage collector has been flagged as the crux of Ruby performance and memory use for a long time. It has improved a lot over the last years, but there's still a lot to tune and control. The default configuration is not suitable and optimal for most applications, and neither is there a one-size-fits-all set of tuned parameters that would suit every app. However, hand-tuning the GC parameters is a slippery slope to navigate for most developers.

We're fixing this.

Tunemygc graphic2x

1. Add to your Gemfile (and run bundle install)

gem 'tunemygc'

2. Register your Ruby application.

$ bundle exec tunemygc -r [email protected]
      Application registered. Use RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d51 in your environment.

3. Boot your app. We recommend an optimal GC config via a report when it ends

$ RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d51 RUBY_GC_TUNE=200 bundle exec rails s

Rails requests are instrumented by default, but ActiveJob, delayed_job, que, minitest, rspec and ad hoc Ruby scripts are also supported.

Discourse throughput: GC defaults VS TuneMyGC suggestions

Discourse bench

Performance and GC tips

We're slowly opening the curtains about the details behind TuneMyGC. Sign up for our Rails performance tips and TuneMyGC updates below.

Your email address will never be shared with any 3rd parties. No spam, ever.

Running on Heroku?

Our Heroku Addon recently entered beta - please do take it for a spin.

Running a metrics service or a platform provider?

We recently published a draft Protocol Specification for third party integrations. Please reach out to us for partnerships.