Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: Add memory reservation debug logging and visualization #2521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andygrove wants to merge 44 commits into apache:main
base: main
Choose a base branch
Loading
from andygrove:debug-mem

Conversation

Copy link
Member

@andygrove andygrove commented Oct 3, 2025
edited
Loading

Which issue does this PR close?

Closes #.

Rationale for this change

Debugging.

[Task 486] MemoryPool[ExternalSorter[6]].try_grow(256232960) returning Ok
[Task 486] MemoryPool[ExternalSorter[6]].try_grow(256375168) returning Ok
[Task 486] MemoryPool[ExternalSorter[6]].try_grow(256899456) returning Ok
[Task 486] MemoryPool[ExternalSorter[6]].try_grow(257296128) returning Ok
[Task 486] MemoryPool[ExternalSorter[6]].try_grow(257820416) returning Err
[Task 486] MemoryPool[ExternalSorterMerge[6]].shrink(10485760)
[Task 486] MemoryPool[ExternalSorter[6]].shrink(150464)
[Task 486] MemoryPool[ExternalSorter[6]].shrink(146688)
[Task 486] MemoryPool[ExternalSorter[6]].shrink(137856)
[Task 486] MemoryPool[ExternalSorter[6]].shrink(141952)
[Task 486] MemoryPool[ExternalSorterMerge[6]].try_grow(0) returning Ok
[Task 486] MemoryPool[ExternalSorterMerge[6]].try_grow(0) returning Ok
[Task 486] MemoryPool[ExternalSorter[6]].shrink(524288)
[Task 486] MemoryPool[ExternalSorterMerge[6]].try_grow(0) returning Ok
[Task 486] MemoryPool[ExternalSorterMerge[6]].try_grow(68928) returning Ok

From this, we can make pretty charts to help with comprehension:

image

What changes are included in this PR?

  • Add new config spark.comet.debug.memory
  • Add new LoggingPool that is enabled when the new config is set

How are these changes tested?

comphead, milenkovicm, cfmcgrady, and wForget reacted with thumbs up emoji
@andygrove andygrove changed the title (削除) chore: Add memory pool trace logging [WIP] (削除ここまで) (追記) chore: Add memory pool trace logging [WIP] [skip-ci] (追記ここまで) Oct 3, 2025
@andygrove andygrove changed the title (削除) chore: Add memory pool trace logging [WIP] [skip-ci] (削除ここまで) (追記) chore: Add memory pool trace logging [WIP] [skip ci] (追記ここまで) Oct 3, 2025
@andygrove andygrove changed the title (削除) chore: Add memory pool trace logging [WIP] [skip ci] (削除ここまで) (追記) chore: Add memory pool trace logging [WIP] (追記ここまで) Oct 3, 2025
@andygrove andygrove marked this pull request as ready for review October 3, 2025 17:36
@andygrove andygrove changed the title (削除) chore: Add memory pool trace logging [WIP] (削除ここまで) (追記) chore: Add memory pool trace logging (追記ここまで) Oct 3, 2025
Comment on lines 170 to 173
debug_native: jboolean,
explain_native: jboolean,
tracing_enabled: jboolean,
Copy link
Member Author

@andygrove andygrove Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than adding yet another flag to this API call, I am now using the already available spark config map in native code.

Copy link
Contributor

@parthchandra parthchandra Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1. The config map should be the preferred method

Copy link

codecov-commenter commented Oct 3, 2025
edited
Loading

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.93%. Comparing base (f09f8af) to head (2884ed3).
⚠️ Report is 585 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@
## main #2521 +/- ##
============================================
+ Coverage 56.12% 58.93% +2.80% 
- Complexity 976 1449 +473 
============================================
 Files 119 147 +28 
 Lines 11743 13649 +1906 
 Branches 2251 2369 +118 
============================================
+ Hits 6591 8044 +1453 
- Misses 4012 4382 +370 
- Partials 1140 1223 +83 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


impl MemoryPool for LoggingPool {
fn grow(&self, reservation: &MemoryReservation, additional: usize) {
println!(
Copy link
Contributor

@comphead comphead Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be println as info! or trace! ?

Copy link
Member Author

@andygrove andygrove Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess info! would be ok. I pushed that change. If we use trace! then we would have to set spark.comet.debug.memory=true and also configure trace logging for this one file, which seem like overkill for a debug feature

comphead reacted with thumbs up emoji
@andygrove andygrove marked this pull request as draft October 3, 2025 20:53
Copy link
Member Author

moving to draft while I work on the Python scripts

Copy link
Member Author

Still experimenting...

mem_chart

Copy link
Member Author

Chart now shows when try_grow failed:

mem_chart

@andygrove andygrove changed the title (削除) chore: Add memory pool trace logging (削除ここまで) (追記) chore: Add memory reservation debug logging and visualization (追記ここまで) Oct 4, 2025
@andygrove andygrove marked this pull request as ready for review October 10, 2025 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@parthchandra parthchandra parthchandra left review comments

@comphead comphead comphead left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /