How to reduce memory usage in Ruby – AbstractBrain Answers
10-Nov-2022 1181
The problem is related to Ruby threads and how memory allocation works at low-level. In many cases it’s not a memory leak, but just a memory bloat.Here’s two effective solution that we have used in production to reduce the memory usage:Reduce the number of Sidekiq threads (e.g. use 10 threads instead of 25)Set the environment variable MALLOC_ARENA_MAX=2 for tuning glibc memory behavior.The environment variable is a no-brainer. Here’s the results that we got by adding it (max RAM in 16h):.
How to reduce memory usage in Ruby – AbstractBrain Answers #ruby #rubydeveloper #rubyonrails #reduce #memory #usage #AbstractBrain #Answers https://rubyonrails.ba/link/how-to-reduce-memory-usage-in-ruby-abstractbrain-answers