尽管 appendfsync = no,Redis 父进程仍然破坏磁盘

尽管 appendfsync = no,Redis 父进程仍然破坏磁盘

尽管我们的保存操作设置为每 15 分钟发生一次,但我们仍看到来自 redis-server 的大量 IO。

工作负载是“全页缓存”;我们存储压缩的 HTML 块。如果需要,可以动态重新创建 HTML,因此我们不需要最新的备份/持久性。

服务器规格:

2x Hex Core Intel Xeon E5-2640 2.5GHz
128GB RAM
2x 400GB Intel SSDs in RAID 1

输入输出:

# pidstat -d | grep redis
05:01:35 PM       PID   kB_rd/s   kB_wr/s kB_ccwr/s  Command
05:01:35 PM     23450      0.01   3981.60      0.00  redis-server

redis保存配置:

redis 127.0.0.1:6379> config get save
1) "save"
2) "900 10000"

redis appendfsync 配置:

redis 127.0.0.1:6379> config get appendfsync
1) "appendfsync"
2) "no"

手册

RDB 可最大程度地提高 Redis 的性能,因为 Redis 父进程为了持久化所需要做的唯一工作就是分叉一个子进程,然后由子进程来完成其余所有工作。父实例永远不会执行磁盘 I/O 或类似操作。

因此,当临时子进程存在以执行后台保存操作时,我仅期望 Redis 具有高 IO。

从我们的 Redis 日志中,关于后台保存的内容:

# tail /var/log/redis/redis.log
[23450] 27 Aug 16:43:20 * 10000 changes in 900 seconds. Saving...
[23450] 27 Aug 16:43:20 * Background saving started by pid 47396
[47396] 27 Aug 16:44:28 * DB saved on disk
[23450] 27 Aug 16:44:29 * Background saving terminated with success
[23450] 27 Aug 16:59:30 * 10000 changes in 900 seconds. Saving...
[23450] 27 Aug 16:59:30 * Background saving started by pid 4722
[4722] 27 Aug 17:00:40 * DB saved on disk
[23450] 27 Aug 17:00:40 * Background saving terminated with success

它每 900 秒(15 分钟)运行一次,大约需要 1 分钟才能执行。

我该如何进一步调试它?

相关内容