Add libjemalloc-dev to ruby-base#142
Conversation
|
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
|
I signed it! |
|
CLAs look good, thanks! |
|
The library jemalloc is not something new, many apps and even data stores use it as default memory allocator, for example Redis, Percona server where performance is crucial. Jemalloc has proven and tested in production. To bring jemalloc to Ruby docker base image we either link is statically or dynamically and we benchmarked all three options: malloc, LD_PRELOAD=jemalloc and compile with jemalloc (what this PR is about). Based on benchmark results we can say that compiling jemalloc-dev brings substantial difference to performance characteristics, memory fragmentation and how much time GC spends. Why is this PR required? Our current Ruby based images has jemalloc-dev included, but we are moving to GCP, so our docker build command fail due to missing library in the base image. This PR should help to unblock us. As a benefit every docker container using this Ruby images as a base docker image will see significantly improved performance and reduced memory footprint. It should bring infrastructure cost down as well. P.R. It's proposed to be used with another Ruby project GoogleCloudPlatform/fluent-plugin-google-cloud where you can find the technical details, benchmarks and reason why this makes a difference, and one of Google engineers confirmed that jemalloc is already being used for that package: |
ruby-base/Dockerfile
Outdated
| libgdbm-dev \ | ||
| libgit2-dev \ | ||
| libgmp-dev \ | ||
| libjemalloc-dev \ |
There was a problem hiding this comment.
@brianburnszd we probably also need libjemalloc1 package here in order to compile Ruby with jemalloc
a2af200 to
f805625
Compare
dazuma
left a comment
There was a problem hiding this comment.
Thanks for the PR!
Would you mind alphabetizing the list? (Add the two new libs after libicu-dev). Otherwise this looks good to me; I'll merge it after you fix the order.
Full support for jemalloc will require rebuild of the precompiled Ruby binaries, and we'll need to provide a way for users to opt-in/out in case a compatibility issue comes up. I'll open an issue to look at those matters. But for now this base image change should be fine.
Using jemalloc can reduce Ruby memory usage by 30% https://medium.com/@adrienjarthon/ruby-jemalloc-results-for-updown-io-d3fb2d32f67f
f805625 to
c61c193
Compare
|
Thanks! List alphabetized. |
Using jemalloc can reduce Ruby memory usage by 30%.
It makes sense to include this in the base image.
Ref: https://medium.com/@adrienjarthon/ruby-jemalloc-results-for-updown-io-d3fb2d32f67f