How to calculate how much RAM redis is needed?

I am going to use Redis as a cache to reduce database queries.
I know this is not an explicit answer question, but I'm worried about the size of Redis RAM.

I am going to save 10 million integer numberin some redis sets. (some for user IDs, some for albums, ...) and 2 million lines 30 characters long.

In the MYSQL: a methodint , it is 4 bytes, so 10 million * 4 = 40 million bytes.
and a string with 30 characters can take 30 bytes, 30 bytes * 2 million = 60 million bytes.

So, on paper, I need 100MBto save them in redis, but I know in REAL, it could be different.

Can someone help me estimate how much RAM I need?

+4
source share
1 answer

The best answer is experiment. 100mb is not much, so just press 40 + 60 million random bytes on redis and just multiply to get numbers for 1gb or more. The scale scales linearly.

Play with different types of storage (hashes, etc.).

Bulk insert can help you in your experiments http://redis.io/topics/mass-insert

+3
source

All Articles