I upgraded my versions of Phusion Passenger and Ruby Enterprise Edition last night.
This morning, I noticed that Nagios was alerting me that the load average on one of my machines was in the warning range.
Turns out that on one of my virtual machines, I forgot to configure Apache to use my
ruby-wrapper script that sets environment variables for garbage collector tuning. Current versions of Ruby Enterprise Edition include the patches that support these tuning options. I knew that the tuning made a big difference but wow – check this out.
These are identical virtual machines on the same physical box that are receiving the same amount of traffic via round-robin load balancing. You can clearly see the ledge on Wednesday night when I performed the upgrade.
I haven’t experimented with the settings that we are using at all. I’m just using Twitter’s, because they were the first examples that were published and they made sense to me. An explanation of the options is here: http://railsbench.rubyforge.org/svn/tags/railsbench-0.8.3/GCPATCH
Here is my ruby-wrapper script:
#!/bin/sh export RUBY_HEAP_MIN_SLOTS=500000 export RUBY_HEAP_SLOTS_INCREMENT=250000 export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 export RUBY_GC_MALLOC_LIMIT=50000000 exec "/opt/ruby-enterprise-1.8.6-20090201/bin/ruby" "$@"