Reduce memory usage by 50% with 1 env variable

In the past days I was fighting against a memory leak - which I then discovered to be a memory bloat. In particular it was affecting some Sidekiq workers.

Debugging these problems is really hard and I want to share what I finally found after lot of research (it’s really an hidden gem, and I didn’t know about it, even after 10 years that I use Ruby on Rails).

Here’s a blog post with the results:


Very good info, will try this out on our staging server with some busy background tasks to see how it performs.

Even better, switch to a better memory allocator like jemalloc. There’s also an optimized version of Ruby called Fullstaq Ruby with jemalloc and other improvements.

1 Like