Redis: Cluster vs Sentinel, Speed vs Cost

Redis Sentinel

As depicted in diagram below in this topology Redis will have one master and multiple salves. Client will interact with master and data replication from master to slaves will be asynchronous operation. If for any reason master goes down application will be in down state till a slave becomes a master. You can have any number of slaves but its good to have atleast 2 slaves because in case of master going down you will still have 2 nodes to perform the role of master and slave till 3rd node comes back. This ensures a good amount of availability in Sentinel topology.

Redis Sentinel topology
  • Notification: This is when the sentinel notifies other programs or other system administrators via an API when there is something wrong with the monitoring instances.
  • Automatic Failover: On a master failure, the sentinel promotes one of the slaves to become the new master and then makes the other additional slaves use the new master.
  1. Sentinel works even if not all the Sentinel processes are working, making the system robust against failures. There is no fun in having a failover system which is itself a single point of failure, after all.

Redis Clustering

A stable version of Redis Cluster was introduced in Redis version three. Redis Cluster is a data sharding solution with automatic management, failover, and replication.

Redis Cluster topology

How to decide between Sentinel vs Cluster

  • Scalability: As Redis keeps data in memory so data size become one of the prime factor in decision. For small datasets of few GBs Sentinel could be good option.If we have data more than 20 GB I would recommend to build cluster with lesser number of nodes which can we increased later as well as data grows. Redis provides great cli support to add new master nodes in cluster later.
  • Cost of running: Irrespective of Sentinel and cluster to achieve higher availability every master should have minimum 2 slaves. As cluster will have more nodes to achieve it, cost of running redis cluster is much higher compared to sentinel.
  • Performance: Redis is single threaded hence in Sentinel through single master only one operation is performed at a time while cluster parallelism can be built by increasing more masters.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store