zoukankan      html  css  js  c++  java
  • redis安装的警告

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

     sudo echo 1024 > /proc/sys/net/core/somaxconn

      在Linux中,/proc/sys/net/core/somaxconn这个参数,linux中内核的一个不错的参数somaxconn

      看下其解析:

      对于一个TCP连接,Server与Client需要通过三次握手来建立网络连接.当三次握手成功后,

      我们可以看到端口的状态由LISTEN转变为ESTABLISHED,接着这条链路上就可以开始传送数据了.

      每一个处于监听(Listen)状态的端口,都有自己的监听队列.监听队列的长度,默认128

    看下FREEBSD的解析:

      限制了接收新 TCP 连接侦听队列的大小。对于一个经常处理新连接的高负载 web服务环境来说,默认的 128 太小了。大多数环境这个值建议增加到 1024 或者更多。 服务进程会自己限制侦听队列的大小(例如 sendmail(8) 或者 Apache),常常在它们的配置文件中有设置队列大小的选项。大的侦听队列对防止拒绝服务 DoS 攻击也会有所帮助。

     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.

    解决
    /etc/sysctl.conf

    添加

    vm.overcommit_memory=1

    刷新配置使之生效

    sysctl vm.overcommit_memory=1 

    overcommit_memory文件指定了内核针对内存分配的策略,其值可以是0、1、2。
    0, 表示内核将检查是否有足够的可用内存供应用进程使用;如果有足够的可用内存,内存申请允许;否则,内存申请失败,并把错误返回给应用进程。
    1, 表示内核允许分配所有的物理内存,而不管当前的内存状态如何。
    2, 表示内核允许分配超过所有物理内存和交换空间总和的内存
    # 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.

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

    chmod a+x /etc/rc.d/rc.local

  • 相关阅读:
    2020 CCPC Wannafly Winter Camp Day2 K题 破忒头的匿名信(AC自动机+dp)
    CF1446C Xor Tree(01Trie)
    day04---系统重要文件
    day03--vi和vim快捷方式及操作系统目录介绍
    day02---虚拟机上网模式
    day01---操作系统安装环境准备
    django中一些快捷函数
    django中的一些装饰器用法
    auth模块的一些方法
    celery中异步延迟执行任务apply_anysc的用法
  • 原文地址:https://www.cnblogs.com/lyy3306/p/6248888.html
Copyright © 2011-2022 走看看