Redis Warnings: overcommit_memory is set to 0! & Transparent Huge Pages (THP) vm.overcommit_memory = 1

My Redis logs show the following warnings:

WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add vm.overcommit_memory = 1 to /etc/sysctl.conf and then reboot or run the command sysctl vm.overcommit_memory=1 for this to take effect.

WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command echo never > /sys/kernel/mm/transparent_hugepage/enabled as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be rest>
(console won’t show the rest of the information after last word rest>

Is is safe to make these changes and are the commands accurate and compatible with Clear Linux??

I have not seen documentation supporting that. Hugepages should be safe, overcommit I don’t know.

Note that the defaults in ClearLinux are common and widely used. The ones we change are often changed only after we do testing/validation on them to make sure they work as expected. In this case the message comes from redis and we have not validated the claims. It is also unclear if these recommendations make any sense for a ClearLinux system, or whether they were added for an ancient RHEL 3 version, for instance.

In other words: make these changes at your own risk.

The overcommit one I am totally unsure about.

Hugepages is something you can turn off/on - only performance should be affected.

for sysctl, put a file in e.g. /etc/sysctl/local.conf instead. The rc.local method is crude but also works. There are several ways of doing this, since it’s just writing a file at boot - even tmpfiles.d can do this.