MemoryDB Core Architecture
Explore MemoryDB's core architecture to understand its cluster, shard, and node hierarchy. Learn how data is partitioned, how read and write routing operates, and how failover with replica promotion ensures durability. Discover how shard and replica counts influence scaling and availability in production environments for optimized database performance.
We'll cover the following...
Having established MemoryDB as a durable, in-memory primary database that stands apart from ElastiCache in its durability guarantees and workload fit, the next step is to understand what actually runs inside a MemoryDB deployment. Every operational decision you make, from sizing to failover planning to read optimization, traces back to how the cluster is physically organized. This section unpacks that internal structure.
A MemoryDB cluster follows a three-level hierarchy that governs how data is stored, accessed, and protected.
Cluster: The top-level resource you create and manage. It represents the entire database deployment and exposes the endpoint your application connects to.
Shard: A horizontal partition of the keyspace within the cluster. MemoryDB divides the full keyspace into 16,384
. Each shard owns a contiguous range of these slots, and every key your application writes is assigned to a shard based on a CRC16 hash of the key name.hash slots Fixed-size logical partitions (numbered 0 through 16,383) that MemoryDB distributes evenly across shards so every key deterministically maps to exactly one shard based on a hash of the key name. Node: The compute unit inside a shard. Each shard contains exactly one primary node that handles all writes and zero or more replica nodes that maintain read-only copies of the shard's data.
This partitioning is fully automatic. When you create a cluster with three shards, MemoryDB assigns roughly 5,461 hash slots to each shard and manages the mapping transparently. You do not manually assign keys to shards.
Note: Understanding this hierarchy is not optional for production planning. Every throughput target, availability guarantee, and read-scaling decision maps directly to how many shards you provision and how many replicas you place in each shard.
The following diagram illustrates how these three levels relate to each other and how hash-slot ranges are ...