-
Notifications
You must be signed in to change notification settings - Fork 265
feat: Add unbounded memory pool #1386
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ use datafusion::{ | |
| prelude::{SessionConfig, SessionContext}, | ||
| }; | ||
| use datafusion_execution::memory_pool::{ | ||
| FairSpillPool, GreedyMemoryPool, MemoryPool, TrackConsumersPool, | ||
| FairSpillPool, GreedyMemoryPool, MemoryPool, TrackConsumersPool, UnboundedMemoryPool, | ||
| }; | ||
| use futures::poll; | ||
| use jni::{ | ||
|
|
@@ -118,6 +118,7 @@ enum MemoryPoolType { | |
| FairSpillTaskShared, | ||
| GreedyGlobal, | ||
| FairSpillGlobal, | ||
| Unbounded, | ||
| } | ||
|
|
||
| struct MemoryPoolConfig { | ||
|
|
@@ -319,6 +320,7 @@ fn parse_memory_pool_config( | |
| "greedy_global" => MemoryPoolConfig::new(MemoryPoolType::GreedyGlobal, pool_size), | ||
| "fair_spill" => MemoryPoolConfig::new(MemoryPoolType::FairSpill, pool_size_per_task), | ||
| "greedy" => MemoryPoolConfig::new(MemoryPoolType::Greedy, pool_size_per_task), | ||
| "unbounded" => MemoryPoolConfig::new(MemoryPoolType::Unbounded, 0), | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH, I don't know if it is ever a good idea to allow an unbounded memory pool. It doesn't hurt to have the option, but under what conditions is this choice useful?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found the unbounded memory pool is useful for the cases we do not want to allow any spilling and rather choose to fail the job. Spilling slows down the job a lot and the unbounded memory pool is one way to measure the best case without adjusting how much memory we provide for native exec
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we can add this advice in the documentation. Speeding up the job sounds like a win until the jobs start OOMing. :)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see the value in having the unbounded tool for development testing purposes but not for end user use. I would like to use it to help with #1315 |
||
| _ => { | ||
| return Err(CometError::Config(format!( | ||
| "Unsupported memory pool type: {}", | ||
|
|
@@ -397,6 +399,7 @@ fn create_memory_pool( | |
| per_task_memory_pool.num_plans += 1; | ||
| Arc::clone(&per_task_memory_pool.memory_pool) | ||
| } | ||
| MemoryPoolType::Unbounded => Arc::new(UnboundedMemoryPool::default()), | ||
| } | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point there are so many options for memory pool that it is bound to confuse users. Would it be a good idea to have a bit of documentation that helps users decide what kind of memory pool to use?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I also do not know some of the differences like 'fair_spill_task_shared' vs 'greedy_global'
I filed an issue #1388 and will on separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are explained in the Tuning Guide:
https://datafusion.apache.org/comet/user-guide/tuning.html#dedicated-comet-memory-pools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I can add the doc to the place