![](/img/trans.png)
[英]How to disable Transparent Huge Pages (THP) in Ubuntu 16.04LTS
[英]Solving Redis warnings on overcommit_memory and Transparent Huge Pages for Ubuntu 16.04 on EC2
在新的Ubuntu 16.04 EC2实例上,警告显示如下:
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 restarted after THP is disabled.
如何永久消除它们?
就像警告所示,只需将行vm.overcommit_memory=1
添加到/etc/sysctl.conf
的底部,使用类似sudo vi /etc/sysctl.conf
。
但权限不允许您按照警告的建议编辑THP,所以改为
sudo apt install hugepages
并使用sudo vi ~/.bashrc
类的sudo vi ~/.bashrc
将命令sudo hugeadm --thp-never
到.bashrc的底部。
然后只需sudo reboot
,下次你在运行redis-server
时SSH,警告就消失了!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.