Use a single memoryLimit instead of memory and memorySwap

We will make the percent allocation dynamic depending on the system.

When we have servers with a large amount of RAM but little swap, we
seem to use a lot of swap because of 50% allocation strategy. In such
systems, we run out of swap and thus have OOM errors even though there
is a lot of RAM available!
This commit is contained in:
Girish Ramakrishnan
2021-01-19 19:05:35 -08:00
parent 24db6630ee
commit 025eb18411
5 changed files with 64 additions and 26 deletions

View File

@@ -451,11 +451,6 @@ function getPlatformConfig(callback) {
function setPlatformConfig(platformConfig, callback) {
assert.strictEqual(typeof callback, 'function');
for (let addon of [ 'mysql', 'postgresql', 'mail', 'mongodb' ]) {
if (!platformConfig[addon]) continue;
if (platformConfig[addon].memorySwap < platformConfig[addon].memory) return callback(new BoxError(BoxError.BAD_FIELD, 'memorySwap must be larger than memory', { field: 'memory', addon }));
}
settingsdb.set(exports.PLATFORM_CONFIG_KEY, JSON.stringify(platformConfig), function (error) {
if (error) return callback(error);