[Redis] Memory comparison between Redis rdb and aof

Redis logo

So my last post is how to convert redis rdb to aof

I bet you already know, redis aof is take more space then redis rdb, and yes, that is true.


Here is my simple test :

First Instance

$> top -c
952 root 20 0 4000m 3.8g 996 S 2.7 12.2 949:59.76 redis-server /data/r_mengajar/redis.conf
$> ls -hl /data/r_mengajar/
-rw-r--r-- 1 root root 2.9G Aug 12 20:38 dump_mengajar.rdb

That is my redis instance in rdb mode, as you can see, redis eat 3.8g of my memory, while the datasets is 2.9G.

$> top -c
4271 root 20 0 3968m 3.8g 916 S 2.7 12.2 3:24.57 redis-server /data/r_mengajar/redis.conf
$> ls -hl /data/r_mengajar/
-rw-r--r-- 1 root root 4.6G Aug 12 20:39 r_mengajar.aof

And this is my redis instrance in aof mode, using same datasets, I made it from BGREWRITEAOF (look my previous post), as you can see, redis eat 3.8g of my memory, it’s same like rdb, and the datasets 158% larger (4.6G).

Second Instance

$> top -c
4651 root 20 0 4648m 4.5g 920 S 2.7 14.3 0:59.10 redis-server /data/r_ptk/redis.conf
$> ls -hl /data/r_mengajar/
-rw-r--r-- 1 root root 2.8G Jul 26 12:30 dump_ptk.rdb

So I make other test using another instance, redis eat 4.5g of my memory, and the datasets is 2.8G.

$> top -c
4759 root 20 0 4836m 4.5g 940 S 2.3 14.3 6:05.17 redis-server /data/r_ptk/redis.conf
$> ls -hl /data/r_mengajar/
-rw-r--r-- 1 root root 5.5G Aug 12 21:05 r_ptk.aof

And that’s when using aof, redis still eat same memory like rdb, even the datasets is 196% larger (5.5G).

Conclusion

So, using redis in rdb mode, or aof mode, will give you same memory used by redis, even the dataset is larger. The performance, until now, I don’t really feel slower when move to aof,

Redis still blazing fast

Advertisements

One thought on “[Redis] Memory comparison between Redis rdb and aof

  1. […] why I want to move from rdb to aof? 1. My datasets is large (look at my post) and changing every time 2. When some data added to redis in rdb mode, and save, the i/o is very […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s