-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use jemalloc to prevent memory bloating #15972
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @top4ek, thanks for your contribution and interest in improvements. We build multiple architectures for our dockerfiles, so this PR will fail them: https://github.com/opf/openproject/blob/dev/.github/workflows/docker.yml#L105-L127
/cc @opf/ops
Oh, thanks, will look into this. |
Added support for other architectures. Using USE_JEMALLOC=false enviromnent by default. |
elif [ "$ARCHITECTURE" = "ppc64le" ]; then | ||
LIB_ARCH="powerpc64le" | ||
fi | ||
export LD_PRELOAD=/usr/lib/${LIB_ARCH}-linux-gnu/libjemalloc.so.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@top4ek aren't we supposed to also set that env variable when launching a container from this image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, looks like you're right. Just looked into fresh instance with this patch and it doesn't work. export
is not set on build stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for now there would need to be an env variable basically saying "launch with jemalloc" (can reuse USE_JEMALLOC
for that) that sets the LD_PRELOAD
path in the entrypoint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hoped to bake LD_PRELOAD straight into the image on build stage to make it more "systemwide". Quick googling said that i can't do that inside dockerfile's RUN.
Got some ideas, will try them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use the existing entrypoint.sh file, and simply export the relevant variables if USE_JEMALLOC
env variable is set to true
by the user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but entrypoint.sh
is for only all-in-one target, so I'm going to create additional entrypoint script for slim target and don't want to copy-paste same code in both scripts.
I've tested this on ppc64 and double-checked via
to see if ruby is indeed using JEMALLOC which it is. So that's good. So this PR is fine for x86 and ppc64 at least. And I reckon arm64 will be fine too. This can go ahead if we add the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@top4ek Thanks for the PR. I would actually set the default for USE_JEMALLOC
to true.
The only thing that's missing is the LD_PRELOAD
export in the web and worker scripts as described in my other comment. I would check for USE_JEMALLOC
there too so that we can still choose not to use it.
The problem is that
Not sure if it's safe to do without tests as because of jemalloc/jemalloc#2358 |
…_jemalloc * 'use_jemalloc' of github.com:top4ek/openproject: (1771 commits) [57927] Primerise the Notification badge in the top header (opf#16742) add test for WorkPackageEagerLoadingWrapper text formatting; addresses opf#16542 (comment) chore(deps): bump md-to-pdf to v0.1.2 [57347] Fixed NextcloudConnectionValidator specs Remove special mobile scrolling behavior that we introduced to collapse the adress bar on iOS Safari. It somehow conflicts with the positioning of the ActionMenu [57347] Restructured NextcloudConnectionValidator [57347] Added test for failing files query on NextcloudConnectionValidator [57347] Added test for unexpected files validation for Nextcloud storage [57347] Added unexpected content validation to NextcloudConnectionValidator build(deps): bump fog-aws from 3.26.0 to 3.27.0 build(deps-dev): bump rubocop-performance from 1.21.1 to 1.22.0 add a trailing arrow-down icon for add button in meeting module update locales from crowdin [ci skip] update locales from crowdin [ci skip] update locales from crowdin [ci skip] update locales from crowdin [ci skip] update locales from crowdin [ci skip] [57911] Improve participants side panel phrasing and spacing [#53620] add feature flag for buit-in apps Add technical notes to lookbook forms page ...
Added entrypoint for slim container. Show jemalloc status at admin/info page. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @top4ek, I think this looks good and works fine. I just have one suggestion. Could you please have a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Thanks for your contribution @top4ek! Merging it (into dev) now. That means it should become available officially with OpenProject 14.6 which is currently scheduled to be released in about two weeks. |
Use dynamically linked jemalloc to prevent memory bloating in long living instances.