From def0525c6d3198bb4789198cf860add0fa5b6c1d Mon Sep 17 00:00:00 2001 From: Thorsten Eckel Date: Tue, 29 Oct 2019 14:49:03 +0100 Subject: [PATCH] Maintenance: Reduce memory consumption by setting `MALLOC_ARENA_MAX`. The Zammad environment variable `MALLOC_ARENA_MAX` will now default to `2`. This environment variable was previously unset. The goal of setting this value is to decrease memory usage for the majority of Zammad installations - especially the Worker and Puma processes. To understand more about the relationship between this value and memory please see the following external resources: - https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html - https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/ Heroku also maintains a [documentation on tuning the memory behavior of glibc by setting this environment variable](https://devcenter.heroku.com/articles/tuning-glibc-memory-behavior). The default as specified by the [linux man page](http://man7.org/linux/man-pages/man3/mallopt.3.html) is 8 times the number of (virtual) cores on the system. --- contrib/packager.io/functions | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/packager.io/functions b/contrib/packager.io/functions index d4a0caaac..b9b3acd6c 100644 --- a/contrib/packager.io/functions +++ b/contrib/packager.io/functions @@ -299,6 +299,7 @@ function update_or_install () { } function set_env_vars () { + zammad config:set RUBY_MALLOC_ARENA_MAX=${ZAMMAD_RUBY_MALLOC_ARENA_MAX:=2} zammad config:set RUBY_GC_MALLOC_LIMIT=${ZAMMAD_RUBY_GC_MALLOC_LIMIT:=1077216} zammad config:set RUBY_GC_MALLOC_LIMIT_MAX=${ZAMMAD_RUBY_GC_MALLOC_LIMIT_MAX:=2177216} zammad config:set RUBY_GC_OLDMALLOC_LIMIT=${ZAMMAD_RUBY_GC_OLDMALLOC_LIMIT:=2177216}