From e6f21f7c99620762827e419f941a8b247a1698d8 Mon Sep 17 00:00:00 2001 From: Vishnu Narayanan Date: Tue, 11 Aug 2026 15:46:05 +0530 Subject: [PATCH] perf: scale sidekiq worker MemoryMax with host memory (#15412) ## Description This systemd unit is installed on every self-hosted Linux install (copied by `deployment/setup_18.04.sh` / `setup_20.04.sh`) as well as our own worker hosts, so the memory cap has to be correct across a wide range of box sizes. It is currently a fixed `MemoryMax=1.2G`, chosen when workers ran on 2GB hosts (#12915). On larger hosts that fixed cap sits at a high fraction of the limit under normal load, so transient spikes hit the hard limit and the worker is OOM-restarted more often than necessary (each restart drops the jobs in-flight at that instant). Switching to `MemoryMax=60%` makes the cap scale with the host's physical memory instead of being fixed: - 2GB host: 60% = 1.2G, identical to today (no regression for small installs) - 4GB host: 60% = ~2.4G, room to absorb spikes without a premature restart - larger hosts scale proportionally `MemoryHigh=infinity` is unchanged, so the worker is still never throttled by cgroup reclaim (kept intentionally since #12871 to avoid reclaim-induced worker stalls). Only the hard cap changes, and only its scaling. Fixes https://linear.app/chatwoot/issue/INF-100 ## Type of change - [x] Performance (non-breaking change which improves performance) --- deployment/chatwoot-worker.1.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/chatwoot-worker.1.service b/deployment/chatwoot-worker.1.service index 66fcbbb53..975ee7c85 100644 --- a/deployment/chatwoot-worker.1.service +++ b/deployment/chatwoot-worker.1.service @@ -17,7 +17,7 @@ StandardInput=null SyslogIdentifier=%p LimitNOFILE=65536 -MemoryMax=1.2G +MemoryMax=60% MemoryHigh=infinity MemorySwapMax=0 OOMPolicy=stop