From be4d5bbfd9125673acb5d71a02e1ddc903b9ee5d Mon Sep 17 00:00:00 2001 From: Yee <2520865+yixinglu@users.noreply.github.com> Date: Mon, 15 Nov 2021 17:30:25 +0800 Subject: [PATCH] Cancel memory check when the ratio greater than 1.0 (#3289) * Cancel memory check when the ratio greater than 1.0 * Comment Co-authored-by: Yichen Wang <18348405+Aiee@users.noreply.github.com> --- conf/nebula-graphd.conf.default | 2 +- conf/nebula-graphd.conf.production | 2 +- src/common/memory/MemoryUtils.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/conf/nebula-graphd.conf.default b/conf/nebula-graphd.conf.default index fa406f8008a..43792df94c3 100644 --- a/conf/nebula-graphd.conf.default +++ b/conf/nebula-graphd.conf.default @@ -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 ########## diff --git a/conf/nebula-graphd.conf.production b/conf/nebula-graphd.conf.production index 26bc28827cf..09f26e5169e 100644 --- a/conf/nebula-graphd.conf.production +++ b/conf/nebula-graphd.conf.production @@ -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 ########## diff --git a/src/common/memory/MemoryUtils.cpp b/src/common/memory/MemoryUtils.cpp index 442e7a87597..43477149eff 100644 --- a/src/common/memory/MemoryUtils.cpp +++ b/src/common/memory/MemoryUtils.cpp @@ -27,6 +27,9 @@ static const std::regex reTotalCache(R"(^total_(cache|inactive_file)\s+(\d+)$)") std::atomic_bool MemoryUtils::kHitMemoryHighWatermark{false}; StatusOr 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);