Boaz
Boaz

Reputation: 5084

redis "10000 changes in 60 seconds" is running only every 3 minutes

I'm investigating redis memory issues on our system.

I'm trying to figure out what are the 10000 changes that are made (it is too many in my opinion)

The weird thing is that I'm getting 10000 changes in 60 seconds. Saving... but every 3 minutes and not 60 seconds as I would have expected.

Log sample:

[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

Upvotes: 3

Views: 10496

Answers (2)

Sameersharma9
Sameersharma9

Reputation: 500

This is copied from the redis.conf file and it explains everything.

################################ 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

If you want to see all the activities use the command 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"

Upvotes: 2

nnog
nnog

Reputation: 1682

save 60 10000 in your config means that redis periodically checks if there has been at least 10000 changes and its been at least 60 seconds since the last rdb save. Only when both of these conditions are met (for any of your save points) does a new rdb save start.

Also, if you think 10000 changes in ~3min sounds like a lot, don't forget that one command can increase the change count by more than one, e.g. MSET.

Upvotes: 4

Related Questions