Skip to content

Commit

Permalink
Cancel memory check when the ratio greater than 1.0 (#3289)
Browse files Browse the repository at this point in the history
* Cancel memory check when the ratio greater than 1.0

* Comment

Co-authored-by: Yichen Wang <[email protected]>
  • Loading branch information
yixinglu and Aiee authored Nov 15, 2021
1 parent 026dea5 commit be4d5bb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion conf/nebula-graphd.conf.default
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
--auth_type=password

########## memory ##########
# System memory high watermark ratio
# System memory high watermark ratio, cancel the memory checking when the ratio greater than 1.0
--system_memory_high_watermark_ratio=0.8

########## experimental feature ##########
Expand Down
2 changes: 1 addition & 1 deletion conf/nebula-graphd.conf.production
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
--auth_type=password

########## memory ##########
# System memory high watermark ratio
# System memory high watermark ratio, cancel the memory checking when the ratio greater than 1.0
--system_memory_high_watermark_ratio=0.8

########## experimental feature ##########
Expand Down
3 changes: 3 additions & 0 deletions src/common/memory/MemoryUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ static const std::regex reTotalCache(R"(^total_(cache|inactive_file)\s+(\d+)$)")
std::atomic_bool MemoryUtils::kHitMemoryHighWatermark{false};

StatusOr<bool> MemoryUtils::hitsHighWatermark() {
if (FLAGS_system_memory_high_watermark_ratio >= 1.0) {
return false;
}
double available = 0.0, total = 0.0;
if (FLAGS_containerized) {
FileUtils::FileLineIterator iter("/sys/fs/cgroup/memory/memory.stat", &reTotalCache);
Expand Down

0 comments on commit be4d5bb

Please sign in to comment.