Skip to content

Instantly share code, notes, and snippets.

@mikhailov
Created March 11, 2011 10:33
Show Gist options
  • Save mikhailov/865706 to your computer and use it in GitHub Desktop.
Save mikhailov/865706 to your computer and use it in GitHub Desktop.
Ruby’s GC Configuration
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration
article’s settings: ("spec spec" took 17-23!sec)
export RUBY_HEAP_MIN_SLOTS=1250000
export RUBY_HEAP_SLOTS_INCREMENT=100000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=30000000
export RUBY_HEAP_FREE_MIN=12500
37signals’s settings: ("spec spec" took 17-18!sec)
export RUBY_HEAP_MIN_SLOTS=600000
export RUBY_HEAP_SLOTS_INCREMENT=10000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1.8
export RUBY_GC_MALLOC_LIMIT=59000000
export RUBY_HEAP_FREE_MIN=100000
twitter’s settings: ("spec spec" took 17-28sec)
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
export RUBY_HEAP_FREE_MIN=4096
_default’s settings: ("spec spec" took 25-37sec)
export RUBY_HEAP_MIN_SLOTS=10000
export RUBY_HEAP_SLOTS_INCREMENT=10000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1.8
export RUBY_GC_MALLOC_LIMIT=8000000
export RUBY_HEAP_FREE_MIN=4096
@mikhailov
Copy link
Author

just copy-paste "exports" per each section and run into console.
then see the difference on specs or just applications logs

each result is specific to current codebase

@mikhailov
Copy link
Author

you can also update your ~/.bash_rc or /etc/environment file with the variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment