06 Nov 2024

Redis and KeyDB: A tale of two caches

A client experienced a Redis cache outage, leading to a complete web application failure. To address this issue, they implemented KeyDB, a fork of Redis with built-in master-to-master replication. KeyDB eliminated the single point of failure, improved performance, and simplified management. By adopting KeyDB, the client significantly enhanced their web application's reliability and performance, demonstrating the importance of redundancy and fault tolerance in caching systems for critical applications.

Tech stock

Written by Scott-David Jones from In-Line Studio

Recently, a client experienced a significant outage due to a hardware failure in their Redis cache server. This incident highlighted the critical need for redundancy in caching systems, especially when dealing with high-traffic web applications.

The setup and the problem: The client's setup consisted of three web servers behind a load balancer, a cloud-hosted database, and a single Redis server used for caching. While the cloud platform offered resilience, the single point of failure in the Redis server caused the entire application to go offline.

 

The solution: KeyDB To address this issue, we implemented KeyDB, a fork of Redis that provides built-in master-to-master replication. This feature allows for multiple Redis instances to be synchronized, ensuring high availability and load balancing. By configuring KeyDB with a few simple lines of code, the client was able to:

  • Eliminate single point of failure: Ensure that the application remains online even if a Redis instance fails.
  • Improve performance: Distribute cache reads and writes across multiple instances, reducing load on any individual server.
  • Simplify management: Automatically synchronise data between instances, reducing manual configuration and monitoring.

 

KeyDB's advantages:

  • Built-in replication: Provides high availability and load balancing without additional tools or configurations.
  • Easy to implement: Requires minimal changes to the application or infrastructure.
  • Compatible with redis: Can be used as a drop-in replacement for Redis, making the transition seamless.

By adopting KeyDB, the client was able to significantly enhance the reliability and performance of their web application. This case study demonstrates the importance of considering redundancy and fault tolerance when designing caching systems for critical applications.