Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate how much RAM redis needs?

Tags:

redis

I am going to use Redis as a cache to reduce requests to database.
I know this is not a question with an explicit answer but I am worried about the size of RAM Redis needs.

I am going to save 10 million integer number in some redis sets. ( some for user IDs, some for Album IDs, ... ) and 2 million string with 30 chars length.

In MYSQL way: an int is 4byte, So 10 million * 4 = 40 million bytes.
and a string with 30 character can take 30bytes, 30byte * 2 million = 60 million bytes.

So on paper, I need 100MB to store these in redis, but I know in REAL, it can be different.

Can someone help me to estimate how much RAM do I need?

like image 821
Pars Avatar asked Dec 22 '13 21:12

Pars


Video Answer


1 Answers

The best answer is experiment. 100mb is not that much, so just push 40+60 million of random bytes into redis and just multiply to get numbers for 1gb and more. Storage size scales linearly.

Play with different storage types (hashes and so on).

Mass insertion might help you in your experiments http://redis.io/topics/mass-insert

like image 147
Sergey Eremin Avatar answered Sep 21 '22 20:09

Sergey Eremin