Redis optimization: initiate resolution of warning issues (actions that must be done)
If no changes are made to the linux kernel before startup, redis startup will report three warnings: as shown in the following figure
First warning: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/core/somaxconn is set to the lower value of 128.
The TCP backlog setting value 511 did not succeed because the / proc/sys/net/core/somaxconn setting is a smaller 128.
Temporary solution: (that is, you need to modify this value the next time you start)
Echo 511 > / proc/sys/net/core/somaxconn
Permanent solution: (that is, this value needs to be modified for later startup)
Write it to the / etc/rc.local file.
The baklog parameter actually controls the size of the accept queue that has been shaken successfully for 3 times.
Refer to backlog in linux for detailed explanation.
Second 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.
The overcommit_memory parameter is set to 0! The daemon save may fail in the case of insufficient memory. It is recommended that you modify overcommit_memory to 1 in the file / etc/sysctl.conf.
Temporary solution: echo "vm.overcommit_memory=1" > / etc/sysctl.conf
Permanent solution: write it to the / etc/sysctl.conf file.
Reference: questions about redis overcommit_memory under linux
The third warning: you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix thisissue 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 thesetting after a reboot. Redis must be restarted after THP is disabled.
You are using transparent large pages, which may cause redis latency and memory usage problems. Execute echo never > / sys/kernel/mm/transparent_hugepage/enabled to fix the problem.
Temporary solution:
Echo never > / sys/kernel/mm/transparent_hugepage/enabled
Permanent solution:
Write it to the / etc/rc.local file.