Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add ruby gc wrapper recipe

  • Loading branch information...
commit efb7c2cf5da3ce4881c9c2721b013f8c5957c63f 1 parent 6ea642b
@jsierles authored
View
9 ruby/attributes/ruby.rb
@@ -0,0 +1,9 @@
+# twitter GC settings from http://blog.evanweaver.com/articles/2009/04/09/ruby-gc-tuning/
+default.ruby[:gc][:heap_min_slots] = 500000
+default.ruby[:gc][:heap_slots_increment] = 250000
+default.ruby[:gc][:heap_slots_growth_factor] = 1
+default.ruby[:gc][:malloc_limit] = 50000000
+default.ruby[:gc][:heap_free_min] = 4096
+default.ruby[:gc][:enabled] = true
+
+default.ruby[:bin_path] = ruby[:gc][:enabled] ? "#{ruby[:bin_dir]}/ruby_gc_wrapper" : "#{ruby[:bin_dir]}/ruby"
View
4 ruby/metadata.rb
@@ -0,0 +1,4 @@
+maintainer "Joshua Sierles"
+maintainer_email "joshua@diluvia.net"
+description "Configures ruby"
+version "0.2"
View
0  ruby/recipes/default.rb
No changes.
View
4 ruby/recipes/gc_wrapper.rb
@@ -0,0 +1,4 @@
+template "#{node[:languages][:ruby][:bin_dir]}/ruby_gc_wrapper" do
+ source "ruby_gc_wrapper.sh.erb"
+ mode 0755
+end
View
10 ruby/templates/default/ruby_gc_wrapper.sh.erb
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# wrap ruby with gc tuning parameters
+
+export RUBY_HEAP_MIN_SLOTS=<%= @node[:ruby][:gc][:heap_min_slots] %>
+export RUBY_HEAP_SLOTS_INCREMENT=<%= @node[:ruby][:gc][:heap_slots_increment] %>
+export RUBY_HEAP_SLOTS_GROWTH_FACTOR=<%= @node[:ruby][:gc][:heap_slots_growth_factor] %>
+export RUBY_GC_MALLOC_LIMIT=<%= @node[:ruby][:gc][:malloc_limit] %>
+export RUBY_HEAP_FREE_MIN=<%= @node[:ruby][:gc][:heap_free_min] %>
+exec "<%= @node[:languages][:ruby][:ruby_bin] %>" "$@"
Please sign in to comment.
Something went wrong with that request. Please try again.