experiment(internal telemetry): gate allocation tracing behind a Cargo feature#25709
Draft
pront wants to merge 1 commit into
Draft
experiment(internal telemetry): gate allocation tracing behind a Cargo feature#25709pront wants to merge 1 commit into
pront wants to merge 1 commit into
Conversation
…ture Wrap the entire allocation tracing surface (global allocator wrapper, init code, CLI flags, AllocationLayer, topology call sites, gRPC status RPC) in `#[cfg(feature = "allocation-tracing")]`. Feature is off by default; release builds opt in by adding it to the feature set. Motivation: when the feature is compiled in, every alloc/dealloc pays a relaxed atomic load + branch on `TRACK_ALLOCATIONS` even when the runtime flag is off. This commit lets us run an SMP experiment to measure the cost of that always-on path.
Member
Author
|
/ci-run-regression |
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.
This branch exists to measure the cost of always compiling Vector's per-component allocation tracking into release builds. It is not a merge candidate. If SMP shows a meaningful win we will follow up with a real proposal; if it does not, this branch will be closed.
Motivation
Vector's
#[global_allocator]isGroupedTraceableAllocator<Jemalloc>. It is always compiled in for unix release builds, and on everyalloc/deallocit does a relaxed atomic load + branch onTRACK_ALLOCATIONSto decide whether to do the per-component bookkeeping. The runtime--allocation-tracingflag toggles that bool, but the wrapper itself — and therefore the load + branch — is unconditional.Open questions this experiment is meant to answer:
AtomicBoolcheck on every allocation measurable in throughput/latency across our component matrix, or is the branch predictor hiding it?prof.activefor users who just want heap visibility)?See https://github.com/vectordotdev/vector/blob/master/src/internal_telemetry/allocations/allocator/tracing_allocator.rs for the hot path being measured.
What this PR does
Wraps the entire allocation-tracing surface in
#[cfg(feature = "allocation-tracing")]:#[global_allocator]insrc/lib.rs(wrapped vs plainJemalloc)src/main.rs--allocation-tracing/--allocation-tracing-reporting-interval-msCLI flags insrc/cli.rsAllocationLayerinsrc/trace.rsacquire_allocation_group_idcall sites insrc/topology/running.rsget_allocation_tracing_statusgRPC RPC insrc/api/grpc/service.rsallocationsmodule itself insrc/internal_telemetry/mod.rsFeature is off by default, so the SMP comparison build runs with a plain
tikv_jemallocator::Jemallocand no wrapper at all. Baseline is currentmaster(wrapper always on).How tested
cargo check --no-default-features --features default(feature off): cleancargo check --no-default-features --features "default,allocation-tracing"(feature on): cleancargo clippy --no-default-features --features default --lib --bin vector -- -D warnings: cleanChange Type
Is this a breaking change?
(Not landing as-is; if a follow-up does land, default builds would lose the runtime
--allocation-tracingflag and thecomponent_allocated_bytes_total/component_deallocated_bytes_total/component_allocated_bytesinternal metrics unless the feature is added to the release feature set.)Does this PR include user facing changes?
no-changeloglabel to this PR.Build/Cargo-feature wiring only.