perf(build): set jemalloc narenas:1 to trim init metadata + RSS#1272
Draft
duncanista wants to merge 1 commit into
Draft
Conversation
tikv-jemallocator links jemalloc with the _rjem_ symbol prefix, so a runtime MALLOC_CONF env var is never read. Set the compile-time JEMALLOC_SYS_WITH_MALLOC_CONF instead, in both the GNU and Alpine compile Dockerfiles. A single arena reduces the metadata jemalloc maps at init and lowers RSS; the extension is not allocation-throughput-bound, so arena contention is not a concern. Dockerfile-only change; not docker-built locally and pending benchmarking.
Contributor
|
12 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: none yet — add before marking ready.
Overview
Tune jemalloc at compile time to a single arena (
narenas:1) in both compile Dockerfiles:images/Dockerfile.bottlecap.compile(GNU / AL2)images/Dockerfile.bottlecap.alpine.compile(musl / Alpine)Why compile-time, and not a
MALLOC_CONFenv varThe binary allocates through
tikv-jemallocator, which links jemalloc with the_rjem_symbol prefix. With that prefix, jemalloc does not read the standard runtimeMALLOC_CONFenvironment variable (nor themalloc_confweak symbol under the unprefixed name), so settingMALLOC_CONFat runtime is silently ignored — a footgun. The robust way to configure a prefixed build is the compile-time envJEMALLOC_SYS_WITH_MALLOC_CONF, whichjemalloc-sysbakes into the build. Hence the change lives in the Dockerfiles rather than in the Lambda runtime environment.Mechanism / expected effect
narenas:1cuts that to a single arena, reducing the metadata mapped at initialization and lowering steady-state RSS.Testing
Dockerfile-only change — no Rust source touched, no
cargorun required.