If you ever coded with Ruby on Rails, you probably are already aware that Garbage Collector is its Achilles’ heel. Though it has been significantly improved through the last couple of years, it still has plenty room for improvement. It is hard to find a Ruby app that would be happy with default Garbage Collector settings. To help you with this, we decided to share with a pretty handy tool called TuneMyGC. Learn about it now!

What is TuneMyGC?

TuneMyGC is a product designed to provide repeatable and systematic tuning process of Garbage Collector in order to make your development faster and more enjoyable. It works as a lightweight agent, which suggests GC configuration and additional tips and insights. Sounds pretty good. But how does it work?

Have a look at rough scheme of its interaction with your application.


Why should I use TuneMyGC?

If your are still a bit skeptic about this product, have a look at the main benefits it brings about:

  1. Faster boot times
  2. Less major GC cycles during requests
  3. Less worst case memory usage
  4. No need to keep up to date with the C Ruby GC

And here’s comparison of GC default settings to suggested TuneMyGC ones:


As you see, TuneMyGC is a real treasure for those, who are looking for ways to improve the performance. Let’s see how to install it.

How to install TuneMyGC?

Luckily, installing TuneMyGC isn’t a lot of pain. Just follow the instruction.

  1. Add it to your Gem file[ruby]gem ‘tunemygc'[/ruby]
  2. Register your app[shell]$ bundle exec tunemygc -r [email protected]#Application registered. Use RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d51 in your environment.
  3. Boot the application. Recommended Garbage Collector configurations will be provided in a report after it ends.[shell]
    $ RUBY_GC_TOKEN=08de9e8822c847244b31290cedfc1d51 RUBY_GC_TUNE=200 bundle exec rails s

As you see, al work would take you less than 15 minutes, but as a result you will get GC configurations that work best specifically for your app.

We, Rubyroid Labs Team, highly recommend using this gem for optimization. And how do you cope with Ruby Garbage Collector? Share with us in the comments!

How useful was this post?

Click on a star to rate it!

Average rating 4.9 / 5. Vote count: 21

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?


Daria Stolyar is a Marketing Manager at Rubyroid Labs. You can follow her at Linkedin.

Write A Comment

https://ftp.scala-sbt.org slot gacor https://rumblr.zedge.net game slot online Slot88 https://olympics.cybintsolutions.com slot deposit pulsa tanpa potongan