inicio sindicaci;ón

thefjord.org

The official online Fjord

Archive for May, 2010

Default GC Parameters for Ruby Enterprise Edition

Update: I’ve posted some more info on how to go about tuning the garbage collector in Ruby Garbage Collector Tuning: A Walkthrough

After attending Ruby Nation (which was awesome) and hearing a couple talks on how Ruby’s garbage collection works, I’ve been playing around some with the GC settings that REE lets you tweak. I’m still experimenting with the best setup, but I do know that by setting RUBY_HEAP_MIN_SLOTS to 600,000 (the default is 10,000), the Birdstack code base loads with 1 heap slot allocation instead of 7.

So, that’s an obvious win, and I wanted to make sure that all my app servers used that setting. Unfortunately, there’s no easy way to do that. My first thought was to look for a Passenger option to set the environment for the REE instances it launches, but that setting doesn’t exist, and that wouldn’t cover my delayed_job process or the cron jobs that run.

My solution was to write a wrapper around the ruby program itself. You can’t use a script as an interpreter for a shebang line (#!) with kernels earlier than 2.6.27.9, so for my deployment, it needed to be in C. It’s a pretty trivial program, but it gets the job done and ensures that all my Ruby programs use the correct GC settings.


GitHub Gist: http://gist.github.com/412737

Add whatever other GC settings you’d like and modify the exec line to point to your real Ruby executable. To compile, just do ‘make ruby’.

Read up on the other REE settings in the REE documentation. Give it a few reads; the way the allocator works isn’t totally obvious. I also recommend the Engine Yard blog post on the MRI allocator.

Research Party!

Spence flew in Thursday night for our long-awaited Epic Research Party of Awesometude. Remember that Stockade Case thing we obsessively researched for an entire semester back in college and were going to write a book about? Well, it’s going to happen. It turns out that the National Archives in DC has all of the original copies of everything used in the trial, so we’re going to spend the next week researching and writing like crazy.

It’s pretty exciting to handle original documents from the 1860s. We’ve spent countless hours reading about the people involved in this crazy trial, and now we’re able to handle papers that they actually wrote on! Better yet, the things they wrote are pretty nuts. My advice: don’t mess with a Reconstruction-era disenfranchised Texan.

Bonus: we get to use locker #41 every day to store our stuff. :-)