美文网首页
REDIS----配置文件----ACTIVE DEFRAGME

REDIS----配置文件----ACTIVE DEFRAGME

作者: JuMinggniMuJ | 来源:发表于2020-06-07 07:48 被阅读0次

ACTIVE DEFRAGMENTATION部分:

1.说明:
# Active (online) defragmentation allows a Redis server to compact the
# spaces left between small allocations and deallocations of data in memory,
# thus allowing to reclaim back memory.
#
# Fragmentation is a natural process that happens with every allocator (but
# less so with Jemalloc, fortunately) and certain workloads. Normally a server
# restart is needed in order to lower the fragmentation, or at least to flush
# away all the data and create it again. However thanks to this feature
# implemented by Oran Agra for Redis 4.0 this process can happen at runtime
# in an "hot" way, while the server is running.
#
# Basically when the fragmentation is over a certain level (see the
# configuration options below) Redis will start to create new copies of the
# values in contiguous memory regions by exploiting certain specific Jemalloc
# features (in order to understand if an allocation is causing fragmentation
# and to allocate it in a better place), and at the same time, will release the
# old copies of the data. This process, repeated incrementally for all the keys
# will cause the fragmentation to drop back to normal values.
#
# Important things to understand:
#
# 1. This feature is disabled by default, and only works if you compiled Redis
#    to use the copy of Jemalloc we ship with the source code of Redis.
#    This is the default with Linux builds.
#
# 2. You never need to enable this feature if you don't have fragmentation
#    issues.
#
# 3. Once you experience fragmentation, you can enable this feature when
#    needed with the command "CONFIG SET activedefrag yes".
#
# The configuration parameters are able to fine tune the behavior of the
# defragmentation process. If you are not sure about what they mean it is
# a good idea to leave the defaults untouched.

碎片整理允许Redis服务器压缩内存中少量数据分配和释放之间的剩余空间,从而允许回收内存
碎片化是一个自然的过程,它发生在每个分配器(幸运的是,Jemalloc的情况不那么严重)和某些工作负载上。通常需要重新启动服务器以降低碎片,或者至少刷新掉所有数据并重新创建它。但是,由于Oran Agra for Redis 4.0实现了这个特性,这个过程可以在服务器运行时以“热”方式在运行时发生
基本上,当碎片超过某个级别(见下面的配置选项)时,Redis将开始通过利用某些特定的Jemalloc特性(为了了解分配是否导致碎片并将其分配到更好的位置)在相邻的内存区域中创建值的新副本,同时,将发布旧的数据副本。对所有键递增地重复此过程将导致碎片返回到正常值
1.此功能在默认情况下是禁用的,并且仅当您编译Redis以使用随Redis源代码提供的Jemalloc副本时才起作用。这是Linux版本的默认设置
2.如果没有碎片问题,则不需要启用此功能
3.配置参数能够微调碎片整理进程的行为。如果您不确定它们的含义,最好不要修改默认值

2.是否开启碎片整理:
# Enabled active defragmentation
 activedefrag yes
3.碎片整理忽略大小:
# Minimum amount of fragmentation waste to start active defrag
active-defrag-ignore-bytes 100mb

当碎片达到 100mb 时,开启内存碎片整理

4.碎片整理最低阈值:
# Minimum percentage of fragmentation to start active defrag
active-defrag-threshold-lower 10
当碎片超过 10% 时,开启内存碎片整理
5.碎片整理最高阈值:
# Maximum percentage of fragmentation at which we use maximum effort
active-defrag-threshold-upper 100
内存碎片超过 100%,则尽最大努力整理
6.碎片整理最小CPU使用率:
# Minimal effort for defrag in CPU percentage
active-defrag-cycle-min 5

内存自动整理占用资源最小百分比

7.碎片整理最大CPU使用率:
# Maximal effort for defrag in CPU percentage
# active-defrag-cycle-max 75

内存自动整理占用资源最大百分比

8.碎片整理最大扫描字段:
# Maximum number of set/hash/zset/list fields that will be processed from
# the main dictionary scan
# active-defrag-max-scan-fields 1000

相关文章

网友评论

      本文标题:REDIS----配置文件----ACTIVE DEFRAGME

      本文链接:https://www.haomeiwen.com/subject/suyftktx.html