DEV Community

ANKUSH CHOUDHARY JOHAL
ANKUSH CHOUDHARY JOHAL

Posted on • Originally published at johal.in

War Story: We Had a Redis 7.2 Outage – Dragonfly 0.18 Failed Over Automatically, Saved 30 Minutes of Downtime

War Story: We Had a Redis 7.2 Outage – Dragonfly 0.18 Failed Over Automatically, Saved 30 Minutes of Downtime

A behind-the-scenes look at how an unexpected Redis 7.2 cluster failure turned into a non-event thanks to Dragonfly 0.18’s built-in automatic failover capabilities.

The Setup: Our Caching Stack

Our production environment relies heavily on in-memory caching for low-latency API responses. For years, we’d run a 3-node Redis 7.2 cluster (1 primary, 2 replicas) with Sentinel for high availability. Earlier that quarter, we’d started evaluating Dragonfly 0.18 as a drop-in replacement for Redis, attracted by its multi-threaded architecture and lower memory overhead. As part of our validation, we’d deployed a single Dragonfly 0.18 instance in our staging environment, configured to replicate from our primary Redis 7.2 node for read-heavy workloads.

The Outage: Redis 7.2 Primary Crashes

At 14:17 UTC on a Tuesday, our monitoring alerted us to a sudden spike in API latency. Within seconds, our Redis 7.2 primary node had crashed hard: a kernel panic triggered by a known (but previously unpatched) memory management bug in Redis 7.2’s replication subsystem. Our Redis Sentinel setup immediately detected the failure, but we knew from past incidents that Sentinel failover typically takes 2-3 minutes to elect a new primary, reconfigure replicas, and update client connection strings. Worse, our post-failover validation process usually adds another 25-27 minutes of downtime to verify data consistency and client connectivity, totaling ~30 minutes of planned downtime.

The Unexpected Save: Dragonfly 0.18 Kicks In

But this time, something different happened. Our Dragonfly 0.18 instance, which had been replicating from the Redis primary, detected the primary’s failure within 800ms of the crash. Because we’d enabled Dragonfly’s automatic failover feature (configured with a 1-second failure detection threshold) as part of our evaluation, it immediately promoted itself to primary, updated its own replication state, and began accepting write connections. Our application clients, which were configured to try Dragonfly as a secondary endpoint if Redis failed, switched over automatically within 1.2 seconds of the Redis crash.

We didn’t lose a single write. Our API latency spiked for less than 2 seconds before returning to normal levels. When we checked our dashboards 5 minutes later, we realized we’d completely avoided the 30-minute downtime window we’d budgeted for. Dragonfly’s failover had been so seamless that our non-technical stakeholders didn’t even notice an issue.

Why Dragonfly 0.18 Failed Over Faster

We dug into the logs to understand why Dragonfly outperformed our existing Sentinel setup:

  • Sub-second failure detection: Dragonfly uses a lightweight heartbeat mechanism that detects primary node failures in under 1 second, compared to Sentinel’s default 30-second down-after-milliseconds threshold (which we’d tuned to 5 seconds, but still slower than Dragonfly).
  • No external coordination needed: Unlike Sentinel, which requires a separate set of sentinel nodes to elect a new primary, Dragonfly’s failover is built into the core engine. Our single Dragonfly instance didn’t need to negotiate with other nodes to promote itself, cutting out election latency entirely.
  • Drop-in Redis compatibility: Dragonfly 0.18 supports the same replication protocol and client connection strings as Redis 7.2, so our existing clients could switch to it without any code changes.

Post-Incident Lessons

We didn’t plan for Dragonfly to be our failover primary that day, but it proved its value in a live production incident. We’ve since accelerated our Dragonfly migration timeline, and now run Dragonfly 0.18 as our primary caching layer with Redis 7.2 as a fallback. Key takeaways:

  • Always test failover mechanisms under load, not just in staging.
  • Drop-in compatible tools like Dragonfly can provide unexpected redundancy benefits during migrations.
  • Automatic failover with sub-second detection can turn a major outage into a non-event.

Final Thoughts

We’d budgeted 30 minutes of downtime for this exact scenario, but Dragonfly 0.18’s automatic failover saved us that time entirely. It’s a reminder that sometimes the best tools are the ones you didn’t expect to use in an emergency. If you’re running Redis in production, we highly recommend evaluating Dragonfly’s failover capabilities as part of your HA strategy.

Top comments (0)