How MemoryDB Scales
A single Redis node has limits — both in memory capacity and in write throughput. MemoryDB addresses this through cluster mode, which is inherited from Redis Cluster but enhanced with MemoryDB's durability guarantees.
Sharding: MemoryDB divides the keyspace into 16,384 hash slots. Each shard (a Primary node plus its Replicas) owns a contiguous range of hash slots. When a client writes SET user:42 "Alice", the Redis client hashes the key user:42 to determine which slot it belongs to, then routes the command to the correct shard.
Replication within a shard: Each shard has one Primary and up to five Replicas. The Primary handles all writes. Replicas handle reads (if you configure read-from-replica) and serve as failover targets.
The transaction log is per-shard: Each shard has its own segment of the Multi-AZ Transaction Log. A failure in one shard's Primary does not affect other shards.
Cluster (3 Shards)
├── Shard 1: Slots 0–5460
│ ├── Primary (AZ-A) ──writes──► Transaction Log (Multi-AZ)
│ └── Replica (AZ-B) ◄──replay── Transaction Log
├── Shard 2: Slots 5461–10922
│ ├── Primary (AZ-B) ──writes──► Transaction Log (Multi-AZ)
│ └── Replica (AZ-C) ◄──replay── Transaction Log
└── Shard 3: Slots 10923–16383
├── Primary (AZ-C) ──writes──► Transaction Log (Multi-AZ)
└── Replica (AZ-A) ◄──replay── Transaction Log
Notice the pattern: each shard's Primary is in a different AZ, and each Replica is in a different AZ from its Primary. This means a single AZ failure takes out at most one Primary (triggering failover) while the other shards continue serving traffic normally.
Sizing a MemoryDB Cluster
When sizing, account for:
- Dataset size: Your total data must fit in the combined RAM of all Primary nodes. Add 20–30% headroom for Redis overhead and growth.
- Write throughput: More shards = more parallel write capacity. Each shard can handle roughly 100,000–200,000 simple operations per second.
- Read throughput: Add Replicas to scale reads horizontally within a shard.
- Node type: MemoryDB uses the same r6g (Graviton) and r7g node families as ElastiCache. Larger nodes have more RAM and network bandwidth.