1

Suppose I have data that easily fits in memory in a redis database. The redis server runs as a single service on a single process on a single machine. Let's say I have a 100 different machines connect to it often for various reasons. What benefits would I get by having "a cluster of redis nodes" as opposed to just the one? And what is the mental model I should have for a cluster: does each of my 100 other machines need to know in advance which redis node of the redis cluster that they want to connect to, with the redis nodes making sure they replicate the data between each other? Or do the 100 machines all connect to a single node that handles which of the other redis nodes are going to help service whatever the connecting machine wants? Thank you.

1
  • Sharing your research helps everyone. Tell us what you've tried and why it didn't meet your needs. This demonstrates that you've taken the time to try to help yourself, it saves us from reiterating obvious answers, and most of all it helps you get a more specific and relevant answer. Also see How to Ask
    – gnat
    Apr 4, 2021 at 19:07

1 Answer 1

3

Redis clustering splits the cluster on two axis sharding, and replicas. Each shard is made up of one primary, and n secondary replicas.

Multiple shards provide better aggregate write performance by splitting the keyspace so each shard is responsible for part of the keyspace. However more shards can decrease overall availability as if a shard is unavailable that part of the keyspace is unavailable. If your write load is concentrated on a single or small number of keys, this may not help.

Multiple replicas provide better read performance as read queries are spread across all replicas in the shard. Write queries happen on the primary and are then copied to the secondaries. Multiple replicas can also improve availability as if any secondary goes down any other secondary in the shard can be queried, whilst if the primary goes down a secondary can be elected to replace it.

1
  • Thank you so much for the very clear and detailed explanation @user1937198 ! Apr 5, 2021 at 3:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.