This page provides an overview of persistence for Memorystore for Valkey.
Memorystore for Valkey supports two types of persistence:
You can enable either AOF or RDB persistence for your instance but not both.
For the best instance availability and data durability, we recommend enabling both persistence and high availability (HA). While persistence and HA overlap in the protection that they offer, they have different strengths that complement each other. HA is the first line of defense against individual node failures and zonal outages. Persistence provides disaster recovery for rare events when all nodes in a shard fail and HA can't help. For more information about HA, see High availability and replicas.
Choosing a persistence type
Choosing between AOF and RDB persistence depends on your requirements for performance and data durability. These tradeoffs are generally true for all managed Valkey services because of the nature of AOF and RDB persistence.
If your top priority is data durability and preserving the highest percentage of writes sent to your Valkey server, then we recommend AOF persistence. AOF persistence can persist data every second (or for every write). This offers superior data durability compared to RDB snapshots, which save data on an hourly basis.
If performance is your top priority, then we recommend RDB persistence because this type of persistence usually places lower performance demands on your instance than AOF persistence. If you're comfortable with some staleness in your data on recovery and you want the performance that RDB persistence provides, then RDB persistence is the better choice for you.
You can achieve both high throughput and the durability of AOF persistence. To get both, enable AOF persistence and choose a high shard count. A high shard count provides more vCPUs, which improves performance. However, in any configuration, AOF persistence introduces some increase in latency.