查看 Clients 属性
|
|
|
|
查看 Memeory 属性
|
|
|
|
-
mem_fragmentation_ratio 查看内存碎片比率,
- 小于<1时,Redis实例可能会把部分数据交换到硬盘上,内存交换会严重影响Redis的性能,所以应该增加可用物理内存
- 大于>1时, 说明碎片占用 更多的内存, 需要整理, 在1~1.5 之间比较健康.
重启Redis服务;也能达到碎片整理目的
查看是否开启自动碎片整理:
config get activedefrag
设置自动碎片整理:
config set activedefrag yes
直接手动整理碎片:
memory purge
-
redis.conf配置设置自动整理碎片
redis 4.0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
# Enabled active defragmentation # 碎片整理总开关 # activedefrag yes # Minimum amount of fragmentation waste to start active defrag # 当碎片达到 100mb 时,开启内存碎片整理 active-defrag-ignore-bytes 100mb # Minimum percentage of fragmentation to start active defrag # 当碎片超过 10% 时,开启内存碎片整理 active-defrag-threshold-lower 10 # Maximum percentage of fragmentation at which we use maximum effort # #内存碎片超过 100%,则尽最大努力整理 active-defrag-threshold-upper 100 # Minimal effort for defrag in CPU percentage # 内存自动整理占用资源最小百分比 active-defrag-cycle-min 25 # Maximal effort for defrag in CPU percentage # 内存自动整理占用资源最大百分比 active-defrag-cycle-max 75
查看 Stats 属性
只列出部分属性. 有代表性的属性.
|
|
|
|