Internative Logo

What Is Dragonfly DB? A Multi-Threaded Redis-Compatible Data Store

What Is Dragonfly DB? A Multi-Threaded Redis-Compatible Data Store

Redis became the default cache and in-memory store for a generation of web applications, but it was designed when servers had a few cores. A single Redis process executes commands on one main thread, so a large server with dozens of cores is mostly idle while one core does the work. When traffic outgrows that thread, the usual answer is a Redis cluster: more processes, more nodes, sharding, and more to operate. Dragonfly takes a different route. It speaks the same protocol as Redis, but it was written from scratch to use every core of one machine.

This article explains what Dragonfly is, how its architecture differs from Redis, when it is worth adopting, and how it compares with Redis, Valkey and Memcached.

What is Dragonfly?

Dragonfly is an in-memory data store that is compatible with the Redis and Memcached APIs. Applications connect to it with their existing Redis or Memcached client libraries and use the same commands: strings, hashes, lists, sets, sorted sets, streams, pub/sub, Lua scripts and transactions. It is not a fork of Redis; it is a separate implementation written in C++.

It was created by Roman Gershman and Oded Poncz, who first met as engineers at Google. Gershman later worked as a principal engineer at a large cloud infrastructure company, where he saw the limits of existing in-memory services at scale. The two started Dragonfly in late 2021, published the first release, version 0.1.0, on GitHub on 30 May 2022, and announced the project publicly in June 2022. Version 1.0 followed in March 2023. The company behind it, DragonflyDB, also runs a managed service called Dragonfly Cloud.

How Dragonfly works

Shared-nothing, multi-threaded design. Dragonfly splits the keyspace into shards and gives each shard to one thread. Each thread owns its data exclusively, so threads do not compete for locks on the hot path. A request that arrives on any connection is routed to the thread that owns the key. The result is that one Dragonfly process can scale vertically across all the cores of a machine.

Multi-key atomicity without global locks. Commands that touch several keys, and MULTI/EXEC transactions, still need to be atomic. Dragonfly coordinates them across shards with a lightweight locking scheme based on the VLL research algorithm, instead of a global lock.

A more compact hash table. The main dictionary is built on Dashtable, a design derived from research on persistent-memory hash tables. It grows incrementally instead of rehashing everything at once, which avoids memory spikes and latency pauses as the dataset grows.

Snapshots without forking. Redis creates snapshots by forking the process, which can briefly double memory use on a busy instance. Dragonfly snapshots without a fork, so memory stays flat while it writes the snapshot to disk.

Cluster compatibility. Dragonfly supports primary-replica replication, and it can run in an emulated cluster mode, so client libraries written for Redis Cluster can connect to a single Dragonfly node without code changes.

Key features

  • Redis and Memcached protocol compatibility: existing clients and most commands work as they are.
  • Vertical scaling across all cores of a single machine, which delays or removes the need for sharding.
  • Steady memory use during snapshots, thanks to fork-less snapshotting.
  • Replication and high availability through primary-replica setups.
  • Container-friendly: official images for Docker and an operator for Kubernetes.
  • Managed option: Dragonfly Cloud, run by the company that develops it.

Where Dragonfly is used

Dragonfly fits wherever Redis is already used as an in-memory layer, especially when that layer has become large or expensive:

  • Application caches in front of databases such as PostgreSQL or MongoDB.
  • Session stores for web and mobile applications.
  • Rate limiting and feature flags, where every request touches the store.
  • Real-time leaderboards and counters built on sorted sets.
  • Job queues and pub/sub fan-out between services.

When to choose Dragonfly, and when not to

Choose Dragonfly when:

  • A Redis deployment has outgrown one main thread and you are about to shard it, or already run a cluster mainly for throughput.
  • The workload is cache-heavy and the in-memory layer has become a significant infrastructure cost.
  • You want to keep the Redis protocol and client libraries, but run fewer, larger nodes.
  • Snapshot memory spikes are causing instability on large Redis instances.

Think twice when:

  • A single Redis or Valkey instance already handles the load comfortably. The gain from switching is small.
  • You depend on Redis modules or newer Redis-specific features. Dragonfly implements the common API, not every module; check your command list against its compatibility documentation before migrating.
  • Licensing matters for your use. Dragonfly is source-available, not open source (see the FAQ below).
  • You need strong durability guarantees. Like Redis, Dragonfly is an in-memory store; a disk-based database should remain the system of record.

Performance claims deserve a test of your own. DragonflyDB publishes benchmarks showing many times Redis's throughput on a single large instance; Redis's developers have answered that a Redis cluster using all cores of the same machine closes much of that gap. The honest answer depends on your commands, value sizes and pipelining, so benchmark with real traffic.

Dragonfly and its alternatives

OptionWhat it isLicenceBest fit
DragonflyMulti-threaded, Redis- and Memcached-compatible storeSource-availableLarge caches on few big nodes
RedisThe original in-memory data storeRSALv2, SSPLv1 or AGPLv3General use, widest feature set
ValkeyLinux Foundation fork of Redis 7.2.4Open source (BSD)Open-source Redis replacement
MemcachedSimple multi-threaded key-value cacheOpen source (BSD)Plain caching, no data structures

The main comparison is Dragonfly vs Redis. Redis has the larger ecosystem, modules and two decades of operational knowledge; it scales out with Redis Cluster. Dragonfly keeps the same protocol and scales up on one machine first, which can mean fewer nodes and simpler operations. Redis's own licensing has also changed: in March 2024 Redis moved from the BSD licence to RSALv2 and SSPLv1, and Redis 8 added AGPLv3 as an option in May 2025. The Linux Foundation's Valkey fork, created in 2024, is the fully open-source path. Managed services such as Amazon ElastiCache on Amazon Web Services remove most operational work if you stay within one cloud.

How we use Dragonfly at Internative

We deploy Dragonfly for clients whose Redis costs are growing faster than their revenue, typically SaaS businesses with cache-heavy workloads. A single Dragonfly node often replaces a Redis cluster of five to ten nodes, so the same migration lowers both hardware cost and on-call complexity, and protocol compatibility means the application code does not change.

If your in-memory layer has become one of the larger lines on your infrastructure bill, our SaaS design and development team can help you decide whether Dragonfly is the right replacement.

Frequently asked questions

Is Dragonfly DB free?

Dragonfly's source code is public and can be used free of charge within its licence terms, but it is source-available rather than open source. Earlier versions were released under the Business Source License 1.1. From version 2.1, Dragonfly uses its own Dragonfly Source-Available License, which allows production use up to 100 vCPUs; larger production deployments need a commercial licence, and the software may not be offered as a standalone database or caching service.

Is Dragonfly a drop-in replacement for Redis?

For most applications, yes. Dragonfly implements the Redis protocol and the commonly used commands, so existing client libraries connect without changes. Applications that rely on Redis modules or less common commands should check Dragonfly's compatibility list and test before switching.

Is Dragonfly faster than Redis?

On a single large machine, Dragonfly can handle much more throughput than a single Redis process, because it uses all cores. Compared with a Redis cluster spread across the same cores, the difference is smaller. Results depend on the workload, so measure with your own commands and data.

Is Dragonfly a database or a cache?

Like Redis, it is an in-memory data store that can be used as both. It keeps data in memory and can persist snapshots to disk, so it works as a cache, a session store, a queue or a fast primary store for data you can afford to rebuild. For records that must never be lost, keep a disk-based database as the source of truth.

Related services

Where this topic becomes an engagement.

Keep reading

The articles that follow this one.