Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Ruby compiler to jemalloc #17195

Closed
bosawt opened this issue Dec 9, 2020 · 1 comment
Closed

Change Ruby compiler to jemalloc #17195

bosawt opened this issue Dec 9, 2020 · 1 comment
Assignees
Labels
Identity All Identity related tickets

Comments

@bosawt
Copy link
Collaborator

bosawt commented Dec 9, 2020

From the writeup here: department-of-veterans-affairs/vets-api#5382

I haven't personally seen the memory footprint of our existing application, but I noticed we weren't using jemalloc flag in our version of Ruby.
( How do I know? If you try this one liner bundle exec ruby -r rbconfig -e "puts RbConfig::CONFIG['MAINLIBS']", you should see -ljemalloc as a config option)

jemalloc is an alternate implementation of the underlying malloc memory allocation function that Ruby uses, and it tends to work quite well with monolith application implementations. I've personally used it on two monoliths and seen dramatic memory footprint reductions, and no downsides. Here is an article describing someone's experience adding it, with a couple tasty graphs:
https://medium.com/rubyinside/how-we-halved-our-memory-consumption-in-rails-with-jemalloc-86afa4e54aa3

If you need further proof, Mike Perham himself tried to make this default in Ruby:
https://bugs.ruby-lang.org/issues/14718
Looks like they were close to adding this into the default, but so far have not agreed on implementing it since it will effect such a wide range of machines. Shouldn't be an issue on our end, especially if we test it properly beforehand.

@bosawt bosawt added the Identity All Identity related tickets label Dec 9, 2020
@bosawt bosawt self-assigned this Dec 9, 2020
@bosawt
Copy link
Collaborator Author

bosawt commented Oct 11, 2021

@nsoutouras I still want to look into this some day. This is not technically in the purview of the Identity team, but would help the overall backend application footprint. This is completely opportunistic work and has very low priority for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Identity All Identity related tickets
Projects
None yet
Development

No branches or pull requests

2 participants