How dragonflydb/dragonfly works
Dragonfly is a high-throughput in-memory datastore compatible with Redis and Memcached APIs. The principal workflow is: a client connects through a protocol listener, the request is parsed and dispatched to a command family, a transaction executes on an engine shard against the database, and a reply is encoded back to the client. Persistence, search, clustering, replication, ACLs, and tiered storage form adjacent capabilities. Source excerpts were partial, so uncertain internal call edges are omitted.
Main entry points: command_families.h Command Families · engine_shard.cc Engine Shards · db_slice.cc Database Slices · dragonfly_listener.cc Protocol Listener
Components 21
Protocol Access
- Protocol Listener
src/facade/dragonfly_listener.cc - RESP Memcache Parsers
src/facade/resp_parser.cc - Reply Builder
src/facade/reply_builder.cc
Command Execution
- Command Registry
src/server/command_registry.cc - Command Families
src/server/command_families.h - Transactions
src/server/transaction.cc - Engine Shards
src/server/engine_shard.cc
Data Services
- Database Slices
src/server/db_slice.cc - Redis Collections
src/server/generic_family.cc - Search And Vectors
src/server/search/search_family.cc - Search Indices
src/core/search/indices.cc
Durability Storage
- Write Journal
src/server/journal/journal.cc - RDB Snapshots
src/server/snapshot.cc - Snapshot Storage
src/server/detail/snapshot_storage.cc - Tiered Storage
src/server/tiered_storage.cc - Tiered Disk Store
src/server/tiering/disk_storage.cc
Scale Operations
- ACL Authentication
src/server/acl/validator.cc - Cluster Coordination
src/server/cluster/coordinator.cc - Replication
src/server/replica.cc
Other components
- Redis Memcache Clients
- Cloud Object Storage
Connections 21
- Redis Memcache Clients → Protocol Listener: opens connection
- Protocol Listener → RESP Memcache Parsers: reads protocol
- RESP Memcache Parsers → Command Registry: dispatches command
- Command Registry → Command Families: selects family
- Command Families → Transactions: starts transaction
- Transactions → Engine Shards: runs on shard
- Engine Shards → Database Slices: accesses data
- Command Families → Reply Builder: builds reply
- Reply Builder → Redis Memcache Clients: returns result
- Command Families → Redis Collections: executes datatype
- Command Families → Search And Vectors: executes search
- Search And Vectors → Search Indices: queries indices
- Database Slices → Search Indices: indexes values
- Engine Shards → Write Journal: journals writes
- RDB Snapshots → Snapshot Storage: reads writes snapshots
- Snapshot Storage → Cloud Object Storage: uses object storage
- Database Slices → Tiered Storage: offloads values
- Tiered Storage → Tiered Disk Store: reads writes segments
- Command Families → ACL Authentication: checks access
- Engine Shards → Cluster Coordination: coordinates slots
- Engine Shards → Replication: serves replicas