Hacker News new | past | comments | ask | show | jobs | submit login
TuneMyGC: Optimal MRI Ruby 2.1+ Garbage Collection (tunemygc.com)
82 points by vinnyglennon on March 6, 2015 | hide | past | favorite | 20 comments



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.


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...

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


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.


Hi Michael, it originally started with a focus on Rails only, but at the moment we also support test frameworks, pure Ruby (requires some minor work on the user end), ActiveJob and Sinatra soon. We'll rework the docs and landing page to reflect this. Thanks for your feedback.


Their github has all of the same info but also answers some very important questions about the service 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?


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.


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.


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


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


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


Thanks for flagging, we're looking into it.


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?


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.


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.


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.


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.


For the curious enter the following into your terminal

>java -XX:+AggressiveOpts -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions -XX:+PrintFlagsFinal -version

It will list about 700 options.


It is no different from the endless list of command line options for compilers.


To clarify my down-voted comment a bit: I think part of the problem is that GC tuning has become kind of a black art. It's hard to find documentation and advice to get good results. Tuning services like MySQL, Apache, Nginx is pretty straightforward; there's documentation, guides, tools and plenty of clear ways to monitor it. In my search for Ruby VM tuning, I've found only very technical guides or blog posts that involve a lot of steps, and are not focused on real-world experience.

That being said, I'd like to try this service, the guys behind it seem to really know what they are doing.


Thanks for the heads up. One of the biggest goals driving this service is the fact that an incredible amount of awesome is going into Ruby 2 releases. Yet it's not straightforward for everyone to keep up to date with developments and because GC is work in progress, it's going to be difficult to run apps with optimal settings, especially with upgrade paths etc. We worked on this to primarily bridge that gap.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: