Key-value stores
Put a value under a key and get it back by that key, fast, at almost any scale.
10 technologies on this page ↓How it works
A key-value store keeps a map from keys to values and offers little more than three operations: put a value under a key, get it back, and delete it. The database never looks inside the value, which can be a string, a serialized object or an image. That keeps every operation a lookup: microseconds for in-memory stores such as Valkey, Redis and MemoryDB, single-digit milliseconds for DynamoDB on disk. To scale out, the key is hashed to pick a partition, so data and traffic spread across many servers and the cluster grows by adding more. The price is that the key is the only way in. You can’t search on what’s inside a value, and there are no joins, so you choose keys around the questions you’ll ask. Many stores add a little on top: Redis and Valkey offer lists, sets, sorted sets and atomic counters as values, DynamoDB sorts items within a partition and can index other attributes, and etcd adds transactions and watches on keys.
A wall of numbered lockers. Give the number and you have the bag in seconds; ask for every bag with a red scarf inside and someone has to open every locker.
Reach for it when
- Sessions, shopping carts, feature flags and rate-limit counters
- Lookups by ID at huge scale, with steady low latency
- Configuration and coordination data a cluster must agree on, like Kubernetes state in etcd
Think twice when
- Finding records by what’s inside them; use a document database or add a search index
- Reporting, ad-hoc questions and joins
A real example
A web shop keeps each shopper’s session and cart in Valkey under session:<id>, set to expire after 30 minutes. Every page view is one GET, so any of the shop’s servers can handle the next click. Finding every cart that holds a given product, though, would mean reading every key.
Technologies
Specific products, and what each does differently.
Amazon DynamoDBAWSAWS’s serverless key-value and document database, with single-digit-millisecond reads at any size.
Amazon ElastiCacheAWSAWS’s managed Valkey, Redis OSS and Memcached, as node-based clusters or a serverless cache.
Amazon MemoryDBAWSA Valkey- and Redis-compatible database that keeps everything in memory but loses no acknowledged write.
ValkeyOpen sourceThe Linux Foundation’s BSD-licensed fork of Redis 7.2.4: an in-memory key-value server that Redis clients can talk to unchanged. Amazon DynamoDB | Managed service on AWS | Amazon Web Services | Proprietary | 2026-10-05 |
Amazon ElastiCache | Managed service on AWS | Amazon Web Services | Proprietary (runs open-source engines: Valkey, Memcached and Redis OSS up to 7.1, all BSD-3-Clause) | 2026-10-05 |
Amazon MemoryDB | Managed service on AWS | Amazon Web Services | Proprietary (engine compatible with open-source Valkey 7.2 and Redis OSS 7, both BSD-3-Clause) | 2026-10-05 |
| Open source | Apple Inc. | Apache 2.0 | 2026-10-12 | |
| Open source | Memcached open-source project (originally Danga Interactive) | BSD-3-Clause | 2026-10-06 | |
| Open source | Redis Ltd. | AGPLv3, RSALv2 or SSPLv1 (Redis 8+) | 2026-10-05 | |
| Open source | Meta | Dual: GPLv2 or Apache 2.0, your choice (BSD plus a patent grant until July 2017) | 2026-10-06 | |
Valkey | Open source | Linux Foundation | BSD-3-Clause | 2026-10-06 |
| Commercial product | Cloudflare, Inc. | Proprietary | 2026-10-12 | |
| Open source | Cloud Native Computing Foundation | Apache 2.0 | 2026-10-06 |
What each provider calls it
- AWS
- DynamoDB; ElastiCache and MemoryDB for Valkey or Redis OSS
- Google Cloud
- Memorystore for Valkey or Redis; Bigtable for durable lookups by row key
- Azure
- Azure Managed Redis; Azure Cosmos DB for Table
- Open source & others
- Valkey (BSD), Redis (AGPLv3 option since 8.0), etcd, FoundationDB, TiKV; embedded in your program: RocksDB
See it in a real stack
Architectures that use key-value stores
In code · bash
# valkey-cli (redis-cli works the same)
SET session:9f3a '{"user":42,"cart":["sku-17"]}' EX 1800 # expires in 30 minutes
GET session:9f3a
# an atomic counter per user per minute, for rate limiting
INCR rate:42:0930
EXPIRE rate:42:0930 60Worth exploring
Often confused with
Where it came from1979–2024
Storing values under keys is one of the oldest ideas in data storage. Ken Thompson’s dbm library, released with Seventh Edition Unix in 1979, kept key-value pairs in files, and Berkeley DB, first released in 1991, offered the same model as a library that programs could embed. But data shared by many users mostly lived in relational databases.
Web-scale services broke that habit. In 2007 Amazon described Dynamo, a key-value store for services like the shopping cart that only looked data up by primary key and had to keep accepting writes even when disks failed or networks broke. In 2009 Salvatore Sanfilippo released Redis, a server that kept everything in memory and let values be lists, sets and counters as well as strings. In 2012 AWS turned the Dynamo lessons into DynamoDB, a managed service.
Key-value stores also became the foundation under other systems. Kubernetes keeps all of its cluster state in etcd, and FoundationDB, which Apple open-sourced in 2018, adds ACID transactions across keys. In 2024, after Redis moved to source-available licences, the Linux Foundation forked it as Valkey, which AWS and Google Cloud now run as managed services.
Why it’s built this way
- The value is opaque
- If the database never parses values, every operation is a lookup by key. That keeps latency low and predictable, and a value can be anything from a counter to an image.
- Hash keys to spread data across machines
- Dynamo used consistent hashing so a cluster could grow one node at a time, moving only a small share of the data. Hash partitioning is still how these stores scale.
- Availability before immediate consistency
- A customer should always be able to add to a cart, even during failures. Dynamo never rejected a write because of a failure and reconciled diverging copies later, the trade-off now called eventual consistency.
- Keep everything in memory
- Redis held the whole dataset in RAM so every operation was fast, and wrote it to disk only for durability. Memory limits the size, but it made data structures like sorted sets cheap to offer.
Timeline
- 1979
Ken Thompson’s
dbmkey-value library ships with AT&T Unix - 1991
First general release of Berkeley DB
- 2007
Amazon publishes the Dynamo paper
- 2009
Redis is released as open source
- 2012
AWS launches DynamoDB as a managed service
- 2018
Apple open-sources FoundationDB
- 2024
Redis changes licence; the Linux Foundation forks Valkey
- Seventh Edition Unix manual: dbm(3X) (1979), via TUHS
- Wikipedia: DBM (computing), on Ken Thompson’s original dbm
- Olson, Bostic and Seltzer: Berkeley DB (USENIX 1999), on the 1991 first release
- Werner Vogels: Amazon’s Dynamo, with the full SOSP paper (Oct 2007)
- Redis FAQ: why Redis keeps data in memory
- Hacker News: Redis (Feb 2009)
- Werner Vogels: Amazon DynamoDB (Jan 2012)
- FoundationDB blog: FoundationDB is open source (Apr 2018)
- Redis blog: Redis adopts dual source-available licensing (Mar 2024)
- Linux Foundation: Launches open source Valkey community (Mar 2024)
- AWS What’s New: Announcing Amazon ElastiCache for Valkey (Oct 2024)
Sources20
- DB-Engines: Key-value stores
- DynamoDB Developer Guide: What is Amazon DynamoDB? (key-value and document models, single-digit millisecond performance)
- DynamoDB Developer Guide: Partitions and data distribution
- DynamoDB Developer Guide: Improving data access with secondary indexes
- Amazon MemoryDB FAQs (microsecond read latency)
- Redis docs: Data types
- Valkey docs: SET (EX seconds)
- Valkey docs: INCR (atomic counters)
- etcd docs: API (transactions and watches)
- Kubernetes docs: Cluster components (etcd holds all API server data)
- ElastiCache User Guide: What is Amazon ElastiCache? (Valkey, Memcached, Redis OSS)
- Google Cloud: Memorystore for Valkey overview
- Google Cloud: Bigtable overview (a sorted key-value map)
- Microsoft Learn: What is Azure Managed Redis?
- Microsoft Learn: Azure Cosmos DB for Table
- Valkey on GitHub: COPYING (BSD-3-Clause)
- Redis blog: Redis is now available under the AGPLv3 open source license (May 2025)
- apple/foundationdb on GitHub: ordered key-value store with ACID transactions
- tikv/tikv on GitHub: distributed transactional key-value database
- facebook/rocksdb on GitHub: embeddable persistent key-value store