[Backend] Add memory profiling and leak detection benchmarks - #746
Merged
Merged
Conversation
Add core/benches/memory_bench.rs using tikv-jemallocator as global allocator and tikv-jemalloc-ctl to query heap stats, monitoring for allocation churn and RSS growth in long-running indexer processes. Benchmarks: - memory/merkle_build: heap delta per build+drop iteration across 1K/10K/100K leaves - memory/allocation_churn: net retained bytes after 100 repeated build cycles - memory/proof_generation: residual heap after exhaustive proof generation - memory/idle_allocated_bytes: steady-state RSS baseline for CI comparison Add criterion + tikv-jemalloc* dev-dependencies and [[bench]] manifests for both memory_bench and the existing merkle_bench (previously missing harness declaration). Closes SoroLabs#586
|
@blessedDev-xyz Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Collaborator
|
Nice implementation, LGTM! |
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
Add
core/benches/memory_bench.rs— Criterion benchmarks that usetikv-jemallocatoras the global allocator andtikv-jemalloc-ctlto query heap statistics, enabling detection of allocation churn and RSS memory growth in long-running indexer processes.Changes
core/benches/memory_bench.rs(new):memory/merkle_build: heap delta per build+drop iteration (1K / 10K / 100K leaves)memory/allocation_churn: net retained bytes after 100 repeated build+drop cycles — non-zero growth indicates a leakmemory/proof_generation: residual heap after exhaustive proof generation across all leavesmemory/idle_allocated_bytes: steady-state RSS snapshot for CI baseline comparisontikv_jemallocator::Jemallocas#[global_allocator]andtikv_jemalloc_ctl::epoch+stats::allocatedfor precise heap readscore/Cargo.toml:criterion = "0.5",tikv-jemalloc-ctl = "0.5",tikv-jemallocator = "0.5"to dev-dependencies[[bench]]declarations formemory_benchandmerkle_bench(previously missing harness flag)Usage
cargo bench --bench memory_bench # Results in target/criterion/memory/Validation
cargo check --benchespasses with no errorsCloses #586