zoukankan      html  css  js  c++  java
  • redis安装优化:

    1)内存分配控制:
    vm.overcommit_memory
    redis启动时肯呢个会出现这样的日志:

    6135:M 21 Apr 17:25:46.468 # 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.
    6135:M 21 Apr 17:25:46.468 # 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.

    什么是overcommit?
    linux操作系统对于大部分的申请内存的请求都回复yes,以便能运行更多的程序。因为申请内存之后,并不会马上使用内存,这种技术叫做overcommit。如果redis在启动的时候有上面的日志,说明vm.overcommit_memory = 0,redis提示把他设置为1。

    0 表示内核将检查是否有足够的可用内存。如果有足够的可用内存,内存申请通过,否则内存申请失败,并把错误返回给应用进程
    1 表示内核允许超量使用内存直到用完为止。
    2 表示内核绝不过量的使用内存,即系统整个内存地址空间不能超过swap+50%的RAM值,50%是overcommit_ratio默认值,此参数同样支持修改。
    #可用内存值得是物理内存+swap之和;

     日志中的

  • 相关阅读:
    三、linux系统管理
    二、基本命令
    一、基本环境
    mysql-day4
    mysql-day3
    mysql-day2
    mysql-day1
    3、线性表的链式存储结构
    2、线性表之顺序表
    1、时间复杂度
  • 原文地址:https://www.cnblogs.com/pythonal/p/6763191.html
Copyright © 2011-2022 走看看