How apache/kvrocks works
Kvrocks is a Redis-protocol-compatible distributed key-value database backed by RocksDB. The principal workflow is a Redis client sending a command over the server connection; command handling accesses namespaced data in storage and returns a protocol reply. Major documented branches include search/indexing, replication, and proxyless clustering. Paths for these branches are supported by the tree and README, but their detailed wiring was not sampled; the graph therefore shows only high-level documented relationships there.
Main entry points: commands Redis commands · index_manager.cc Index management · redis_connection.cc Redis connection · storage.cc Storage engine
Components 25
Protocol serving
- Kvrocks server
src/server/server.cc - Redis connection
src/server/redis_connection.cc - Connection worker
src/server/worker.cc - Request parsing
src/server/redis_request.cc - Command dispatch
src/commands/commander.cc - Redis commands
src/commands - Redis replies
src/server/redis_reply.cc
Data and storage
- Namespace isolation
src/server/namespace.cc - Redis data types
src/types - Storage engine
src/storage/storage.cc - RocksDB
Search and indexing
- Search commands
src/commands/cmd_search.cc - Query parsing
src/search/redis_query_transformer.h - Index management
src/search/index_manager.cc - Query planning
src/search/passes/manager.h - Plan execution
src/search/plan_executor.cc - Index building
src/search/indexer.cc
Distributed features
- Cluster slots
src/cluster/cluster.cc - Slot migration
src/cluster/slot_migrate.cc - Async replication
src/cluster/replication.cc
Operations
- Configuration
src/config/config.cc - Stats and metrics
src/stats/stats.cc - Backup and restore
src/storage/storage.cc
Other components
- Redis client
- Redis Sentinel
Connections 22
- Redis client → Redis connection: sends commands
- Redis connection → Connection worker: dispatches requests
- Connection worker → Request parsing: parses input
- Request parsing → Command dispatch: dispatches command
- Command dispatch → Redis commands: invokes handler
- Redis commands → Namespace isolation: selects namespace
- Redis commands → Redis data types: operates on values
- Redis commands → Storage engine: reads and writes
- Storage engine → RocksDB: persists data
- Redis commands → Redis replies: produces response
- Redis replies → Redis connection: returns protocol data
- Search commands → Query parsing: parses queries
- Search commands → Index management: manages and searches
- Index management → Query planning: generates plans
- Query planning → Plan execution: lowers query plan
- Plan execution → Storage engine: reads indexed data
- Index management → Index building: builds indexes
- Cluster slots → Slot migration: coordinates slot moves
- Async replication → Redis Sentinel: supports failover
- Kvrocks server → Configuration: uses configuration
- Kvrocks server → Stats and metrics: reports metrics
- Backup and restore → RocksDB: creates checkpoints