From 91eb2f7752a711ced0d6e711e5d97c16b446ceb3 Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 27 Oct 2023 17:03:08 -0700 Subject: [PATCH] Kill the app at high RAM, instead of trying to throttle it first Well, sitting at the `MemoryHigh` limit still grinds the app to a halt anyway, lmao. I guess it's a feature designed for well-behaved processes and not for outright leaking ones? Let's try just having systemd basically reset the app regularly when the RAM hits a certain threshold. I think that's what this config will do, we'll find out! --- deploy/files/impress.service | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/deploy/files/impress.service b/deploy/files/impress.service index 7f4a0702..498f0747 100644 --- a/deploy/files/impress.service +++ b/deploy/files/impress.service @@ -11,8 +11,13 @@ Environment="RAILS_ENV=production" Environment="EXECJS_RUNTIME=Disabled" EnvironmentFile=/srv/impress/shared/production.env -; Try not to go over 1GB of RAM, and kill the app at 1.2GB. -MemoryHigh=1G +; Kill the app at 1.2GB of RAM. +; NOTE: It's generally recommended to pair this with a `MemoryHigh` setting, to +; try throttling memory usage before killing altogether. But at time of writing, +; our app has a memory leak that causes it to always keep growing - and then the +; throttling *successfully* keeps it within the RAM limits, just running very +; slowly. Instead, let's always reboot it when it gets too high, and hopefully +; find and fix that leak sometime! MemoryMax=1.2G ; Some security directives, adapted from Akkoma's service file, they seem like sensible defaults!