Day11 Redis组态档设定-EVENT NOTIFICATION/GOPHER SERVER/ADVANCED CONFIG/ACTIVE DEFRAGMENTATION

Redis.config

EVENT NOTIFICATION

  • notify-keyspace-events

订阅事件通知,当有想要关注的事件发生时主动通知管理者.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658o88toBENFe.png

# 预设
notify-keyspace-events ""

# E 空间通知  x key到期删除通知  z执行排序操作通知
notify-keyspace-events Exz

GOPHER SERVER

  • gopher-enabled no

是否启用Gopher通讯协定.

Gopher 介绍

https://ithelp.ithome.com.tw/upload/images/20210926/20111658e4X4QA2TbS.png

# 预设
# gopher-enabled no

ADVANCED CONFIG

  • hash-max-ziplist-entries

设定ziplist中允许存储的最大条目个数.(建议可以设定为128)

  • hash-max-ziplist-value

设定ziplist中允许条目value值最大字元数.(建议爲1024)

https://ithelp.ithome.com.tw/upload/images/20210926/20111658Qag1bl1nUm.png

# 预设
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
  • list-max-ziplist-size

设定ziplist列表最大值,有以下五项:
-5:最大大小:64 Kb x不建议用於正常工作负载
-4:最大大小:32 Kb x不推荐
-3:最大大小:16 Kb x可能不推荐
-2:最大大小:8 Kb v很好
-1:最大大小:4 Kb v好

https://ithelp.ithome.com.tw/upload/images/20210926/20111658VWwiSnyDwq.png

# 预设
list-max-ziplist-size -2
  • list-compress-depth

设定一个quicklist两端不被压缩的节点个数.
0: 表示都不压缩.
1: 表示quicklist两端各有1个节点不压缩,中间的节点压缩.
3: 表示quicklist两端各有3个节点不压缩,中间的节点压缩.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658MSIFJp9v56.png

# 预设
list-compress-depth 0
  • set-max-intset-entries

当集合中的元素全是整数,且长度不超过设定时,Redis会选用intset作爲内部编码,大於设定值则用set.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658DwnHMHB8A1.png

# 预设
set-max-intset-entries 512
  • zset-max-ziplist-entries
  • zset-max-ziplist-value

当有序集合的元素小於zset-max-ziplist-entries设定值且同时每个元素的值都小於zset-max-ziplist-value设定值时,Redis会用ziplist来作爲有序集合的内部编码实现,ziplist可以有效的减少内存的使用.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658KMTQp8ddB3.png

# 预设
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
  • hll-sparse-max-bytes

当value值大小 <= hll-sparse-max-bytes使用sparse数据结构.
当value值大小 > hll-sparse-max-bytes使用dense数据结构.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658Vs32OTnN7w.png

# 预设
hll-sparse-max-bytes 3000
  • stream-node-max-bytes
  • stream-node-max-entries

Streams单个节点的字节数,以及切换到新节点之前可能包含的最大项目数.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658hKWvMJZdPO.png

# 预设
stream-node-max-bytes 4096
stream-node-max-entries 100
  • activerehashing

设定是否主动重新散列每100毫秒CPU时间使用1毫秒,以帮助重新散列主Redis散列表(将顶级键mapping到值).

https://ithelp.ithome.com.tw/upload/images/20210926/20111658fCU838Iv2Q.png

# 预设
activerehashing yes
  • client-output-buffer-limit

normal
对用户端输出缓冲进行限制可以强迫那些不从Redis Server读取数据的用户端断开连接,用来强制关闭传输缓慢的用户端.

replica
用户端对於Replica和MONITER,如果client-output-buffer一旦超过256mb,又或者超过64mb持续60秒,那麽服务器就会立即断开用户端连接.

pubsub
用户端对於pubsub,如果client-output-buffer一旦超过32mb,又或者超过8mb持续60秒,那麽服务器就会立即断开用户端连接.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658EsUXpBmpi2.png

# 预设
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
  • client-query-buffer-limit

用户端查询缓冲区累积新命令. 默认情况下,它被限制爲固定数量,以避免协议失步(例如由於客户端中的错误)将导致查询缓冲区中的未绑定内存使用.假如有特殊的需求执行很大的query可以在此配置它.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658cvnnr8g9JN.png

# 预设
# client-query-buffer-limit 1gb
  • proto-max-bulk-len

在Redis协议中,批次请求(即表示单个字元)通常限制爲512mb.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658PDgycrfCdb.png

# 预设
# proto-max-bulk-len 512mb
  • hz

设定hz当增加时,在Redis处於空闲状态下,将使用更多CPU.范围介於1到500之间,大多数用户应使用默认值10,除非仅在需要非常低延迟的环境中将此值提高到100.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658ELW4svWpeO.png

# 预设
hz 10
  • dynamic-hz yes

是否啓用动态hz时,实际配置的hz将用做最少配置,但是一旦连接了更多用户端,将根据实际需要使用配置的hz值的倍数.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658cJKqpFOY4t.png

# 预设
dynamic-hz yes
  • aof-rewrite-incremental-fsync yes

设定使否启用当一个子Process rewrite aof档案时,文件每生成32mb数据会被同步.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658Hx0Kb8COJF.png

# 预设
aof-rewrite-incremental-fsync yes
  • rdb-save-incremental-fsync

设定是否启用当Redis Server保存rdb当案时,则每生成32mb数据将对档案进行fsync.这对於以递增方式将文件提交到磁盘并避免大延迟峯值非常有用.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658hE1t68dRjx.png

# 预设
rdb-save-incremental-fsync yes
  • lfu-log-factor

设定日志因数,决定使键计数器饱和的键命中次数.

  • lfu-decay-time

设定用来递减键计数器的时间.(以分钟计)

https://ithelp.ithome.com.tw/upload/images/20210926/20111658R4miEAuUxN.png

# 预设
# lfu-log-factor 10
# lfu-decay-time 1

ACTIVE DEFRAGMENTATION

https://ithelp.ithome.com.tw/upload/images/20210926/20111658ge6v9sKWx5.png

  • activedefrag

是否啓用碎片整理.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658w7P5ZAWJXr.png

# 预设
# activedefrag no
  • active-defrag-ignore-bytes

啓动活动碎片整理的最小碎片浪费量.

https://ithelp.ithome.com.tw/upload/images/20210926/2011165833VCCIRw5L.png

# 预设
# active-defrag-ignore-bytes 100mb
  • active-defrag-threshold-lower

啓动碎片整理的最小碎片百分比.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658axG5HYRVug.png

# 预设
# active-defrag-threshold-lower 10
  • active-defrag-threshold-upper

使用最大消耗时的最大碎片百分比.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658CqtcxaaGaC.png

# 预设
# active-defrag-threshold-upper 100
  • active-defrag-cycle-min

在CPU百分比中进行碎片整理的最小消耗.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658li8o96LvXN.png

# 预设
# active-defrag-cycle-min 1
  • active-defrag-cycle-max

在CPU百分比达到最大值时,进行碎片整理.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658pk68BKA0U9.png

# 预设
# active-defrag-cycle-max 25
  • active-defrag-max-scan-fields

从set / hash / zset / list 扫描的最大字段数.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658rWQhBVTu4t.png

# 预设
# active-defrag-max-scan-fields 1000
  • jemalloc-bg-thread

默认情况下,用於清除的Jemalloc後台线程是啓用的.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658XLUUtTT5h9.png

# 预设
jemalloc-bg-thread yes
  • server_cpulist

设定Redis Server IO Process使用的threads.

  • bio_cpulist

设定 BIO Process使用的threads.

  • aof_rewrite_cpulist

设定aof IO Process使用的threads.

  • bgsave_cpulist

设定bgsave IO Process使用的threads.

https://ithelp.ithome.com.tw/upload/images/20210926/20111658VLLUgGkwXf.png

# 预设
# server_cpulist 0-7:2
# bio_cpulist 1,3
# aof_rewrite_cpulist 8-11
# bgsave_cpulist 1,10-11
  • ignore-warnings

设定要ignore的检查

https://ithelp.ithome.com.tw/upload/images/20210926/20111658b2eGhxzXLM.png

# 预设
# ignore-warnings ARM64-COW-BUG

<<:  WordPress 如何关闭 XML-RPC 服务,避免资安攻击风险

>>:  大共享时代系列_010_共享居住

<Day11> Contract — 取得指数(Index)资讯

● 这章将以模拟帐户来示范如何取得指数(Index)资讯 回顾上一章,我们学会如何用Contract...

前端工程学习日记第17天

#伪类:before :after做左右画线标题效果 经常可以看到这样的标题设计是在左右有一条横线中...

企划实现(26)

在firebase制作登入系统 可以使用myRef.child("member"...

Day 17 : PHP - MySQLi的面向过程和面向对象是什麽?又该如何做选择?

如标题,这篇想和大家聊聊MySQLi的「面向过程」和「面向对象」是什麽 我当初在学这里时,这个问题困...

Day11:插入排序法(Insertion Sort)

谈谈插入排序(Insertion Sort) 在开始今天之前,先来看看影片(约2分钟)吧! http...