How do you scale Redis horizontally? Or should I focus on vertical scaling?
I have a Redis instance that is growing at a fast rate. How should I add new Redis servers to enable horizontal scaling (something like sharding in DBs)? Or should I just increase the size of current machine?
Use a hashing algorithm to decide to which Redis instance to go to ...
If you have three Redis hosts as example:
host0
host1
host2
Then you'd typically take your key, let's say the key is appName, work out a hash for it, could be something like ((1 + 16 + 16 + 14 + 1 + 13 + 5) MOD 3) => 66 % 3 => host0
Another key could just be abcd => (1 + 2 + 3 + 4) MOD 3 => 10 % 3 => host1
As long as your algorithm to pick the server is consistent across all your applications and even if it's not, you'll simply get duplicated keys.
Jan Vladimir Mostert
Idea Incubator
Use a hashing algorithm to decide to which Redis instance to go to ...
If you have three Redis hosts as example:
Then you'd typically take your key, let's say the key is
appName, work out a hash for it, could be something like ((1 + 16 + 16 + 14 + 1 + 13 + 5) MOD 3) => 66 % 3 => host0Another key could just be
abcd=> (1 + 2 + 3 + 4) MOD 3 => 10 % 3 => host1As long as your algorithm to pick the server is consistent across all your applications and even if it's not, you'll simply get duplicated keys.
Alternatively go the cluster route: http://redis.io/topics/cluster-spec