Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Last active August 29, 2015 14:01
Show Gist options
  • Save yorickpeterse/190a87a31634eea5ef07 to your computer and use it in GitHub Desktop.
Save yorickpeterse/190a87a31634eea5ef07 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Small wrapper around the actual command used to start the daemon. This
# wrapper allows us to set various environment variables before Ruby is
# started.
#
# See the following URLs for more information on these options and their
# values:
#
# http://samsaffron.com/archive/2014/04/08/ruby-2-1-garbage-collection-ready-for-production
# http://tmm1.net/ruby21-rgengc/
#
export RUBY_GC_MALLOC_LIMIT=8388608
export RUBY_GC_MALLOC_LIMIT_MAX=16777216
export RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=0.9
export RUBY_GC_OLDMALLOC_LIMIT=8388608
export RUBY_GC_OLDMALLOC_LIMIT_MAX=67108864
# Prevents massive speaks in memory usage when new memory is allocated. We
# don't really care about low GC timings in the daemon since it doesn't affect
# our total runtime.
export RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=0.9
# The review collector starts with around 300k objects. This was measured using
# GC.stat(:heap_live_slot) on MRI 2.1.1.
export RUBY_GC_HEAP_INIT_SLOTS=300000
export RUBY_GC_HEAP_FREE_SLOTS=300000
exec bin/start_daemon $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment