티스토리 뷰

처음 Redis 를 설치 후 구동시 아래와 같은 Warning을 볼 수 있으실 것 입니다. 여기서는 이 Warning 들을 제거 하는 방법들에 관해서 알려 드리겠습니다.



 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
 # 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.

1.  TCP backlog 경고


WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.


 기본적인 소켓 accept limit 값입니다. 보통 리눅스 배포판에는 128로 되어있고 이 때문에 tcp backlog 의 셋팅이 511 로 되어있지만 강제로 128로 적용 된다는 뜻입니다. 아래의 명령어로 1024 혹은 더욱 높은 값으로 설정해 주도록 합니다. ( 최고는 65535 )


$ sysctl -w net.core.somaxconn=1024
$ echo "net.core.somaxconn=1024" >> /etc/sysctl.conf




2. overcommit_memory 경고


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.


 메모리 이용에 관한 설정 내용입니다. 만약 메모리 이용이 허용량보다 넘어 가게 될 경우에 관한 처리인데요. 


관련 내용 : https://www.kernel.org/doc/Documentation/vm/overcommit-accounting


해결 방법은 아래의 명령어로 가능합니다.


$ sudo sysctl vm.overcommit_memory=1
$ echo "vm.overcommit_memory=1" >> /etc/sysctl.conf

확인은 

$ sysctl -a | grep vm.overcommit_memory




3. THP 경고


 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.


 THP 기능이 켜져 있어서 생기는 에러 입니다. THP 의 경우 redis 에 문제를 생기게 할 수 있기 때문에 사용하지 않게 할 경우 아래의 명령어로  꺼줄 수 있습니다.


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

그리고 재 부팅시 재설정을 변경하기 위해 /etc/rc.local 에 위의 명령어를 넣어 주도록 합니다.

vim /etc/rc.local

그리고 exit 0 위에 넣어 주도록합니다.

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

설정의 확인은 cat /proc/meminfo | grep AnonHugePages 로 AnonHugePages 가 0 으로 뜨면 정상적으로 적용된 것입니다.


* 설정이 적용되더라도 0이 아닐 수 있으니 이 경우 재부팅을 진행하여 주시기 바랍니다.


THP 관련 내용 

https://access.redhat.com/site/documentation/ko-KR/Red_Hat_Enterprise_Linux/6/html/Performance_Tuning_Guide/s-memory-transhuge.html








공유하기 링크
댓글