Databases 11 min read

Why Dragonfly Claims 25× Faster Than Redis – Real Benchmarks Explained

This article introduces Dragonfly, an open‑source in‑memory database compatible with Redis and Memcached APIs, explains its architectural innovations, presents benchmark code comparing it with Redis, and discusses real‑world performance results and future development plans.

21CTO
21CTO
21CTO
Why Dragonfly Claims 25× Faster Than Redis – Real Benchmarks Explained
Want to achieve lightning‑fast performance with a Redis‑compatible cluster? Meet Dragonfly.

What Is Dragonfly?

Dragonfly is an in‑memory database that is 100% compatible with both Redis and Memcached APIs, so existing SDKs and tools work without code changes.

Created in 2022 by a former Google and Amazon engineer, Dragonfly is written in C/C++ and released under the Business Source License (BSL).

Benchmark results claim it is the fastest in‑memory store, offering up to 25× higher throughput than Redis, handling millions of requests per second, and using about 30% less memory for a 5 GB dataset.

Within two months of release it earned 9.2 K GitHub stars and 177 forks, out‑shining other Redis‑compatible systems like KeyDB and Skytable.

Why Is It So Fast?

Dragonfly was designed in 2022 with two core goals: atomic multi‑key operations and sub‑millisecond latency for high throughput.

It uses a no‑shared architecture that partitions the key space across threads, allowing each thread to manage its own shard.

Open‑source libraries handle thread and I/O management for this architecture.

Atomicity for multi‑key commands is achieved by leveraging recent academic research.

The lock manager was redesigned, and by combining the no‑shared design with VLL (virtual lock‑less) techniques, Dragonfly can perform atomic multi‑key operations without mutexes or spin‑locks.

Its core hash table is based on the paper “Dash: Scalable Hashing on Persistent Memory,” providing incremental hashing and stateless scans that improve CPU and memory efficiency.

Below is the benchmark code used to compare Dragonfly with Redis (written in Go):

func setdragoFly(b *testing.B) {</code><code>    client := redis.NewClient(&redis.Options{</code><code>        Addr: "127.0.0.1:6376",</code><code>        Password: "",</code><code>        DB: 0,</code><code>        PoolSize: 10,</code><code>    })</code><code>    if err := client.Ping(context.Background()).Err(); err != nil { log.Fatal(err) }</code><code>    b.N = 1e4</code><code>    ctx := context.Background()</code><code>    for n := 0; n < b.N; n++ {</code><code>        val := fmt.Sprintf("bench%d", n)</code><code>        client.Set(ctx, fmt.Sprintf("key%d", n), val, time.Minute)</code><code>    }</code><code>}</code><code></code><code>func setRedis(b *testing.B) {</code><code>    client := redis.NewClient(&redis.Options{</code><code>        Addr: "127.0.0.1:6379",</code><code>        Password: "",</code><code>        DB: 0,</code><code>        PoolSize: 10,</code><code>    })</code><code>    if err := client.Ping(context.Background()).Err(); err != nil { log.Fatal(err) }</code><code>    b.N = 1e4</code><code>    ctx := context.Background()</code><code>    for n := 0; n < b.N; n++ {</code><code>        val := fmt.Sprintf("bench%d", n)</code><code>        client.Set(ctx, fmt.Sprintf("key%d", n), val, time.Minute)</code><code>    }</code><code>}
func getdragoFly(b *testing.B) {</code><code>    client := redis.NewClient(&redis.Options{Addr: "127.0.0.1:6376", Password: "", DB: 0, PoolSize: 10})</code><code>    if err := client.Ping(context.Background()).Err(); err != nil { log.Fatal(err) }</code><code>    b.N = 1e4</code><code>    ctx := context.Background()</code><code>    for n := 0; n < b.N; n++ {</code><code>        _, err := client.Get(ctx, fmt.Sprintf("key%d", n)).Result()</code><code>        if err == redis.Nil || err != nil { log.Fatalf("Dragonfly data loss %d - err: %v", n, err) }</code><code>    }</code><code>}</code><code></code><code>func getRedis(b *testing.B) {</code><code>    client := redis.NewClient(&redis.Options{Addr: "127.0.0.1:6379", Password: "", DB: 0, PoolSize: 10})</code><code>    if err := client.Ping(context.Background()).Err(); err != nil { log.Fatal(err) }</code><code>    b.N = 1e4</code><code>    ctx := context.Background()</code><code>    for n := 0; n < b.N; n++ {</code><code>        _, err := client.Get(ctx, fmt.Sprintf("key%d", n)).Result()</code><code>        if err == redis.Nil || err != nil { log.Fatalf("Redis data loss %d - err: %v", n, err) }</code><code>    }</code><code>}
func main() {</code><code>    fmt.Println("TEST BENCHMARK DragonFly VS Redis")</code><code>    fmt.Println("==================================")</code><code>    fmt.Println("========Compare Set=========")</code><code>    fmt.Println("DragonFly : ", testing.Benchmark(setdragoFly))</code><code>    fmt.Println("Redis : ", testing.Benchmark(setRedis))</code><code>    fmt.Println()</code><code>    fmt.Println("=======Compare Get=========")</code><code>    fmt.Println("DragonFly : ", testing.Benchmark(getdragoFly))</code><code>    fmt.Println("Redis : ", testing.Benchmark(getRedis))</code><code>}

Running these benchmarks showed that, contrary to the vendor’s claim, Dragonfly was slightly slower than Redis in the author’s environment.

The Future of In‑Memory Databases

Dragonfly 1.0 is production‑ready and marks the start of a longer roadmap. The team has raised $21 million to expand use cases, add SSD‑backed storage for larger datasets while keeping latency low, and launch a managed cloud offering.

While Dragonfly offers impressive throughput and lower memory usage, its advantages are most evident in high‑capacity services; in low‑resource settings Redis may still be preferable.

In early‑stage projects, vertical scaling with Dragonfly can provide a quick way to handle traffic spikes before moving to a full cluster, making it a strong complementary tool rather than an outright replacement for Redis today.

Overall, many developers are already experimenting with Dragonfly, and it could become a serious competitor to Redis as the ecosystem matures.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Goperformance benchmarkRedis CompatibilityIn-Memory DatabaseDragonfly
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.