Skip to main content

Multi Zone Replication

You can enable Multi Zone Replication for your Upstash database. When enabled the data is replicated to multiple availability zones. Multi zone replication provides you high availability and better scalability.

High Availability

Multi-zone database is more resilient to failures because there are database replicas running in different zones. This means even if an availability zone is unavailable, your applications should not be affected as the requests will be redirected to the healthy zone. The failover time for a single-zone database is several minutes while it is seconds for a multi-zone database.

Better Scalability

In a multi-zone database, your requests are being distributed among the replicas in a round robin fashion. New replicas are added to the cluster to meet your high throughput needs.

Architecture

We use the single leader replication model. Each key is owned by a leader replica and other replicas become the backups of the leader. Writes on a key are processed by the leader replica first then propagated to backup replicas. Reads can be performed from any replica. This model gives a better write consistency and read scalability.

Each replica employs a failure detector to track liveness of the leader replica. When the leader replica fails for a reason, remaining replicas start a new leader election round and elect a new leader. This is the only unavailability window for the cluster where your requests can be blocked for a short period of time.

Multi-zone Architecture

Consistency

Write requests return after the leader replica processes the operation. Write operations are replicated to backup replicas asynchronously. Read requests can be served by any replica, which gives better horizontal scalability but also means a read request may return a stale value while a write operation for the same key is being propagated to backup replicas.

Upgrades

You can enable multi-zone replication for your database in the Upstash Console. Thanks to the replication model, there will be no down time. You can experience a slight degradation in the performance during the migration. Migration will be completed from a few seconds up to several minutes depending on the size of your database.

Pricing

Due to the increased infrastructure cost, the price of the multi-zone database is higher. It is $0.4 per 100K requests and $0.5 per GB-month.