Repository navigation
feat(proxy): allocator trial builds, jemalloc gauges and rig support (CIP-5738, CIP-5739, CIP-5740) - #535
Draft
tobyhede wants to merge 6 commits into
Draft
feat(proxy): allocator trial builds, jemalloc gauges and rig support (CIP-5738, CIP-5739, CIP-5740)#535tobyhede wants to merge 6 commits into
tobyhede wants to merge 6 commits into
Conversation
Add off-by-default Cargo features that swap Proxy's Rust global allocator on Linux for the allocator trial (CIP-5738, CIP-5739): `jemalloc` (prefixed), `jemalloc-unprefixed` (also replaces C malloc, with background threads) and `mimalloc`. Default builds keep glibc and gain no dependency. Proxy logs the allocator it uses at startup. `mise run burn-in:image` builds a variant for a Linux target and copies only the binary into a release image for the RSS rig. `build:binary` takes `--features`, can cross-compile between Linux architectures, and gives jemalloc 64 KiB pages on aarch64. CI builds and tests each allocator feature on both Linux targets. The rig's pooled-queries workload binds the salary at the width Proxy describes, since the EQL v3 example schema makes it bigint. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013Q6HAPvwBTmnJX6YikJ9N8
jemalloc builds with Prometheus on export jemalloc's allocated, active, resident and retained bytes, read after advancing the stats epoch on each scrape (CIP-5740). These builds serve the metrics endpoint themselves so the read happens at scrape time; other builds keep the exporter's own listener and export no new gauges. The RSS rig records the allocator Proxy logged at startup, and in scraped runs logs the jemalloc gauges per scrape and summarises them in the report. The burn-in README lists the five trial variants and how to run each one, and the metrics reference lists the new gauges. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013Q6HAPvwBTmnJX6YikJ9N8
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013Q6HAPvwBTmnJX6YikJ9N8
jemalloc's counts are process-wide, and `cargo test` runs tests on parallel threads. The scrape test's 64 MiB allocation could be freed between another test's two reads, so its count went down while it held 64 MiB. The three tests that assert on how the counts change now hold one lock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013Q6HAPvwBTmnJX6YikJ9N8
Adds a manually started workflow that builds each allocator variant's rig image, runs the RSS rig per variant, workload and host, runs pgbench through each variant, and summarises both trials. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013Q6HAPvwBTmnJX6YikJ9N8
The trial runs from the allocator-trial branch, so its workflow and scripts stay out of this pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013Q6HAPvwBTmnJX6YikJ9N8
This branch has not been deployed
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.
Requested by User · project thread
This adds the builds and measurement support for the allocator trial: CIP-5738, CIP-5739 and CIP-5740.
Default builds and released images stay on glibc and gain no dependency.
What changes
jemallocuses prefixed jemalloc, so C libraries such asaws-lc-syskeep using glibc.jemalloc-unprefixedmakes jemalloc replace Cmalloctoo, withbackground_thread:true.mimallocuses mimalloc.msg="Memory allocator"withallocator,c_malloc(the allocator behind Cmalloc), the jemalloc version, and the variable that holds runtime settings (_RJEM_MALLOC_CONFfor prefixed jemalloc).mise run burn-in:image --allocator <glibc|jemalloc|jemalloc-unprefixed|mimalloc> [--target …] [--base …]builds Proxy and copies only the binary into a release image (defaultcipherstash/proxy:3.1.0). It prints the tag to pass to the rig's--image.build:binarynow takes--featuresand can cross-compile between Linux architectures.JEMALLOC_SYS_WITH_LG_PAGE=16.cipherstash_proxy_jemalloc_{allocated,active,resident,retained}_bytes, read after advancing jemalloc's stats epoch on each scrape./healthanswersOK, every other path serves the metrics, and upkeep runs every 5 seconds.scraper.logand summarise them in the report.pooled-queriesbinds the salary asint4orint8, whichever Proxy describes. The EQL v3 example schema makes the salaryeql_v3_bigint_ord, which Proxy describes as INT8. Binding ani32there would fail every insert.MALLOC_ARENA_MAX=2. The metrics reference lists the new gauges.Checks
cargo test --workspace --exclude cipherstash-proxy-integration).--all-features -D warnings.allocatedcount.mallocmoves it too.Not done here
These need ZeroKMS credentials, which the session that wrote this PR did not have:
pooled-queriesrun against a 3.x image.The salary fix is based on how Proxy describes
eql_v3_bigint_ordparameters. No rig run has tested it yet.Acknowledgment
By submitting this pull request, I confirm that CipherStash can use, modify, copy, and redistribute this contribution, under the terms of CipherStash's choice.
Generated by Claude Code