Created
April 23, 2022 01:34
-
-
Save kigster/5619fe14a94018524c70a3ab12673308 to your computer and use it in GitHub Desktop.
Ruby 2+ environment variables to tune GC and memory bloat to a minimum on large apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Discourse Settings | |
export RUBY_GC_HEAP_INIT_SLOTS=997339 | |
export RUBY_GC_HEAP_FREE_SLOTS=626600 | |
export RUBY_GC_HEAP_GROWTH_FACTOR=1.03 | |
export RUBY_GC_HEAP_GROWTH_MAX_SLOTS=88792 | |
export RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=2.4 | |
export RUBY_GC_MALLOC_LIMIT=34393793 | |
export RUBY_GC_MALLOC_LIMIT_MAX=41272552 | |
export RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR=1.32 | |
export RUBY_GC_OLDMALLOC_LIMIT=39339204 | |
export RUBY_GC_OLDMALLOC_LIMIT_MAX=47207045 | |
export RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=1.2 | |
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/ | |
export MALLOC_ARENA_MAX=2 | |
# Also, make sure you are using jemalloc-linked Ruby |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment