Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis: Database Size to Memory Ratio?

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)?

like image 288
Philip Wernersbach Avatar asked Jan 19 '11 04:01

Philip Wernersbach


1 Answers

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.

like image 91
Theo Avatar answered Sep 21 '22 13:09

Theo