# MemoryDB: Speed, Durability, and Composition.

DevFeed: [MemoryDB: Speed, Durability, and Composition.](<https://devfeed.tech/articles/memorydb-speed-durability-and-composition-12556.md>)

Original publisher: [Read original article](<http://brooker.co.za/blog/2024/04/25/memorydb.html>)

Author: Marc Brooker

Published: 2024-04-25T00:00:00Z

Content type: article

Language: en

Sources: [Marc Brooker's](<https://devfeed.tech/sources/marc-brooker-s-blog.md>)

Topics: [in-memory database](<https://devfeed.tech/topics/in-memory-database.md>), [systems](<https://devfeed.tech/topics/systems.md>), [consistency](<https://devfeed.tech/topics/consistency.md>), [software-architecture](<https://devfeed.tech/topics/software-architecture.md>), [Cache](<https://devfeed.tech/topics/cache.md>)

Tags: [amazon](<https://devfeed.tech/tags/amazon.md>), [amazon-memorydb](<https://devfeed.tech/tags/amazon-memorydb.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [availability](<https://devfeed.tech/tags/availability.md>), [aws](<https://devfeed.tech/tags/aws.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [compatibility](<https://devfeed.tech/tags/compatibility.md>), [composition](<https://devfeed.tech/tags/composition.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [cost](<https://devfeed.tech/tags/cost.md>), [data-loss](<https://devfeed.tech/tags/data-loss.md>), [database](<https://devfeed.tech/tags/database.md>), [datacenter](<https://devfeed.tech/tags/datacenter.md>), [distributed](<https://devfeed.tech/tags/distributed.md>), [distributed-systems](<https://devfeed.tech/tags/distributed-systems.md>), [durability](<https://devfeed.tech/tags/durability.md>), [election](<https://devfeed.tech/tags/election.md>), [enterprise](<https://devfeed.tech/tags/enterprise.md>), [enterprise-security](<https://devfeed.tech/tags/enterprise-security.md>), [speed](<https://devfeed.tech/tags/speed.md>)

## AI overview

MemoryDB combines Redis with a fast, multi-AZ transaction journal to retain Redis compatibility while providing durable writes, strong consistency on failover, high availability, microsecond-scale reads, and single-digit millisecond writes. The journal synchronously replicates data and also supports replica fan-out, leader election through fencing, and safe reconfiguration, reducing changes needed inside Redis. Snapshotting is moved off the database nodes to avoid latency spikes and the extra RAM that on-box snapshots can require; the separate snapshot service is optimized for throughput. The excerpt explains that lease-based leadership alone can be unsafe when pauses delay a writer past its lease deadline, so the journal must validate the leader's identity on writes. These are claims and explanations from the supplied excerpt, which ends during its description of journal benefits.

## Source excerpt

MemoryDB: Speed, Durability, and Composition. Blocks are fun. Earlier this week, my colleagues Yacine Taleb, Kevin McGehee, Nan Yan, Shawn Wang, Stefan Mueller, and Allen Samuels published Amazon MemoryDB: A fast and durable memory-first cloud database1. I'm excited about this paper, both because its a very cool system, and because it gives us an opportunity to talk about the power of composition in distributed systems, and about the power of distributed systems in general. But first, what is MemoryDB? Amazon MemoryDB for Redis is a durable database with microsecond reads, low single-digit millisecond writes, scalability, and enterprise security. MemoryDB delivers 99.99% availability and near instantaneous recovery without any data loss. or, from the paper: We describe how, using this architecture, we are able to remain fully compatible with Redis, while providing single-digit millisecond write and microsecond-scale read latencies, strong consistency, and high availability. This is remarkable: MemoryDB keeps compatibility with an existing in-memory data store, adds multi-AZ (multi-datacenter) durability, adds high availability, and adds strong consistency on failover, while still improving read performance and with fairly little cost to write performance. How does that work? As usual, there's a lot of important details, but the basic idea is composing the in-memory store (Redis) with our existing fast, multi-AZ transaction journal2 service (a system we use in many places inside AWS). Composition What's particularly interesting about this architecture is that the journal service doesn't only provide durability. Instead, it provides multiple different benefits: durability (by synchronously replicating writes onto storage in multiple AZs), fan-out (by being the replication stream replicas can consume), leader election (by having strongly-consistent fencing APIs that make it easy to ensure there's a single leader per shard), safety during reconfiguration and resharding