From bd7d26e84cbff9fe350bced8717faa27a1423dff Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Thu, 21 Feb 2019 18:44:26 +0100 Subject: [PATCH] Improve comments for fedmsg memory limit --- .../fedmsg/hub/templates/fedmsg-hub-systemd.conf.j2 | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/roles/fedmsg/hub/templates/fedmsg-hub-systemd.conf.j2 b/roles/fedmsg/hub/templates/fedmsg-hub-systemd.conf.j2 index 6f67744137..8578801d92 100644 --- a/roles/fedmsg/hub/templates/fedmsg-hub-systemd.conf.j2 +++ b/roles/fedmsg/hub/templates/fedmsg-hub-systemd.conf.j2 @@ -1,16 +1,15 @@ [Service] {% if fedmsg_hub_memory_limit_mb %} +# Limit max RAM usage for fedmsg-hub. Also don't let fedmsg-hub use +# more that half of swap available in the system, so that we don't get +# Nagios alerts about low swap. We would rather have fedmsg-hub OOM +# and be auto-restarted. {% if ansible_distribution_major_version|int > 7 %} -# Don't let fedmsg-hub use more that half of swap available in the -# system, so that we don't get Nagios alerts about low swap. We would -# rather have fedmsg-hub OOM and be auto-restarted. -MemorySwapMax={{ ansible_memory_mb.swap.total / 2 }}M -# Limit RAM usage too +MemorySwapMax={{ (ansible_memory_mb.swap.total / 2) | int }}M MemoryMax={{fedmsg_hub_memory_limit_mb}}M {% else %} -# On RHEL 7 we can only control RAM usage. MemoryLimit={{fedmsg_hub_memory_limit_mb}}M -LimitAS={{ fedmsg_hub_memory_limit_mb + (ansible_memory_mb.swap.total / 2) }}M +LimitAS={{ (fedmsg_hub_memory_limit_mb + (ansible_memory_mb.swap.total / 2)) | int }}M {% endif %} {% endif %}