-
Notifications
You must be signed in to change notification settings - Fork 594
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
feat: auto heap dump by default if MALLOC_CONF=prof:true
#12186
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,15 +74,8 @@ pub fn build_memory_control_policy( | |
total_memory_bytes: usize, | ||
auto_dump_heap_profile_config: AutoDumpHeapProfileConfig, | ||
) -> Result<MemoryControlRef> { | ||
use risingwave_common::bail; | ||
use tikv_jemalloc_ctl::opt; | ||
|
||
use self::policy::JemallocMemoryControl; | ||
|
||
if !opt::prof::read().unwrap() && auto_dump_heap_profile_config.enabled() { | ||
bail!("Auto heap profile dump should not be enabled with Jemalloc profile disable"); | ||
} | ||
|
||
Ok(Box::new(JemallocMemoryControl::new( | ||
total_memory_bytes, | ||
auto_dump_heap_profile_config, | ||
|
@@ -122,6 +115,14 @@ impl MemoryControl for DummyPolicy { | |
/// overhead, network buffer, etc. based on `SYSTEM_RESERVED_MEMORY_PROPORTION`. The reserve memory | ||
/// size must be larger than `MIN_SYSTEM_RESERVED_MEMORY_MB` | ||
pub fn reserve_memory_bytes(total_memory_bytes: usize) -> (usize, usize) { | ||
if total_memory_bytes < MIN_COMPUTE_MEMORY_MB << 20 { | ||
panic!( | ||
"The total memory size ({}) is too small. It must be at least {} MB.", | ||
convert(total_memory_bytes as _), | ||
MIN_COMPUTE_MEMORY_MB | ||
); | ||
} | ||
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. Don't know why |
||
|
||
let reserved = std::cmp::max( | ||
(total_memory_bytes as f64 * SYSTEM_RESERVED_MEMORY_PROPORTION).ceil() as usize, | ||
MIN_SYSTEM_RESERVED_MEMORY_MB << 20, | ||
|
This file contains 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
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.
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.
I'll suggest putting it in
./.risingwave/profiling/auto
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.
"."
is not perfect but./.risingwave
is only used by risedev (for developers), it seems even worse.Let me try to make it configurable by env var, so that
kube-bench
orrisedev
can set a proper output directory.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.
It's actually not just used by risedev.
risingwave/src/storage/src/memory.rs
Line 106 in 840114a
But an env for the prefix will be great. It can be useful for putting all kinds of local files.
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.
Also the ci failed because of this change. You need to update the example.toml
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.
Hmm, this is not persuasive.
memory
storage is just for test and playground, and it is never used in production.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 least put it in a directory? Output heap profile in a root directory looks ugly to me. Also we will have a directory for manually dumped in the dashboard pr.
Anyway, I think an env var for the local file prefix would be great. Maybe we can do it in later prs.
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.
I just realized the "env var" actually already exist -
MALLOC_CONF
Now it will dump memory profile to
prof.prefix
ifserver.auto_dump_heap_profile.dir
is absent. Please take a look. 🥰