perf: add jemalloc as default allocator - #47
Merged
Merged
Conversation
reduces allocation contention under multi-threaded workloads. profiling showed ~7.7% CPU time spent in malloc/cfree with system allocator. jemalloc uses per-thread caches to minimize contention. enabled by default via feature flag. can be disabled with --no-default-features for platforms that don't support jemalloc.
kacy
added a commit
that referenced
this pull request
Feb 11, 2026
perf: add jemalloc as default allocator
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.
summary
adds jemalloc as the default memory allocator for ember-server. reduces allocation contention under multi-threaded workloads.
benchmarks (GCP c2-standard-8)
profiling showed ~7.7% CPU time in malloc/cfree with system allocator. jemalloc's per-thread caches reduce this contention.
changes
tikv-jemallocatoras optional dependency (enabled by default)--no-default-featuresdisables jemalloc for platforms that don't support ittest plan
--no-default-featuresdesign notes
the multi-core scaling issue persists (8 shards ≈ 1 shard performance). jemalloc addresses allocation contention but the main bottleneck is channel overhead (futex operations) from cross-thread request routing. addressing that requires architectural changes (connection affinity or sharded acceptors).