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

Examine Ruby memory use #1269

Closed
david-a-wheeler opened this issue Mar 15, 2019 · 4 comments
Closed

Examine Ruby memory use #1269

david-a-wheeler opened this issue Mar 15, 2019 · 4 comments

Comments

@david-a-wheeler
Copy link
Collaborator

@david-a-wheeler
Copy link
Collaborator Author

david-a-wheeler commented Mar 15, 2019

In the short term, investigate using

MALLOC_ARENA_MAX=2

@david-a-wheeler
Copy link
Collaborator Author

The "Joyful Bikeshedding" is, as far as I can tell, the best analysis. Many people thought it was fragmentation, but with additional analysis, it appears that the real problem is slightly different.

That said, others have also noticed that setting MALLOC_ARENA_MAX=2 is helpful for Ruby:

https://www.speedshop.co/2017/12/04/malloc-doubles-ruby-memory.html
heroku/heroku-buildpack-ruby#751
https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/

Experimentation reveals no serious problems in setting this environment variable for our situation.

@david-a-wheeler
Copy link
Collaborator Author

I continue to monitor. I see no serious problems. The memory use is somewhat less - it's not trivial, but it looks like we have a better margin.

@david-a-wheeler
Copy link
Collaborator Author

I've continued to monitor. MALLOC_ARENA_MAX=2 is a significant improvement. Our 7-day average is 53%, and the max is 96% (at over 100% we start swapping). While swapping doesn't shut us down, a single setting that makes it rare is a good thing.

So I'm closing this issue. Further improvements would be welcome, but right now we should move on to other things.

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

No branches or pull requests

1 participant