From 8f92f4f7d2a9f230fc85776cdfaae66a565674b6 Mon Sep 17 00:00:00 2001 From: Maria van Keulen Date: Mon, 2 Apr 2018 12:06:40 -0400 Subject: SERVER-20056 Warn when wiredTigerCacheSizeGB is > 80% of RAM (cherry picked from commit 657fdff7b50949b50848b1de466c88f7be18034b) --- src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/mongo/db') diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp index f8dc319073c..f1176a2d024 100644 --- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp +++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp @@ -52,6 +52,7 @@ #include "mongo/db/storage/wiredtiger/wiredtiger_server_status.h" #include "mongo/db/storage/wiredtiger/wiredtiger_util.h" #include "mongo/util/log.h" +#include "mongo/util/processinfo.h" namespace mongo { @@ -86,6 +87,19 @@ public: #endif size_t cacheMB = WiredTigerUtil::getCacheSizeMB(wiredTigerGlobalOptions.cacheSizeGB); + const double memoryThresholdPercentage = 0.8; + ProcessInfo p; + if (p.supported()) { + if (cacheMB > memoryThresholdPercentage * p.getMemSizeMB()) { + log() << startupWarningsLog; + log() << "** WARNING: The configured WiredTiger cache size is more than " + << memoryThresholdPercentage * 100 << "% of available RAM." + << startupWarningsLog; + log() << "** See " + "http://dochub.mongodb.org/core/faq-memory-diagnostics-wt" + << startupWarningsLog; + } + } const bool ephemeral = false; WiredTigerKVEngine* kv = new WiredTigerKVEngine(getCanonicalName().toString(), -- cgit v1.2.1