Try implementing fedmsg memory limit on RHEL 7

This commit is contained in:
Mikolaj Izdebski 2019-02-21 18:25:36 +01:00
parent 8cf6d4f021
commit 29c150fcff
3 changed files with 8 additions and 8 deletions

View file

@ -36,7 +36,7 @@ custom_rules: [ '-A INPUT -p tcp -m tcp -s 10.5.126.13 --dport 873 -j ACCEPT', '
fas_client_groups: sysadmin-noc,sysadmin-releng,sysadmin-mbs,sysadmin-veteran fas_client_groups: sysadmin-noc,sysadmin-releng,sysadmin-mbs,sysadmin-veteran
# Set very low memory limit, for testing. # Set very low memory limit, for testing.
fedmsg_hub_memory_limit: 10M fedmsg_hub_memory_limit_mb: 10
# These are consumed by a task in roles/fedmsg/base/main.yml # These are consumed by a task in roles/fedmsg/base/main.yml
fedmsg_certs: fedmsg_certs:

View file

@ -1,10 +1,9 @@
# This is false by default. You have to override it when including the role. # This is false by default. You have to override it when including the role.
enable_websocket_server: False enable_websocket_server: False
# Absolute memory limit in bytes for fedmsg-hub and fedmsg-bub-3 # Absolute memory limit in megabytes for fedmsg-hub and fedmsg-bub-3
# services. The value the value can be suffixed with K, M, G or T. # services. Zero means infinity (no limit).
# Zero means infinity (no limit). fedmsg_hub_memory_limit_mb: 0
fedmsg_hub_memory_limit: 0
# Restart fedmsg-hub.service on failure. # Restart fedmsg-hub.service on failure.
fedmsg_hub_auto_restart: False fedmsg_hub_auto_restart: False

View file

@ -1,15 +1,16 @@
[Service] [Service]
{% if fedmsg_hub_memory_limit %} {% if fedmsg_hub_memory_limit_mb %}
{% if ansible_distribution_major_version|int > 7 %} {% if ansible_distribution_major_version|int > 7 %}
# Don't let fedmsg-hub use more that half of swap available in the # 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 # system, so that we don't get Nagios alerts about low swap. We would
# rather have fedmsg-hub OOM and be auto-restarted. # rather have fedmsg-hub OOM and be auto-restarted.
MemorySwapMax={{ ansible_memory_mb.swap.total / 2 }}M MemorySwapMax={{ ansible_memory_mb.swap.total / 2 }}M
# Limit RAM usage too # Limit RAM usage too
MemoryMax={{fedmsg_hub_memory_limit}} MemoryMax={{fedmsg_hub_memory_limit_mb}}M
{% else %} {% else %}
# On RHEL 7 we can only control RAM usage. # On RHEL 7 we can only control RAM usage.
MemoryLimit={{fedmsg_hub_memory_limit}} MemoryLimit={{fedmsg_hub_memory_limit_mb}}M
LimitAS={{ fedmsg_hub_memory_limit_mb + (ansible_memory_mb.swap.total / 2) }}M
{% endif %} {% endif %}
{% endif %} {% endif %}