Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsApr 12, 2026·3 min de lecture

DragonflyDB — Modern In-Memory Datastore Replacing Redis

DragonflyDB is a modern replacement for Redis and Memcached. Written in C++ with a multi-threaded, shared-nothing architecture that achieves 25x throughput improvement over Redis. Fully compatible with Redis and Memcached APIs.

Introduction

DragonflyDB is a modern in-memory datastore designed as a drop-in replacement for Redis and Memcached. Built from scratch in C++ with a multi-threaded, shared-nothing architecture that uses all CPU cores efficiently. In benchmarks, Dragonfly achieves 25x the throughput of Redis on a single node while reducing memory usage by up to 40%.

What DragonflyDB Does

  • Redis compatible — RESP protocol, most Redis commands
  • Memcached compatible — text and binary protocols
  • Multi-threaded — shared-nothing, scales across all cores
  • Memory efficient — novel data structures use ~40% less RAM
  • Snapshots — RDB-compatible persistence
  • Replication — Redis-compatible replication protocol
  • Pub/Sub — full pub/sub support
  • Lua scripting — Redis Lua scripts work unchanged
  • Cluster mode — emulated cluster for Redis cluster clients
  • ACL — Redis-compatible ACL system

Architecture

Shared-nothing multi-threaded design: each thread owns a slice of the keyspace. No global locks. Novel dashtable data structure replaces Redis dict for lower memory overhead and better cache locality. IO is handled via io_uring (Linux) for minimal syscall overhead.

Self-Hosting

version: "3"
services:
  dragonfly:
    image: docker.dragonflydb.io/dragonflydb/dragonfly
    ports: ["6379:6379"]
    volumes:
      - dragonfly-data:/data
    ulimits:
      memlock: -1
volumes:
  dragonfly-data:

Key Features

  • Redis + Memcached wire compatibility
  • 25x throughput vs Redis (single instance)
  • 40% less memory usage
  • Multi-threaded (shared-nothing)
  • RDB snapshot persistence
  • Replication
  • Lua scripting
  • ACL security
  • io_uring (Linux)
  • Drop-in replacement

Comparison

Store Threads Protocol Memory
DragonflyDB Multi (shared-nothing) Redis + Memcached Best
Redis Single RESP Good
Valkey Single RESP Good (Redis fork)
KeyDB Multi (shared) RESP Good
Garnet (MS) Multi RESP Good

FAQ

Q: Can it directly replace Redis? A: Yes in most scenarios. The RESP protocol is compatible, and most Redis commands are supported. A few advanced Redis features (Redis Modules, some cluster edge behaviors) are not.

Q: BSL restrictions? A: Automatically converts to Apache 2.0 after 4 years. In the meantime, self-use is completely fine; you just can't run a managed Dragonfly service competing with the official one.

Q: Why is it so fast? A: Multithreading + lock-free shared-nothing + io_uring + compact data structures (dashtable). A single machine can saturate a 96-core server.

Sources

Discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires