How to reduce memory usage in Ruby – AbstractBrain Answers

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 https://rubyonrails.ba/single/how-to-reduce-memory-usage-in-ruby-abstractbrain-answers

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles