summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
diff options
context:
space:
mode:
authorDan Pasette <dan@mongodb.com>2016-03-29 14:14:21 -0400
committerDan Pasette <dan@mongodb.com>2016-04-08 16:56:12 -0400
commit5ee7b56b5b625dc62ef80ce4f5742ab837097567 (patch)
tree7ee50759cadc7fd85746c0086695a580560cd132 /src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
parent8574968bae67abc3c67822d681de550136dfb526 (diff)
downloadmongo-5ee7b56b5b625dc62ef80ce4f5742ab837097567.tar.gz
SERVER-23391 Lower WiredTiger cache size floor
Diffstat (limited to 'src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp')
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
index 5ccc1093549..fffbf9c3fc9 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
@@ -62,24 +62,27 @@ public:
}
size_t cacheSizeGB = wiredTigerGlobalOptions.cacheSizeGB;
+ size_t cacheSizeMB = 256; // minimum cache size
if (cacheSizeGB == 0) {
// Since the user didn't provide a cache size, choose a reasonable default value.
// We want to reserve 1GB for the system and binaries, but it's not bad to
// leave a fair amount left over for pagecache since that's compressed storage.
+ // If ProcessInfo indicates that there is < 2GB of memory, allocate 256M for cache.
+ // If ProcessInfo indicates exactly 2GB, allocate 614MB
ProcessInfo pi;
double memSizeMB = pi.getMemSizeMB();
- if (memSizeMB > 0) {
+ if (memSizeMB >= 1024 * 2) {
double cacheMB = (memSizeMB - 1024) * 0.6;
- cacheSizeGB = static_cast<size_t>(cacheMB / 1024);
- if (cacheSizeGB < 1)
- cacheSizeGB = 1;
+ cacheSizeMB = static_cast<size_t>(cacheMB);
}
+ } else {
+ cacheSizeMB = 1024 * cacheSizeGB;
}
const bool ephemeral = false;
WiredTigerKVEngine* kv = new WiredTigerKVEngine(getCanonicalName().toString(),
params.dbpath,
wiredTigerGlobalOptions.engineConfig,
- cacheSizeGB,
+ cacheSizeMB,
params.dur,
ephemeral,
params.repair,