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

Consider replacing (or adding) jemalloc with v3.6.0 #305

Closed
ashie opened this issue May 12, 2021 · 4 comments · Fixed by #318
Closed

Consider replacing (or adding) jemalloc with v3.6.0 #305

ashie opened this issue May 12, 2021 · 4 comments · Fixed by #318

Comments

@ashie
Copy link
Member

ashie commented May 12, 2021

From fluent/fluentd#1657

Some users reported that jemalloc v4 or v5 consumes excessive amounts of memory and v3.6 quite reduces it. It seems a known issue as follows:

Do not use jemalloc 4.x with Ruby. It has a bad interaction with Transparent Huge Pages that reduces the memory savings you’ll see. Instead, use jemalloc 3.6. 5.0’s performance with Ruby is currently unknown.

Replacing (or adding) jemalloc with v3.6.0 isn't hard, but I think there is a points to be considered.
Is v3.6 still supported and can we get security fixes (it seems stable enough though)?
It's also concerned in the above ruby-lang's issue:

https://bugs.ruby-lang.org/issues/14718#note-37

it will be harder to get support from the jemalloc team if we are not on 5.0.1. 

Enterprise users are sensitive in security issues so it would be better that we have evidence about it. According to jemlloc's web site, it still seems be supported:

http://jemalloc.net/

stable-3/stable-4: The stable-* branches are bugfix-only branches based on the last releases for previous major versions. The versioned release history is linear, but relevant fixes may continue to be applied to the stable-* branches indefinitely.

ashie added a commit that referenced this issue Jul 14, 2021
See the following issue for more detail:
#305

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
ashie added a commit that referenced this issue Jul 14, 2021
See the following issue for more detail:
#305

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
@repeatedly
Copy link
Member

NOTE: We can control jemalloc behavior via MALLOC_CONF. So if we can reduces memory usage by using jemalloc options, using latest jemalloc is better. jemalloc 3.6.0 is released in 2014 and it doesn't consider recent systems and hardwares. Of course, using 3.6.0 as temporary solution is good for users.

@ashie
Copy link
Member Author

ashie commented Jul 19, 2021

Thanks for the information! I'll check it.

@ashie
Copy link
Member Author

ashie commented Aug 17, 2021

I don't consider downgrading it for Docker images for now.
Not always needed to downgrade if most users doesn't hit the memory usage issue.
Generally speaking, as we discussed above, using an old release isn't recommended.

As described in the references in #305 (comment), downgrading jemalloc might not be only way to reduce memory usage. So we'll continue investigating to find a better way. For example, Heroku uses MALLOC_ARENA_MAX=2 to achieve the purpose: https://devcenter.heroku.com/changelog-items/1683

For td-agent, we downgraded jemalloc to verificate one of such ways.
If this way is verified as "most better way" (never the best because it's an old release), we might propagate it to Docker images too.

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

Successfully merging a pull request may close this issue.

3 participants