On Oct 31, 2012 7:43 AM, "Howard" <
howa...@gmail.com> wrote:
> On Tuesday, October 30, 2012 11:39:57 PM UTC+8, Josiah Carlson wrote:
>> On disk use of the AOF will vary depending on your application.
>>
> So redis can't just set a max value and auto rotate when it exceed this value?
Not really, no. But do you know of another database that offers that
kind of guarantee while also offering the variety of data types and
access patterns that Redis offers?
> I am wondering what are the advantage in using 'auto-aof-rewrite-percentage' and 'auto-aof-rewrite-min-size' except more confusion..
It's not confusing if you read the documentation.
Redis won't automatically rewrite the AOF if it is below
auto-aof-rewrite-min-size, obviously. And Redis won't automatically
rewrite the AOF if since the last rewrite, the file size has not grown
auto-aof-rewrite-percentage larger than before.
So to get the AOF to be automatically rewritten, assuming that
auto-aof-rewrite-min-size is 64M, the last rewrite produced a file of
size X megabytes, and you leave auto-aof-rewrite-percentage at 100,
then you will get a rewrite of the AOF when it reaches max(64, 2*X)
megabytes in size. When it gets that large, it will create a new file
of approximately X megabytes again, plus whatever writes you've
received while the rewrite was happening. So you will likely have a
bit more than 3X on disk before the original 2X AOF is deleted,
dropping you back to ~X before it starts growing again.
Note that the X is relatively unrelated to your in-memory size.
Depending on your data structures, I usually expect that a dump or AOF
will be approximately 1/20 to 1/5 the in-memory size. So if you are
limiting it to 4 gigabytes, your 'X' will likely be around 200M-800M
if your data is anything like mine.
The reason I recommended that you test is because *your data* and
*your access patterns* will determine the actual X related to your 4G.
If you do your calculations right, your on-disk required space may be
substantially less than the 4G that you set aside for it in your first
email.
Regards,
- Josiah