$ show akiradeveloper/sorock
Sorock is a Multi-Raft implementation in Rust that enables multiple Raft consensus processes to coexist in a single OS process for efficient resource sharing. The system implements a complete Raft consensus algorithm with optimizations including batched writes, heartbeat multiplexing, and Phi Accrual Failure Detector for adaptive leader failure detection. It provides gRPC services for client interaction (read/write operations) and includes CLI tools for cluster management (monitoring, remapping, syncing). The architecture follows a modular design where each shard maintains independent Raft state while sharing underlying storage and network connections.
The LLM identified 3 files worth highlighting for reuse:
Implements the Phi Accrual Failure Detector for adaptive leader failure detection. This self-contained component eliminates the need for fixed timeout configurations by dynamically calculating suspicion levels based on heartbeat inter-arrival times. It demonstrates sophisticated distributed systems knowledge and could be extracted for use in any distributed system requiring failure detection.
Implements a batched write storage system using Redb that queues entries across multiple shards and processes them in single transactions per table. The Reaper pattern efficiently batches writes while maintaining consistency, significantly improving throughput without sacrificing latency. This storage optimization is a key innovation that addresses the scalability limitations of naive Multi-Raft implementations.
Reduces network overhead by multiplexing heartbeats from multiple Raft shards into batched RPCs. This component solves the O(N^2) heartbeat problem in Multi-Raft deployments by buffering heartbeats and sending them as a single batched message, then demultiplexing at the receiver. The implementation shows careful consideration of network efficiency in distributed consensus protocols.