Repository navigation
feat: track executor allocations and log memory usage - #2530
Merged
coderfender merged 2 commits intoOct 5, 2026
Merged
coderfender merged 2 commits into
coderfender merged 2 commits into
Conversation
andygrove
marked this pull request as draft
October 3, 2026 18:20
coderfender
approved these changes
Oct 5, 2026
coderfender
left a comment
Contributor
There was a problem hiding this comment.
LGTM ! This should give us more visibility into ballista's mem allocation and potentially improve perf. Thank you Andy
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.
Which issue does this PR close?
No linked issue. This brings Comet's executor allocation observability to Ballista, following apache/datafusion-comet#6162 and apache/datafusion-comet#6166, and complements the memory drift observability in apache/datafusion#25651.
Rationale for this change
DataFusion memory pool reservations do not account for every allocation in an executor. Logging outstanding Rust allocator bytes makes that otherwise-untracked memory visible when investigating memory usage or sizing executors.
What changes are included in this PR?
AccountingAllocatorthat wraps the existing allocator without changing its allocation behavior or enforcing a memory limit.MemoryPool::reserved()to sample live task pools, without wrapping or changing the pool itself. Track pools weakly, deduplicate shared pools, and release the registry lock before calling pool methods.start_executor_process_with_memory_metricsentry point; the existing executor API and embedded-executor behavior are unchanged.Are there any user-facing changes?
The standalone executor emits a new INFO log line after pool initialization and every 10 seconds:
The value counts requested Rust allocation sizes, not RSS or memory pool reservations. It excludes allocator fragmentation, retained pages, memory mappings, and direct native-library allocations. Per-thread batching makes the value approximate, with less than 64 KiB of unsettled drift per live thread. There are no changes to memory limits or allocator selection.
reservedis the sum of reservations across distinct live task pools.pool sizeis the resolved total Ballista budget, including auto-sizing, rather than the current reservations or sum of per-task caps. It is shown asunboundedwhen Ballista pool limiting is disabled.Related DataFusion work
DataFusion #25651 merged on September 29, 2026. It adds
MemoryDriftTrackerandPeakRecordingPool::with_drift_tracker, accepting a caller-supplied allocated-byte counter. Those APIs are on DataFusion main but not in Ballista's locked DataFusion 55.1.0 dependency. ItsCountingAllocatoralso lives in the SLT harness and delegates toSystem, rather than being a reusable allocator backend wrapper.This PR therefore keeps the Comet-style mimalloc accounting wrapper and reuses the available
MemoryPool::reserved()API, without bumping DataFusion or copying the new drift tracker. The upstream tracker can be used for consumer-attributed drift and peak reporting after a dependency upgrade; a new pool wrapper is not needed for the periodic snapshots here.Validation
cargo test --locked --profile ci -p ballista-executor --lib— all 76 tests pass.cargo test --locked --profile ci -p ballista-executor --no-default-features --lib— all 68 tests pass.cargo build --locked --profile ci -p ballista-executor --bin ballista-executor— passes.cargo clippy --locked --profile ci -p ballista-executor --all-targets -- -D warnings— passes.cargo fmt --all -- --checkand Prettier 2.7.1 check — pass.