redis / redis

Redis is an in-memory database that persists on disk. The data model is key-value, but many different kind of values are supported: Strings, Lists, Sets, Sorted Sets, Hashes, Streams, HyperLogLogs, Bitmaps.

Home Page:http://redis.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Understand how auto AOF rewrite works

ammirator-administrator opened this issue · comments

Let's say I have this configuration, I want to understand when eventual rewrites will be triggered
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

Is my understanding correct of this:

1 rewrite (when file is 64mb) --> 2 rewrite (when file is 128mb) --> 3 rewrite (when file is 192mb)

so +64 on every step is that right?
Or is that calculated otherwise

auto-aof-rewrite-percentage is 100 means the current size of aof file should twice as large as the size last rewrite.

1 rewrite (when file is 64mb) --> 2 rewrite (when file is 128mb) --> 3 rewrite (when file is 256mb)

auto-aof-rewrite-min-size means the aof rewrite is triggered only when the current size of aof file larger than 64mb.

Hmm thats not good)
It just means that it gets bigger and bigger proportionally and you do not have a normal control over it
You just have to trigger manually the rewrites
I think the redis team should come with a better mechanism for this

@ammirator-administrator this is also meant that the size of your data set become biger and bigger, i think no one wants to trigger an auto rewrite every 64mb of growth when the dataset is 100GB.
if you want to rewrite more aggressive, you can reduce the value of auto-aof-rewrite-percentage.

@ammirator-administrator please note that if you use the aof-use-rdb-preamble(yes) config, the increase is the size of dataset, not the size of the .aof file.

aof-use-rdb-preamble (yes)
So does that mean that with this config I'll get what I wanted

1 rewrite (when file is 64mb) --> 2 rewrite (when file is 128mb) --> 3 rewrite (when file is 192mb)

@ammirator-administrator not at all, aof-use-rdb-preamble just means that after rewrite, data will be stored as rdb, for example, if you call 100 writes command for one key, it will only occupy the space of one key in rdb, but if it's aof it will be 100 commands in the aof file.
the mechanism i mentioned in #13250 (comment) is still same.

Thanks @sundb for the answer