Browse documentation

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-heavy std::sync::Mutex and std::sync::RwLock across critical concurrency paths with high-performance parking_lot primitives 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 at table.mask and 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 Acquire loads on every slot probe with Relaxed loads, issuing an Acquire barrier only when the 15-bit hash tag matches.
  • Optimistic Seqlock Inline String Reads (SmallStr): Implemented optimistic seqlock validation for inline strings (≤ 23 bytes) in Store::get, Store::get_small_str, and get_to_buf_fast_entry_bytes.
    • Atomically verifies sequence numbers and copies the 24-byte SmallStr to the local stack (s_copy) before validating state1 == 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.
  • Zero-Overhead EBR Guard Drop: In customhash::ebr::Guard::drop, added a PENDING.load(Ordering::Relaxed) != 0 fast check. When no thread has retired garbage, dropping a guard bypasses the DIRTY thread-local variable lookup entirely.
  • Direct String Hinted Probing: Optimized Store::get_to_buf_hinted to use probe_entry_matching_str and locate_key directly, 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/EXEC transfers and 103,798 concurrent MGET balance audits with 0 isolation violations, verifying total preservation of atomic invariants under high concurrency.