FyroDB documentation
Changelog v0.6.0
Concurrency lock modernization with parking_lot, exact-match CustomHash slot probing, zero-CAS optimistic seqlock inline string reads, and zero-overhead EBR reclamation.
v0.6.0
Concurrency & Lock Modernization
parking_lot& Atomic Primitives Replacement: Replaced OS-heavystd::sync::Mutexandstd::sync::RwLockacross critical concurrency paths with high-performanceparking_lotprimitives and lock-free atomic representations (AtomicBool,AtomicU64,AtomicUsize,arc_swap::ArcSwap). Multi-threaded lock contention throughput increased by over 10x (from 7.44 Mops/s to 76.57 Mops/s).- Dead Code & Inactive Directive Pruning: Eliminated unused functions, dead structs, redundant imports, and inactive
#[allow(dead_code)]directives across the codebase.
Storage Engine & CustomHash Probing
- Exact-Match Fast Probing (
probe_entry_matching_str&probe_entry_matching_bytes): Upgraded CustomHash slot probing to inspect up to 16 slots with wrap-around attable.maskand match the exact key and hash before returning. Eliminates false tag collision misses and completely avoids falling back to slow full-table scans. - Relaxed Slot Probe Loads with Fenced Tag Matching: Replaced 16 unconditional
Acquireloads on every slot probe withRelaxedloads, issuing anAcquirebarrier only when the 15-bit hash tag matches. - Optimistic Seqlock Inline String Reads (
SmallStr): Implemented optimistic seqlock validation for inline strings (≤ 23 bytes) inStore::get,Store::get_small_str, andget_to_buf_fast_entry_bytes.- Atomically verifies sequence numbers and copies the 24-byte
SmallStrto the local stack (s_copy) before validatingstate1 == state2. - Serializes directly from the local stack copy, completely eliminating torn reads under concurrent writers while removing two reader atomic CAS operations (
STATE_READER_ONE) per read. - Reader cache-line bouncing on shared entries is fully eliminated for inline values.
- Atomically verifies sequence numbers and copies the 24-byte
- Zero-Overhead EBR Guard Drop: In
customhash::ebr::Guard::drop, added aPENDING.load(Ordering::Relaxed) != 0fast check. When no thread has retired garbage, dropping a guard bypasses theDIRTYthread-local variable lookup entirely. - Direct String Hinted Probing: Optimized
Store::get_to_buf_hintedto useprobe_entry_matching_strandlocate_keydirectly, eliminating byte conversion and byte slice comparison overhead.
Verified Performance Improvements
- Point GET: Increased from 8.21 Mops/s to 11.67 Mops/s (+42.1% faster).
- Point SET: Increased from 4.74 Mops/s to 4.82 Mops/s.
- Mixed SET/GET (50/50): Increased from 37.48M ops/sec to 38.41M ops/sec.
- Pipeline-64 SET: Increased from 25.71M ops/sec to 28.29M ops/sec (+10.0% faster).
- JSON.GET: Increased from 47.26M ops/sec to 65.13M ops/sec (+37.8% faster).
- PFADD / PFCOUNT: Increased from 248.24M ops/sec to 307.17M ops/sec (+23.7% faster).
- Producer / Consumer (50+50): Increased from 94.41M ops/sec to 102.19M ops/sec (+8.2% faster).
- Hardware Core Scaling: 6-thread GET reaches 36.30 Mops/s (5.05x core scaling); 6-thread SET reaches 17.25 Mops/s (3.62x core scaling).
- TCP
redis-benchmark: Over 50 parallel client connections, sustained 204,081 SET/s, 195,312 GET/s, 202,839 INCR/s, and 206,185 MSET/s with zero errors and p50 latencies of 0.127 ms.
Rigorous Verification & Anti-Tearing
- Data Integrity & Anti-Tearing Test: Executed 72,186 concurrent writes and 54,822 concurrent reads over raw TCP sockets across inline (10B, 16B, 22B) and heap (64B, 1KB, 16KB) values with CRC32 checksums, resulting in 0 torn reads and 0 checksum errors.
- Multi-Key Transactional Isolation Test: Executed 32,190 multi-key
MULTI/EXECtransfers and 103,798 concurrentMGETbalance audits with 0 isolation violations, verifying total preservation of atomic invariants under high concurrency.