Changelog v0.1.2
Compact storage, lazy allocation, and adaptive memory reclamation.
v0.1.2
Released: August 2026
v0.1.2 focuses on lowering idle and workload memory without changing FyroDB's Redis-compatible command surface. It replaces eager allocation and duplicate collection indexes with compact representations that grow and reclaim capacity with the workload.
Memory Result
- Peak RSS dropped from roughly 600 MB to 247 MB, about a 59% reduction.
- Average RSS is now approximately 134 MB and idle RSS is approximately 4 MB.
- The same benchmark measured the six-node Redis Cluster at 650 MB peak RSS, so one FyroDB node uses about 62% less peak memory while retaining higher throughput across the documented workloads.
Compact Storage
- Added
CompactKey: keys up to 15 bytes remain inline in each map entry. - Added
SmallStr: strings and collection members up to 23 bytes avoid a separate heap allocation. - Hashes and lists begin in compact sequential forms and promote only after 64 elements.
- Sets select an integer vector, compact string vector, or full hash set based on their contents and size; large sets can demote after removals.
- Sorted sets now use a single score-ordered vector instead of storing members in two indexes. Score ranges and counts use binary partition points.
- JSON is stored as compact text and parsed for path operations, avoiding the previous permanently expanded recursive representation.
Hash Map and Concurrency
- Packed the writer lock, occupied flag, and seqlock generation into one atomic state word.
- Changed map entries to hold values in place, removing the extra
ValueBoxallocation and pointer swap. - Reduced the initial shard table to eight slots and made
FYRODB_MAX_KEYSan admission limit rather than an eager reservation request. - Increased shard load factor to 90% and added safe compaction for underutilized tables.
- Hardened concurrent
clear, growth, iteration, and reclamation with new stress tests. - Split
customhashinto focused API, shard, operations, key, and EBR modules.
Allocator and Memory Reclamation
- Added the internal
rust-zmalloccrate, backed by mimalloc, with live allocation accounting and raw EBR allocation helpers. INFOnow reports tracked allocated memory, RSS, peak RSS, cgroup usage, and fragmentation ratio.- Added periodic EBR collection and mimalloc page release.
- Added bounded value defragmentation when RSS materially exceeds live allocations.
- Added periodic shard-table compaction after workloads shrink.
FLUSHALLandFLUSHDBnow complete quiescent reclamation and purge the allocator so RSS can return toward idle levels.- Reduced worker and maintenance thread stack sizes and event-buffer capacities.
Expiration and Maintenance
- Reworked expiration cleanup into incremental per-shard scans.
- Added TTL generation accounting so stale scans cannot hide newly created expirations.
- Skips expiration scans when no TTL keys exist, reducing idle CPU.
- Integrated collection, purge, defragmentation, and table compaction into the maintenance cadence instead of command hot paths.
Internal Organization
- Split the storage value implementation into
SmallStr, compact collections, JSON, and sorted-set modules. - Modularized allocator, hash-map, storage, and maintenance code for easier auditing and testing.
- Expanded memory audits and concurrent CustomMap stress coverage.
Upgrade Notes
- The default
FYRODB_MAX_KEYSremains1000. Increase it explicitly for larger deployments; doing so no longer preallocates the full hash table. INFOreports the application version from Cargo package metadata, preventing future code/docs version drift.- No command or RDB format migration is required from v0.1.1.