[PR #284] feat(server): make jemalloc optional #316

Open
opened 2026-10-29 14:22:07 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/284
Author: @CharlesXu-HQ
Created: 9/13/2026
Status: 🔄 Open

Base: main ← Head: feat/jemalloc-optional


📝 Commits (1)

  • 9ac065d feat(server): make jemalloc optional

📊 Changes

5 files changed (+11 additions, -8 deletions)

View changed files

📝 .github/workflows/release.yml (+1 -1)
📝 Cargo.toml (+2 -1)
📝 Makefile (+3 -3)
📝 deploy/docker/Dockerfile.agentenv (+2 -2)
📝 src/bin/server.rs (+3 -1)

📄 Description

What

Make tikv-jemallocator optional behind a jemalloc Cargo feature. Default development and test builds use the platform allocator and omit the jemalloc build, while the release Makefile targets, Docker image, and release workflow continue to build the server with jemalloc.

Why

tikv-jemalloc-sys is a native dependency with a material clean-build cost even when a developer only needs regular unit or development builds. This implements the P3 dependency-isolation item in #8 while preserving the allocator used by distributed server artifacts.

Part of #8 (P3)

Scope and non-goals

This PR only adds the Cargo feature gate and enables it in formal release paths. It does not change the existing jemalloc tuning, add allocator configuration, or claim an end-to-end performance improvement.

Design and behavior changes

  • tikv-jemallocator becomes an optional dependency selected by jemalloc.
  • The global allocator and exported malloc_conf tuning symbol are compiled only with that feature.
  • Formal release paths explicitly enable jemalloc; ordinary debug builds do not.

Compatibility and operations

  • Public API or generated protocol: N/A; no public API or generated protocol changes.
  • Configuration or defaults: N/A; there are no runtime configuration changes.
  • Snapshot manifest, artifact layout, or storage format: N/A; no format changes.
  • Upgrade and rollback: Packaged release builds retain jemalloc and the existing purge settings. Custom builds without the feature use the platform allocator.
  • Host requirements, permissions, ports, or dependencies: Default development builds omit the jemalloc native build dependency. Runtime host requirements are otherwise unchanged.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

Commands and results:

make fmt
  passed

make clippy
  passed on Linux with Rust 1.98.1

cargo tree --locked -p agentenv --no-default-features -e normal
  no tikv-jemallocator or tikv-jemalloc-sys packages

cargo tree --locked -p agentenv --features jemalloc -e normal
  includes tikv-jemallocator v0.6.1 and tikv-jemalloc-sys v0.6.1

cargo build --locked -p agentenv --bin server --no-default-features
nm -g --defined-only target/debug/server
  no malloc_conf symbol

cargo build --locked -p agentenv --bin server --features jemalloc
nm -g --defined-only target/debug/server
  malloc_conf symbol present

cargo clippy --locked -p agentenv --bin server --no-default-features -- -D warnings
cargo clippy --locked -p agentenv --bin server --features jemalloc -- -D warnings
  both passed

Skipped checks and reasons:

  • Unit and integration tests were not run because this change only controls allocator selection at compile time; both server variants were fully linked and inspected.
  • services/, generated code, and documentation are unchanged.
  • No performance benchmark is claimed; the dependency-tree and linked-symbol assertions verify the intended build behavior directly.

Risks and reviewer notes

Custom debug or release commands that expect jemalloc must now pass --features jemalloc. The repository's formal release paths have been updated to preserve their current allocator and tuning.

This PR touches the same release command lines as #283 and may need a trivial rebase to combine the two feature lists after that PR merges.

Cargo also reports an existing future-incompatibility notice in the third-party proc-macro-error2 crate; it is not emitted as a project Clippy warning.

Checklist

  • The PR contains one coherent change and no unrelated formatting or refactoring.
  • New behavior is covered by tests, or I explained why testing is impractical.
  • Logs and examples contain no credentials, tokens, or private registry information.
  • I did not manually edit generated code without updating its source and regenerating it.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/284 **Author:** [@CharlesXu-HQ](https://github.com/CharlesXu-HQ) **Created:** 9/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/jemalloc-optional` --- ### 📝 Commits (1) - [`9ac065d`](https://github.com/kvcache-ai/AgentENV/commit/9ac065d06aa298d09fda62d4309e0399b9580e4e) feat(server): make jemalloc optional ### 📊 Changes **5 files changed** (+11 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yml` (+1 -1) 📝 `Cargo.toml` (+2 -1) 📝 `Makefile` (+3 -3) 📝 `deploy/docker/Dockerfile.agentenv` (+2 -2) 📝 `src/bin/server.rs` (+3 -1) </details> ### 📄 Description ## What Make `tikv-jemallocator` optional behind a `jemalloc` Cargo feature. Default development and test builds use the platform allocator and omit the jemalloc build, while the release Makefile targets, Docker image, and release workflow continue to build the server with jemalloc. ## Why `tikv-jemalloc-sys` is a native dependency with a material clean-build cost even when a developer only needs regular unit or development builds. This implements the P3 dependency-isolation item in #8 while preserving the allocator used by distributed server artifacts. ## Related issue Part of #8 (P3) ## Scope and non-goals This PR only adds the Cargo feature gate and enables it in formal release paths. It does not change the existing jemalloc tuning, add allocator configuration, or claim an end-to-end performance improvement. ## Design and behavior changes - `tikv-jemallocator` becomes an optional dependency selected by `jemalloc`. - The global allocator and exported `malloc_conf` tuning symbol are compiled only with that feature. - Formal release paths explicitly enable `jemalloc`; ordinary debug builds do not. ## Compatibility and operations - Public API or generated protocol: N/A; no public API or generated protocol changes. - Configuration or defaults: N/A; there are no runtime configuration changes. - Snapshot manifest, artifact layout, or storage format: N/A; no format changes. - Upgrade and rollback: Packaged release builds retain jemalloc and the existing purge settings. Custom builds without the feature use the platform allocator. - Host requirements, permissions, ports, or dependencies: Default development builds omit the jemalloc native build dependency. Runtime host requirements are otherwise unchanged. ## Validation - [x] `make fmt` - [x] `make clippy` - [ ] `make test-unit` - [ ] Relevant Rust integration tests - [ ] `make -C services test` (required when `services/` changes) - [ ] Generated clients/server regenerated with the documented `make` target - [ ] Documentation updated - [ ] Benchmarks or performance comparison completed Commands and results: ```text make fmt passed make clippy passed on Linux with Rust 1.98.1 cargo tree --locked -p agentenv --no-default-features -e normal no tikv-jemallocator or tikv-jemalloc-sys packages cargo tree --locked -p agentenv --features jemalloc -e normal includes tikv-jemallocator v0.6.1 and tikv-jemalloc-sys v0.6.1 cargo build --locked -p agentenv --bin server --no-default-features nm -g --defined-only target/debug/server no malloc_conf symbol cargo build --locked -p agentenv --bin server --features jemalloc nm -g --defined-only target/debug/server malloc_conf symbol present cargo clippy --locked -p agentenv --bin server --no-default-features -- -D warnings cargo clippy --locked -p agentenv --bin server --features jemalloc -- -D warnings both passed ``` Skipped checks and reasons: - Unit and integration tests were not run because this change only controls allocator selection at compile time; both server variants were fully linked and inspected. - `services/`, generated code, and documentation are unchanged. - No performance benchmark is claimed; the dependency-tree and linked-symbol assertions verify the intended build behavior directly. ## Risks and reviewer notes Custom debug or release commands that expect jemalloc must now pass `--features jemalloc`. The repository's formal release paths have been updated to preserve their current allocator and tuning. This PR touches the same release command lines as #283 and may need a trivial rebase to combine the two feature lists after that PR merges. Cargo also reports an existing future-incompatibility notice in the third-party `proc-macro-error2` crate; it is not emitted as a project Clippy warning. ## Checklist - [x] The PR contains one coherent change and no unrelated formatting or refactoring. - [x] New behavior is covered by tests, or I explained why testing is impractical. - [x] Logs and examples contain no credentials, tokens, or private registry information. - [x] I did not manually edit generated code without updating its source and regenerating it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#316
No description provided.