Redis: Database Size to Memory Ratio?

Philip Wernersbach picture Philip Wernersbach · Jan 19, 2011 · Viewed 10.9k times · Source

What is Redis's database size to memory ratio?

For instance, if I have an 80MB database, how much RAM will Redis use (when used with a normal web app)?

Answer

Theo picture Theo · Jan 19, 2011

Redis will use a bit more RAM than disk. The dumpfile format is probably a bit more densely packed. This is some numbers from a real production system (a 64 bit EC2 large instance running Redis 2.0.4 on Ubuntu 10.04):

$ redis-cli info | grep used_memory_human
used_memory_human:1.36G

$ du -sh /mnt/data/redis/dump.rdb 
950M /mnt/data/redis/dump.rdb

As you can see, the dumpfile is a few hundred megs smaller than the memory usage.

In the end it depends on what you store in the database. I have mainly hashes in mine, with only a few (perhaps less than 1%) sets. None of the keys contain very large objects, the average object size is 889 bytes.