What happened if a particular Redis cache instance went down?
AI answer
It depends on the Redis topology and whether automatic failover was configured. If an individual node went down, requests to it could fail or time out; in a caching scenario, the application usually tolerates this through degraded operation: some keys become unavailable, data has to be read from the primary source, and then cached again. This can increase database load and latency.
If the node was part of a Sentinel or Cluster configuration and a healthy replica was available, it could be promoted to master, but failover takes time, and with asynchronous replication some of the latest writes may be lost. If it was the only node, the cache was unavailable until recovery. That is why timeout handling, bounded retries, metrics, and a fallback path to the data source are important; a cache should not be treated as a reliable store for the only copy of data.
Also asked at Коммит (Аутстафф на проект "Ростелекома")
- How to protect the system from creating multiple payments if the user presses the pay button many times?
- How is the N+1 query problem solved in ORM?
- What types of indexes are available in PostgreSQL?
- There are several services (2-3), and there is an end-to-end business scenario passing through all services. If an operation on one of the services in the middle or at the end fails, the system ends up in an inconsistent state. What methods can be used to achieve inter-service transactionality (either the entire scenario is applied, or none of it is), if each service has its own database?
- What databases have you worked with the most?
Similar questions
- How was data distributed across Redis instances (sharding or full replication)?
- How was Redis set up in your project (one instance or several)?
- Can we ensure data durability in Redis if the service crashes, so that we don't lose shopping carts?
- What is a Cache Stampede (the problem of simultaneous TTL expiration), and how can you protect a system from degradation when hot keys are invalidated?
- Why is Redis so fast compared with relational databases, and how can data loss be avoided when the Redis process restarts?