summaryrefslogtreecommitdiff
path: root/src/mongo/util
diff options
context:
space:
mode:
authorXiangyu Yao <xiangyu.yao@mongodb.com>2017-10-18 19:00:45 -0400
committerXiangyu Yao <xiangyu.yao@mongodb.com>2017-11-10 10:33:48 -0500
commiteaf6c96f4893946cd62d6565d3aab92901b92ad8 (patch)
treeaf6ba5bffb629c819284a7163b0a5af5af36d9d3 /src/mongo/util
parent69ab9781d7a646a6029e5c46d340685e80e404fa (diff)
downloadmongo-eaf6c96f4893946cd62d6565d3aab92901b92ad8.tar.gz
SERVER-29465 Add warning about Windows SystemFileCacheSize for WiredTiger
Diffstat (limited to 'src/mongo/util')
-rw-r--r--src/mongo/util/processinfo.h6
-rw-r--r--src/mongo/util/processinfo_freebsd.cpp4
-rw-r--r--src/mongo/util/processinfo_linux.cpp4
-rw-r--r--src/mongo/util/processinfo_openbsd.cpp4
-rw-r--r--src/mongo/util/processinfo_osx.cpp4
-rw-r--r--src/mongo/util/processinfo_solaris.cpp4
-rw-r--r--src/mongo/util/processinfo_unknown.cpp4
-rw-r--r--src/mongo/util/processinfo_windows.cpp33
8 files changed, 63 insertions, 0 deletions
diff --git a/src/mongo/util/processinfo.h b/src/mongo/util/processinfo.h
index f44ef37799a..0a2d2cc1d22 100644
--- a/src/mongo/util/processinfo.h
+++ b/src/mongo/util/processinfo.h
@@ -157,6 +157,12 @@ public:
static bool blockInMemory(const void* start);
/**
+ * Returns a positive floating point number between 0.0 and 1.0 that
+ * reflects the maximum percentage of RAM the filesystem cache is allowed to grow.
+ */
+ static double getMaxSystemFileCachePercentage();
+
+ /**
* Returns a positive floating point number between 0.0 and 1.0 to inform MMapV1 how much it
* must remap pages to bring the system page file implementation back below a certain
* threshold. A number of 1.0 means remap everything.
diff --git a/src/mongo/util/processinfo_freebsd.cpp b/src/mongo/util/processinfo_freebsd.cpp
index d9bf1aa72fd..ce07c514753 100644
--- a/src/mongo/util/processinfo_freebsd.cpp
+++ b/src/mongo/util/processinfo_freebsd.cpp
@@ -120,6 +120,10 @@ int ProcessInfo::getResidentSize() {
return rss;
}
+double ProcessInfo::getMaxSystemFileCachePercentage() {
+ return 0.0;
+}
+
double ProcessInfo::getSystemMemoryPressurePercentage() {
return 0.0;
}
diff --git a/src/mongo/util/processinfo_linux.cpp b/src/mongo/util/processinfo_linux.cpp
index c2813b026b0..a3310e64e95 100644
--- a/src/mongo/util/processinfo_linux.cpp
+++ b/src/mongo/util/processinfo_linux.cpp
@@ -451,6 +451,10 @@ int ProcessInfo::getResidentSize() {
return (int)((p.getResidentSizeInPages() * getPageSize()) / (1024.0 * 1024));
}
+double ProcessInfo::getMaxSystemFileCachePercentage() {
+ return 0.0;
+}
+
double ProcessInfo::getSystemMemoryPressurePercentage() {
return 0.0;
}
diff --git a/src/mongo/util/processinfo_openbsd.cpp b/src/mongo/util/processinfo_openbsd.cpp
index dc3e43d8636..a4c1d0f9ab2 100644
--- a/src/mongo/util/processinfo_openbsd.cpp
+++ b/src/mongo/util/processinfo_openbsd.cpp
@@ -130,6 +130,10 @@ int ProcessInfo::getResidentSize() {
return rss;
}
+double ProcessInfo::getMaxSystemFileCachePercentage() {
+ return 0.0;
+}
+
double ProcessInfo::getSystemMemoryPressurePercentage() {
return 0.0;
}
diff --git a/src/mongo/util/processinfo_osx.cpp b/src/mongo/util/processinfo_osx.cpp
index c82aa3f9411..475016de313 100644
--- a/src/mongo/util/processinfo_osx.cpp
+++ b/src/mongo/util/processinfo_osx.cpp
@@ -118,6 +118,10 @@ int ProcessInfo::getResidentSize() {
return (int)(ti.resident_size / (1024 * 1024));
}
+double ProcessInfo::getMaxSystemFileCachePercentage() {
+ return 0.0;
+}
+
double ProcessInfo::getSystemMemoryPressurePercentage() {
return 0.0;
}
diff --git a/src/mongo/util/processinfo_solaris.cpp b/src/mongo/util/processinfo_solaris.cpp
index c8a7110e738..3bd892de4e8 100644
--- a/src/mongo/util/processinfo_solaris.cpp
+++ b/src/mongo/util/processinfo_solaris.cpp
@@ -127,6 +127,10 @@ int ProcessInfo::getResidentSize() {
return static_cast<int>(p.psinfo.pr_rssize / 1024);
}
+double ProcessInfo::getMaxSystemFileCachePercentage() {
+ return 0.0;
+}
+
double ProcessInfo::getSystemMemoryPressurePercentage() {
return 0.0;
}
diff --git a/src/mongo/util/processinfo_unknown.cpp b/src/mongo/util/processinfo_unknown.cpp
index 8984012b13c..a8960e27de0 100644
--- a/src/mongo/util/processinfo_unknown.cpp
+++ b/src/mongo/util/processinfo_unknown.cpp
@@ -53,6 +53,10 @@ int ProcessInfo::getResidentSize() {
return -1;
}
+double ProcessInfo::getMaxSystemFileCachePercentage() {
+ return 0.0;
+}
+
double ProcessInfo::getSystemMemoryPressurePercentage() {
return 0.0;
}
diff --git a/src/mongo/util/processinfo_windows.cpp b/src/mongo/util/processinfo_windows.cpp
index 06c81b2e0f8..676204c9856 100644
--- a/src/mongo/util/processinfo_windows.cpp
+++ b/src/mongo/util/processinfo_windows.cpp
@@ -119,6 +119,39 @@ int ProcessInfo::getResidentSize() {
return _wconvertmtos(pmc.WorkingSetSize);
}
+double ProcessInfo::getMaxSystemFileCachePercentage() {
+ SIZE_T minCacheSize = 0;
+ SIZE_T maxCacheSize = 0;
+ DWORD flags = 0;
+ BOOL status = GetSystemFileCacheSize(&minCacheSize, &maxCacheSize, &flags);
+ if (!status) {
+ DWORD gle = GetLastError();
+ severe() << "GetSystemFileCacheSize failed with " << errnoWithDescription(gle);
+ fassertFailed(40667);
+ }
+
+ if (!(flags & FILE_CACHE_MAX_HARD_ENABLE)) {
+ return 1.0;
+ }
+
+ MEMORYSTATUSEX mse;
+ mse.dwLength = sizeof(mse);
+ status = GlobalMemoryStatusEx(&mse);
+ if (!status) {
+ DWORD gle = GetLastError();
+ severe() << "GlobalMemoryStatusEx failed with " << errnoWithDescription(gle);
+ fassertFailed(40668);
+ }
+
+ DWORDLONG totalMemorySize = mse.ullTotalPhys;
+ if (totalMemorySize == 0) {
+ severe() << "Total memory is 0";
+ fassertFailed(40669);
+ }
+
+ return static_cast<double>(maxCacheSize) / totalMemorySize;
+}
+
double ProcessInfo::getSystemMemoryPressurePercentage() {
MEMORYSTATUSEX mse;
mse.dwLength = sizeof(mse);