memoryLimit: redefine to not include swap

Currently, we allocate 50% as RAM and 50% as swap. The manifest is
usually quite conservative on memory values. This means that we set
up a system where the app is applying memory pressure almost immediately.
This then swaps things randomly and increases cpu usage (kswapd shows
up in the profile).

To rethink the whole situation: we should not cap apps with a swap limit at all.
The memory hard limit is what is important. By redefining memoryLimit , we are
doubling every container's memory and it's good that we over allocate this.
This commit is contained in:
Girish Ramakrishnan
2024-04-09 18:59:40 +02:00
parent 6c3f8b9b84
commit be2775e12e
8 changed files with 18 additions and 47 deletions
+2 -4
View File
@@ -45,7 +45,6 @@ const assert = require('assert'),
services = require('./services.js'),
settings = require('./settings.js'),
shell = require('./shell.js'),
system = require('./system.js'),
tasks = require('./tasks.js'),
users = require('./users.js');
@@ -145,7 +144,6 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
const image = infra.images.mail;
const memoryLimit = serviceConfig.memoryLimit || exports.DEFAULT_MEMORY_LIMIT;
const memory = await system.getMemoryAllocation(memoryLimit);
const cloudronToken = hat(8 * 128), relayToken = hat(8 * 128);
const certificate = await reverseProxy.getMailCertificate();
@@ -182,8 +180,8 @@ async function configureMail(mailFqdn, mailDomain, serviceConfig) {
--log-opt syslog-address=unix://${paths.SYSLOG_SOCKET_FILE} \
--log-opt syslog-format=rfc5424 \
--log-opt tag=mail \
-m ${memory} \
--memory-swap ${memoryLimit} \
-m ${memoryLimit} \
--memory-swap -1 \
--dns 172.18.0.1 \
--dns-search=. \
-e CLOUDRON_MAIL_TOKEN=${cloudronToken} \