diff --git a/VERSION b/VERSION index b50214693..75a22a26a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.0.2 +3.0.3 diff --git a/roles/autotuning/tasks/setup_tuned.yml b/roles/autotuning/tasks/setup_tuned.yml index 4eac5b727..12a6d882f 100644 --- a/roles/autotuning/tasks/setup_tuned.yml +++ b/roles/autotuning/tasks/setup_tuned.yml @@ -1,4 +1,25 @@ --- +# With vm.swapiness=1 and vm.overcommit_memory=2, vm.overcommit_ratio should +# allow the system to use the entire memory available. +# +# RAM * vm.overcommit_ratio +# Max Alloc = SWAP + ------------------------- +# 100 +# +# If we want to allow the system to allocate the entire memory (Max Alloc = +# RAM), then, overcommit_ratio is calculated as below: +# +# RAM - SWAP +# vm.overcommit_ratio = ------------ * 100 +# RAM +# +# We ensure a minimum value of 50. This is usefull for the case when the amount +# of swap memory is ridiculous higher than the RAM size +- name: Set vm_overcommit_ratio + set_fact: + vm_overcommit_ratio: >- + {{ [ ((ansible_memtotal_mb - ansible_swaptotal_mb) / ansible_memtotal_mb * 100) | int, + 50 ] | max }} - name: Set the variable tuned_disk_elevator for CentOS/RHEL 7 set_fact: diff --git a/roles/autotuning/templates/tuned.conf.template b/roles/autotuning/templates/tuned.conf.template index e103d0740..5a076e99d 100644 --- a/roles/autotuning/templates/tuned.conf.template +++ b/roles/autotuning/templates/tuned.conf.template @@ -10,6 +10,7 @@ elevator={{ tuned_disk_elevator }} [sysctl] {% if 'pemserver' not in group_names %} vm.overcommit_memory=2 +vm.overcommit_ratio={{ vm_overcommit_ratio }} vm.swappiness=1 {% endif %} vm.dirty_ratio=30