

TuneMyGC: Optimal MRI Ruby 2.1+ Garbage Collection - vinnyglennon
https://tunemygc.com/

======
michaelmior
It would be nice to have some idea of how these optimized settings are
determined. It's also not clear to me if this is intended to work for any Ruby
code, or just rails apps. In any case, this seems pretty cool as I think many
(myself included) don't bother to even try to tune GC.

EDIT: I'd also like to see a privacy policy that talks about what data they
collect and how it's used.

~~~
pencilcheck
Looks like what they are collecting is in this array:

[TuneMyGc.walltime, TuneMyGc.peak_rss, TuneMyGc.current_rss, stage,
GC.stat.values_at(*stat_keys), GC.latest_gc_info, meta]

In this file: [https://github.com/bear-
metal/tunemygc/blob/70a02b9dd252c6f5...](https://github.com/bear-
metal/tunemygc/blob/70a02b9dd252c6f5d6909b05cf581bb72f8b7b3a/lib/tunemygc/snapshotter.rb)

Or in their protocol.md: [https://github.com/bear-
metal/tunemygc/blob/master/doc/proto...](https://github.com/bear-
metal/tunemygc/blob/master/doc/protocol.md)

~~~
methodmissing
Yes, what we wanted to communicate was that nothing proprietary to your app or
code gets sent on the wire. Just a few numbers about memory usage and heap
status the tuner analyses.

------
c3RlcGhlbnI_
Their github has all of the same info but also answers some very important
questions about the service [https://github.com/bear-
metal/tunemygc?](https://github.com/bear-metal/tunemygc?). Namely they tell
you that it sets a bunch of environment variables and they tell you what
information they collect.

What I want to know is why this needs to get recommendations from a web
service. Do they have to collect a bunch of data to learn good recommendations
for different situations? Isn't it much simpler to have an algorithm
optimizing the parameters locally, or does that take too long to learn good
values?

~~~
pmontra
Maybe the algorithm can make better recommendations using data from multiple
web apps but I suspect that it could be a commercial choice leading to a paid
service (think about NewRelic). It's completely legit, nevertheless I'll
prefer to keep my usage data inside my own box.

~~~
methodmissing
Yes, there's the ability to aggregate information from eg. several Unicorn
worker instances on the same box for the same app and distributed too, but
it's not exposed through the tuner, yet. That's a more accurate representation
of how the GC behaves across a stack. Nothing's set in stone, we're still
exploring and engaging for feedback.

------
kirillzubovsky
What kind of improvement are we looking at by tuning GC?

Is there a recommended app size /setup after which it actually makes sense to
bother with GC?

This all comes to mind because any extra dependencies in my app are an ongoing
pain in the ass; got plenty of those already. If this could give me a 20%
speed boost - hell yeah, I'll try that. If it's a 0.4% ... nope.

From the first glance, it seems easier to do nothing, than to try something
that may work.

just my 2c

~~~
pmontra
From their diagram about Discourse it seems it could be a 30% boost.

------
ernestsim
After syncing snapshots im getting (error: hostname "tunemygc.com" does not
match the server certificate) even after running certified-update

~~~
methodmissing
Thanks for flagging, we're looking into it.

------
psychometry
If I want to tune a Rails app on Heroku, would I need the add-on that's in
alpha testing or will the standalone gem work?

------
foz
It makes me think that there's something wrong with the Ruby VM when someone
has to offer a service like this. The Ruby community should expect great
performance out-of-the-box, and the VM should tune itself, automatically.

~~~
RussianCow
VM performance is hard. It took years and years and years for the HotSpot VM
to get as fast as it is now. Give it time.

~~~
riffraff
I might be out of date but every time I worked with the JVM I ended up with a
lot of command line params to tune the GC and other things.

VMs can tune themselves up to a point but there is always need to give them
some precise bounds/goals, methinks.

~~~
Twirrim
As good as Hotspot is, it still needs tuning. The simple truth is there isn't
a "one size fits all" solution for GC, it really depends on what you're doing
and how the performance characteristics fit in to it.

