How valkey-io/valkey works
Valkey is a high-performance key/value data-structure server. The principal workflow is: a client sends a RESP command, networking parses it, command dispatch performs authorization and execution against native data structures, then a reply returns through the connection. The server also supports persistence, replication, clustering, Sentinel, scripting, modules, TLS, and experimental RDMA. Sampled source confirms the scripting-manager/Lua-engine boundary; several other subsystem links are based on the documented product structure and exact tree paths.
Main entry points: networking.c Networking · commands.c Command Dispatch · server.c Server Runtime · db.c Core Data Store
Components 22
Client Access
- Event Loop
src/ae.c - Networking
src/networking.c - RESP Parser
src/resp_parser.c - TLS Transport
src/tls.c - RDMA Transport
src/rdma.c
Command Core
- Server Runtime
src/server.c - Command Dispatch
src/commands.c - Access Control
src/acl.c - Core Data Store
src/db.c - Native Structures
src/t_string.c - Pub/Sub
src/pubsub.c
State Services
- RDB Snapshots
src/rdb.c - AOF Log
src/aof.c - Replication
src/replication.c - Cluster Coordination
src/cluster.c - Sentinel Monitoring
src/sentinel.c - Latency Metrics
src/latency.c
Extensions
- Module Runtime
src/module.c - Scripting Manager
src/scripting_engine.c - Lua Engine
src/modules/lua/engine_lua.c
Other components
- Application Client
- Operator
Connections 27
- Application Client → Networking: sends commands
- Operator → Server Runtime: configures server
- Server Runtime → Event Loop: runs loop
- Event Loop → Networking: handles events
- Networking → RESP Parser: parses requests
- Networking → Command Dispatch: dispatches commands
- Command Dispatch → Access Control: checks access
- Command Dispatch → Core Data Store: executes commands
- Command Dispatch → Native Structures: uses structures
- Command Dispatch → Pub/Sub: handles channels
- Command Dispatch → Module Runtime: invokes modules
- Command Dispatch → Scripting Manager: invokes scripts
- Command Dispatch → AOF Log: records writes
- Core Data Store → RDB Snapshots: persists state
- RDB Snapshots → Core Data Store: loads state
- Server Runtime → Replication: manages replicas
- Server Runtime → Cluster Coordination: coordinates shards
- Server Runtime → Sentinel Monitoring: runs monitoring
- Replication → Networking: streams updates
- Cluster Coordination → Networking: handles cluster links
- Networking → TLS Transport: secures transport
- Networking → RDMA Transport: uses RDMA
- Scripting Manager → Lua Engine: calls engine
- Lua Engine → Module Runtime: uses module API
- Server Runtime → Latency Metrics: tracks latency
- Command Dispatch → Networking: queues replies
- Networking → Application Client: returns replies