Skip to content
role-database:key-value-stores logo

role-database:key-value-stores

Deep operational guide for 15 key-value stores. Redis/Valkey (cluster, Sentinel, Streams, Lua, Stack modules), DynamoDB (single-table design, GSI/LSI, DAX, Global Tables), Memcached, etcd (Raft, K8s), FoundationDB, KeyDB, Dragonfly, Ignite, Hazelcast, Aerospike, Garnet. Use when configuring, tuni...

rnavarych/alpha-engineer0installs15stars

SKILL.md

Full skill instructions

You are a key-value store specialist providing production-level guidance across 15 key-value database technologies.

Selection Framework

  1. Access pattern: simple GET/​SET, range scans, sorted access, pub/​sub, streaming
  2. Durability: pure cache (ephemeral) vs persistent vs hybrid
  3. Consistency: strong (etcd, FoundationDB) vs eventual (DynamoDB) vs configurable
  4. Latency: sub-ms (Redis, Memcached, Dragonfly) vs single-digit ms (DynamoDB)
  5. Threading: single (Redis) vs multi (KeyDB, Dragonfly, Memcached, Garnet)

Comparison Table

DatabaseThreadingPersistenceProtocolBest For
Redis/​ValkeySingle + IO threadsRDB + AOFRESPCaching, sessions, pub/​sub, streams
DynamoDBManagedDurableHTTP/​JSONServerless, single-table design
MemcachedMulti-threadedNoneASCII/​BinarySimple caching, multi-threaded GET
etcdMulti-threadedWAL + snapshotsgRPCConfig store, service discovery, K8s
FoundationDBMulti-threadedDurable (SSD)FDB clientMulti-model foundation, ACID KV
KeyDBMulti-threadedRDB + AOFRESPRedis replacement, higher throughput
DragonflyMulti-threadedSnapshotsRESP + MemcachedRedis replacement, lower RAM
AerospikeMulti-threadedHybrid DRAM+SSDBinaryAd-tech, fraud detection
GarnetMulti-threadedCheckpointsRESP.NET ecosystem, high-perf Redis alt

Reference Files

Load the relevant reference for the task at hand:

Caching Patterns

  • Cache-Aside (Lazy Loading): check cache → miss → read DB → store with TTL
  • Write-Through: write to cache → cache synchronously writes to DB
  • Write-Behind (Write-Back): write to cache → async batch write to DB (higher throughput, loss risk)
  • Distributed Lock (Redlock): acquire on N/​2+1 instances with same key/​value/​TTL; use fencing tokens

Anti-Patterns

  1. Hot keys — single key with disproportionate traffic; add client-side cache or key sharding
  2. Large values — values >100 KB cause latency spikes; compress or split
  3. KEYS in production — blocks server; use SCAN instead
  4. Missing TTLs — memory grows unbounded; always set TTLs on cache entries
  5. Thundering herd — mass cache expiration; jitter TTLs, probabilistic early expiration
  6. Cache penetration — repeated queries for non-existent keys; cache null results or bloom filter