💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### redis优化 启动后查看日志会有3个警告 ``` 30914:M 03 Jan 16:30:34.425 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 30914:M 03 Jan 16:30:34.425 # Server started, Redis version 3.0.7 30914:M 03 Jan 16:30:34.425 # 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. 30914:M 03 Jan 16:30:34.425 # 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 查看当前系统的设置 ``` [root@redis-90 ~]# cat /proc/sys/vm/overcommit_memory 0 ``` 设置 ``` [root@redis-90 ~]# echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf ``` 验证 ``` [root@redis-90 ~]# cat /proc/sys/vm/overcommit_memory 1 ``` ## 第二个警告:Transparent Huge Pages (THP) ``` [root@redis-90 ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/enabled echo never > /sys/kernel/mm/transparent_hugepage/enabled ``` 写入rc.local ## 第三个警告 ``` [root@redis-90 ~]# cat /proc/sys/net/core/somaxconn 128 [root@redis-90 ~]# echo 511 > /proc/sys/net/core/somaxconnecho 511 > /proc/sys/net/core/somaxconn [root@redis-90 ~]# cat /proc/sys/net/core/somaxconn 511 ``` 然后重启服务查看日志已经没有警告了