Can you explain the differences between "Data persistence" and "In-memory replication"?

The Redis Labs Team -

Data persistence - via AOF or snapshots - is used solely to restore the database if it fails. This is needed since Redis is an in-memory datastore and when the process stops or the server crashes - everything in RAM is lost. Data persistence is optional (i.e. can be set to none) and enabling it is free of charge. Persistence can be done either using AOF (Append Only File), which writes the latest 'write' commands into a file every second. This file can be 'replayed' in order to recover from a Redis crash. A snapshot is performed every 1/6/12 hours. The snapshot is a dump of the data and while there is a potential of losing up to 1/6/12 hour of data, it is dramatically faster to recover from a snapshot compared to AOF recovery.

Replication can be used with or without data persistence (although you're likely to use both if you want true HA). We use a replication factor of 2 in our Standard and Multi-AZ plans, which means data is kept twice: once in the master node and once in a slave replica. The purpose of replication is to have a target node with all the data to fail over to if and when the master node fails.

In-memory replication uses Redis' standard replication mechanism and keeps the slave's data in its RAM. This is the recommended mode as not only does it ensure instant failover but also increases the performance of the database because all persistent storage tasks (e.g. AOF) are delegated to the slave. In-memory's replication only "disadvantage" is its price - since each datum is kept in RAM twice, using it essentially means you'll need twice the amount of memory and therefore will pay more.

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk