Redis Warning on Transparent Huge Pages

Hello,

I have Redis installed and its showing the following error on redis-server.log

933:M 24 Sep 2020 23:49:06.817 # 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 restarted after THP is disabled.

I tried what’s the warning suggests, I created the file in the directory /etc/rc.local because I don’t have it. Then I tried to add the following line to it. but that didn’t fix the problem.

echo never > /sys/kernel/mm/transparent_hugepage/enabled

Can you help me fix this error.

Try this step by step

Step 1 Run command
echo never > /sys/kernel/mm/transparent_hugepage/enabled

Step 2 Restart Redis
systemctl restart redis-server.service

Step 3 Create
sudo nano /etc/rc.local

Paste these texts into file

#!/bin/bash
echo never > /sys/kernel/mm/transparent_hugepage/enabled
systemctl restart redis-server.service
exit 0

Save and close file

Make it runnable and owned by the root

sudo chown root:root /etc/rc.local
sudo chmod 770 /etc/rc.local

Step 4 Check
sudo tail /var/log/redis/redis-server.log

Step 5 If all ok
sudo reboot

All the best

3 Likes

Problem solved, Thank you for your support.