Skip to content

Conversation

@yangzhg
Copy link
Member

@yangzhg yangzhg commented Nov 1, 2021

Proposed changes

Add a method to get Doris current memory usage, get Doris memory usage every 1 second.
This method used to limit the whole memory allocation in Doris
Add all memory usage check when TryConsume memory

Types of changes

What types of changes does your code introduce to Doris?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)
  • Code refactor (Modify the code structure, format the code, etc...)
  • Optimization. Including functional usability improvements and performance improvements.
  • Dependency. Such as changes related to third-party components.
  • Other.

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

Further comments

If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...

@yangzhg yangzhg changed the title Add a method to get doris current memory usage Add a method to get doris current memory usage and Limt memoey usage when consume Nov 1, 2021
@yangzhg yangzhg changed the title Add a method to get doris current memory usage and Limt memoey usage when consume [Memory] Add a method to get doris current memory usage and Limt memoey usage when consume Nov 1, 2021
@yangzhg yangzhg force-pushed the get_current_mem branch 2 times, most recently from d145241 to 39781c6 Compare November 2, 2021 13:08
@ans76
Copy link

ans76 commented Nov 2, 2021

lgtm % add tests for check before allocation?

@yangzhg yangzhg force-pushed the get_current_mem branch 2 times, most recently from bec85ac to 6e8b55d Compare November 3, 2021 05:12
@yangzhg yangzhg force-pushed the get_current_mem branch 3 times, most recently from dc24a76 to cf12d58 Compare November 10, 2021 02:13
#if !defined(ADDRESS_SANITIZER) && !defined(LEAK_SANITIZER) && !defined(THREAD_SANITIZER)
doris::MemInfo::refresh_current_mem();
#endif
sleep(10);
Copy link
Member Author

Choose a reason for hiding this comment

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

10ms

if (MemInfo::current_mem() + bytes >= MemInfo::mem_limit()) {
return Status::MemoryLimitExceeded(fmt::format(
"{}: TryConsume failed, bytes={} process whole consumption={} mem limit={}",
label_, bytes, MemInfo::current_mem(), MemInfo::mem_limit()));
Copy link
Member Author

Choose a reason for hiding this comment

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

Status::MemoryLimitExceeded not MemTracker::MemLimitExceeded

Add all memory usage check when TryConsume memory
Copy link
Contributor

@morningman morningman left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 23, 2021
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Contributor

PR approved by anyone and no changes requested.

@yangzhg yangzhg merged commit e2d3d01 into apache:master Nov 24, 2021
@yangzhg yangzhg deleted the get_current_mem branch February 14, 2022 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. area/memory-consumption kind/improvement reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants