KB: Redis



Redis is single-threaded (per-shard)

Single threaded nature of RedisRedis uses a mostly single threaded design. This means that a single process serves all the client requests, using a technique called multiplexing. This means that Redis can serve a single request in every given moment, so all the requests are served sequentially.This approach helps Redis maintain consistency and avoid race conditions, even in concurrent and multi-client environments

How data is sharded in Redis:

Redis Cluster does not use consistent hashing, but a different form of sharding where every key is conceptually part of what we call a hash slot. There are 16384 hash slots in Redis Cluster, and to compute the hash slot for a given key, we simply take the CRC16 of the key modulo 16384

Sharding:
Question:- What’s the solution to fix the Split-Brain situation ?
- Answer:- Maintain an odd number of primary shards and two replicas per primary shard. Here is the detailed solution to this problem
  • To prevent something called a split brain situation in a Redis cluster, always keep an odd number of shards in your cluster.
  • Now, when we get a Network-Split, left and right group shall do a count and see if they are in a bigger (majority) or smaller group (minority) ?
  • If a particular group is in Minority, it shall NOT try to trigger a fail-over and shall NOT accept any client write requests.

Comments

Popular posts from this blog

KB: Azure ACA Container fails to start (no User Assigned or Delegated Managed Identity found for specified ClientId)

Electron Process Execution Failure with FSLogix

KB:RMM VS DEX (Remote Monitoring Management vs Digital Employee Experience)