-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
[native] Add LinuxMemoryChecker check/warning to ensure system-mem-limit-gb is reasonably set #24149
base: master
Are you sure you want to change the base?
[native] Add LinuxMemoryChecker check/warning to ensure system-mem-limit-gb is reasonably set #24149
Conversation
4478ae1
to
15f55bb
Compare
15f55bb
to
7646600
Compare
…ystem-mem-limit-gb < actual total memory capacity.
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.
Can we add a test with fake files again just like we did with the original tests for this class?
That way we can try the "max" value for cgv2, and gigantic values and reasonable values. Basically testing the various situations we saw when investigating this.
void start() { | ||
// Set memMaxFile to "/sys/fs/cgroup/memory/memory.limit_in_bytes" for | ||
// cgroup v1 or "sys/fs/cgroup/memory.max" for cgroup v2. | ||
struct stat buffer; |
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.
Do we need to re-declare this as a struct here?
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.
Tried declaring it as stat buffer;
and got error:
/root/presto/presto-native-execution/./presto_cpp/main/LinuxMemoryChecker.cpp:30:9: error: expected ‘;’ before ‘buffer’
30 | stat buffer;
int64_t actualTotalMemory = 0; | ||
folly::gen::byLine("/proc/meminfo") | | ||
[&](const folly::StringPiece& line) -> void { | ||
if (actualTotalMemory == 0) { |
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.
We don't need this check because we return immediately if it is set on line 79.
}; | ||
} | ||
|
||
VELOX_CHECK_LT( |
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.
We should allow less or equal.
return; | ||
} | ||
}; | ||
if (memMaxFile != "None") { |
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.
We might need to add a comment here as to what the content could be for the maxMemFile. Since we check for the "max" keyword too.
Description
Add LinuxMemoryChecker check and warning to ensure system-memory-gb < system-mem-limit-gb < actual total memory capacity.
For cgroup v1:
Set actual total memory to be the smaller number between /proc/meminfo and memory.limit_in_bytes
For cgroup v2:
Set actual total memory to be the smaller number between /proc/meminfo and memory.max
If memory.max contains "max" string, then look at /proc/meminfo for the MemTotal, otherwise use the value in memory.max.
VELOX_CHECK_LT(system-mem-limit-gb, actual total memory capacity):
Warning to output to worker's log:
Motivation and Context
Impact
Test Plan
Contributor checklist
Release Notes
Please follow release notes guidelines and fill in the release notes below.