我在调查我们系统中的红宝石记忆问题。
我正在努力弄清楚所做的10000项改变是什么(在我看来太多了)
奇怪的是,我得到的10000 changes in 60 seconds. Saving...,但每3分钟,而不是60秒,正如我所期望的。
日志样本:
[10993] 03 Jan 06:37:46.166 * 10000 changes in 60 seconds. Saving...
[10993] 03 Jan 06:37:46.167 * Background saving started by pid 4802
[4802] 03 Jan 06:37:46.170 * DB saved on disk
[4802] 03 Jan 06:37:46.170 * RDB: 2 MB of memory used by copy-on-write
[10993] 03 Jan 06:37:46.268 * Background saving terminated with success
[10993] 03 Jan 06:40:27.140 * 10000 changes in 60 seconds. Saving...
[10993] 03 Jan 06:40:27.141 * Background saving started by pid 5081
[5081] 03 Jan 06:40:27.145 * DB saved on disk
[5081] 03 Jan 06:40:27.145 * RDB: 2 MB of memory used by copy-on-write
[10993] 03 Jan 06:40:27.242 * Background saving terminated with success
[10993] 03 Jan 06:43:08.335 * 10000 changes in 60 seconds. Saving...redis_version:2.8.4
发布于 2016-01-07 18:22:10
save 60 10000在您的配置中意味着,redis定期检查是否有至少10000次更改,和,它的是,至少是,从上次rdb保存开始60秒。只有在满足这两种条件(对于任何一个保存点)的情况下,才能启动新的rdb保存。
此外,如果您认为~3分钟内的10000次更改听起来很大,请不要忘记,一个命令可以将更改计数增加一个以上,例如MSET。
发布于 2018-03-23 11:52:24
这是从redis.conf文件中复制的,它解释了一切。
################################ SNAPSHOTTING ################################
#
# Save the DB on disk:
#
# save <seconds> <changes>
#
# Will save the DB if both the given number of seconds and the given
# number of write operations against the DB occurred.
#
# In the example below the behaviour will be to save:
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
#
# Note: you can disable saving completely by commenting out all "save" lines.
#
# It is also possible to remove all the previously configured save
# points by adding a save directive with a single empty string argument
# like in the following example:
#
# save ""
save 900 1
save 300 10
save 60 10000如果要查看所有活动,请使用命令monitor
$ redis-cli monitor
1339518083.107412 [0 127.0.0.1:60866] "keys" "*"
1339518087.877697 [0 127.0.0.1:60866] "dbsize"
1339518090.420270 [0 127.0.0.1:60866] "set" "x" "6"
1339518096.506257 [0 127.0.0.1:60866] "get" "x"
1339518099.363765 [0 127.0.0.1:60866] "del" "x"
1339518100.544926 [0 127.0.0.1:60866] "get" "x"https://stackoverflow.com/questions/34651964
复制相似问题