Amazon RDS Multi-AZ

Learn via video courses

Overview

To combat the issue related to outages or any DB instance failures, AWS offers Amazon RDS Multi-AZ which provides high availability, enhanced durability, and deploying relational databases across up to three Availability Zones (AZs). The automatic failover for Amazon RDS Multi-AZ happens without any administrative intervention and at zero data loss which makes it a popular AWS service.

Introduction

When your organization is serving various geographies, you might not want your users to face any latency or outage for any failures that might occur. To help solve your problem, AWS RDS Multi-AZ helps to provide high availability and enhanced durability by deploying the relational databases across up to three Availability Zones (AZs). The data is also synchronously replicated to your standby instance on a different AZ. Hence, when any DB instance failure or an infrastructure failure occurs, AWS RDS Multi-AZ is capable of performing an automatic failover without any manual intervention to any of the standby instances, which helps to minimize the disruption that might affect your application.

The below diagram shows how AWS RDS Multi-AZ deployments work.

aws rds multi az deployments working

With AWS RDS Multi-AZ, setting up and operating the instances along with scaling a relational database comes in really handy. This helps to offer scalable capacity that too at a lower cost. You can save time-consuming administrative activities, like database setup, patching, hardware provisioning, and backups by automating the task with AWS RDS Multi-AZ.

Also, AWS RDS supports Multi-AZ deployments with readable standby instances widely known as AWS RDS Multi-AZ DB cluster deployments. By Amazon RDS Multi-AZ with two readable standbys, we can serve for additional read capacity for AWS RDS Multi-AZ deployment and critical transaction latency requirements for workloads can also be adjusted.

Amazon RDS Multi-AZ with One Standby

When we talk about the Amazon RDS Multi-AZ with one standby, the key features that we highlight are: Database performance is protected: We are advised not to suspend the I/O activity from the primary instance while the backup is going on from the standby instance. Automatic failover: Offers high availability with automatic database failover. This automatic failover is gathered back within 60 seconds without any manual intervention in addition to zero data loss. High availability: We can deploy the standby instance in a second AZ availability and this helps us achieve high Availability and fault tolerance when either an AZ or database instance failure occurs. Amplify durability: For keeping the data on the standby database instance up to date with the primary, we are advised to implement and use AWS RDS Multi-AZ synchronous replication technologies.

Let us understand the working of the Amazon RDS Multi-AZ with one standby:

The AWS RDS automatically creates a primary database (DB) instance when the Amazon RDS Multi-AZ deployment is going on. This is synchronous replication where the data is replicated to an instance on a different AZ(Availability Zone). Once a failure is detected, AWS RDS automatically redirects the failover to a standby instance without the hassle of any manual intervention.

Below is the working explanation for Amazon RDS Multi-AZ with one standby:

working for amazon rds multi az with one standby

Amazon RDS Multi-AZ with Two Readable Standbys

When we talk about the Amazon RDS Multi-AZ with two readable standbys, the key features that we highlight are:

Automatic failover(under 35 seconds): Offers high availability with automatic database failover. This automatic failover is gathered back within 35 seconds. The automatic failover happens without any manual intervention and at zero data loss.

Use separate endpoints for reads and writes: To maximize scalability and performance, it is advised to route queries to the write servers and use appropriate read replica standby instances.

Up to 2x faster transaction commit latency can be gained: We can achieve improved write latency which is up to 2x faster transaction commit as compared to Multi-AZ with one standby.

Amplified read capacity: As we get the capability to efficiently distribute traffic across the two readable standby instances helps to amplify read capacity.

Let us understand the working of the Amazon RDS Multi-AZ with two readable standbys:

With Amazon RDS Multi-AZ with two readable standbys, the MySQL or PostgreSQL databases are deployed in at least three AZs which makes it highly available and durable. Once a failure is detected, AWS RDS Multi-AZ with two readable standbys does an automatic failover under 35 seconds at a 2x faster transaction commit latency when compared with automatically redirecting the failover to an Amazon RDS Multi-AZ with one standby. We are also offered additional read capacity in addition to a choice of AWS Graviton2 or Intel-based instances for computing purposes.

Below is the working explanation for Amazon RDS Multi-AZ with two readable standbys:

working for amazon rds multi az with two standby

Comparison Table

Below is the comparison table where we have the comparison features against which the Single-AZ, Multi-AZ with one standby, and Multi-AZ with two readable standbys have been compared:

Comparison FeaturesSingle-AZMulti-AZ with one standbyMulti-AZ with two readable standbys
Available EnginesAWS RDS for SQL Server, AWS RDS for MariaDB, AWS RDS for Oracle, AWS RDS for MySQL, AWS RDS for PostgreSQLAWS RDS for MariaDB, AWS RDS for PostgreSQL, AWS RDS for SQL Server, AWS RDS for MySQL, AWS RDS for OracleAWS RDS for MySQL, AWS RDS for PostgreSQL
Automatic failover durationAutomatic failover duration is not available. You need either a user or a user-initiated point-in-time restore operation. Also, the operation to automatic failover duration might take several hours to complete. In addition to this, no data updates are available that occurred after the latest restorable time (within the last 5 minutes).The Automatic failover duration is done within 60 seconds when a new primary is available for serving the new workload. This failover time is independent of any write throughput.The Automatic failover duration is done under 35 seconds where a new primary is available for serving the new workload. The failover time is dependent on the length of the replica lag.
Additional Read capacityYou don't get Additional Read capacity as it is limited with the primaryYou don't get Additional Read capacity. The standby DB instance is only for passive failover targets for achieving the high availability goals.We get two standby DB instances that act as failover targets and eventually serve as read traffic. The read capacity gets specified by the overhead of write transactions that are received from the primary.
Lower jitter for transaction commitsNo optimization is available for jitterWith respect to the write path, it's sensitive to impairments.For transaction commits, it might use the 2-of-3 write quorum: making it insensitive for up to one impaired write path.
For transaction commits - Lower latency or Higher ThroughputNANAWe get up to 2x faster transaction commits when compared with the AWS RDS Multi-AZ with one standby
Higher resiliency with AZ outage( AZ failure)If any AZ outage occurs, the risk of data loss and the hours of failover time is significantly yours.If any AZ outage occurs, the workload shall automatically failover with the up-to-date standby.If any AZ outage occurs, The workload shall be taken by one of the two remaining standbys that shall serve the write workload from the primary

AWS RDS Multi-AZ DB Cluster Architecture

In an AWS RDS Multi-AZ DB cluster, the replication of data happens by using the DB engine's native replication capabilities from the writer DB instance to the reader DB instances. Whenever a writer DB instance captures changes, the reader DB instances are sent and updated. The acknowledgment by at least one reader database instance is needed for a change to be committed and applied. For an increased application read throughput, reader DB instances act as automatic failover targets in addition to serving the read traffic. Hence, managing the failover outage by one of the reader DB instances.

aws rds multi az db cluster architecture

As shown above, the AWS RDS Multi-AZ DB clusters offer lower write latency as compared to AWS RDS Multi-AZ DB instance deployments as they allow read-only workloads only to run on the reader DB instances.

Amazon RDS Multi-AZ Deployments

The AWS RDS Multi-AZ deployments offer high availability. Here based on the number of standby DB instances the AWS RDS Multi-AZ deployments are defined, where it's called AWS RDS Multi-AZ DB instance deployment when it has one standby DB instance. While it's called AWS RDS Multi-AZ DB cluster deployment when the deployment has two standby DB instances.

AWS RDS Multi-AZ DB instance deployment offers failover support but doesn't serve any read traffic. While AWS RDS Multi-AZ DB cluster deployment offers failover support along with serving the read traffic.

We can use the AWS Management Console for specifying between the AWS RDS Multi-AZ DB instance deployment or AWS RDS Multi-AZ DB cluster deployment. This can be done by choosing a DB identifier from the Databases in the navigation pane.

  • The AWS RDS Multi-AZ DB instance deployment offers the following characteristics:
    • The value of AWS RDS Multi-AZ is set to Yes.
    • Only one row for the DB instance.
    • The value of Role is Instance or Primary.
  • The AWS RDS Multi-AZ DB cluster deployment offers the following characteristics:
    • The value of Role is Multi-AZ DB cluster for the cluster-level row whereas it is Writer instance or Reader instance for each instance-level row.
    • A cluster-level row with three DB instance rows under it is offered.
    • The value of Multi-AZ is 3 Zones for each instance-level row.

RDS Multi-AZ Use Cases

Below are a few of the various use cases of the AWS RDS Multi-AZ that show how we can implement the AWS RDS Multi-AZ and unleash its benefits:

No more using the legacy databases We can feel free to exercise our innovation without investigating inexpensive, retaliatory, legacy commercial databases by simply migrating the databases to Amazon Aurora. With this migration, we get the freedom to become scalable, improve performance, and have high availability that too at 1/10th the cost compared with legacy databases.

Building the web and mobile applications With the AWS RDS Multi-AZ, we can support the growing application by asking for its high availability with higher throughput, and offering storage scalability. To suit the multiple application usage patterns., we can unleash the advantage such as flexible pay-per-use pricing offered by AWS RDS Multi-AZ.

Move to managed databases By implementing the AWS RDS Multi-AZ, we can focus on innovations and building new applications by keeping aside the stress related to databases. As AWS RDS Multi-AZ offers databases that do not require self-managing the databases it costs time, increased complexity, and is also heavy on pockets.

Amazon RDS Multi-AZ Pricing

When we talk about the pricing structure offered by AWS RDS Multi-AZ we not only have the free tier option but we get two different sections as well where one is for the AWS RDS Single-AZ Deployment and another for AWS RDS Multi-AZ Deployment.

Free Tier Pricing for AWS RDS Multi-AZ: AWS RDS allows its new AWS customers to get started for free with the managed database service where for each calendar month, pricing for AWS RDS Free Tier offers:

  • 20 GB of General Purpose (SSD) DB storage.
  • 750 hours of Amazon RDS Single-AZ db.t2.micro, db.t3.micro, and db.t4g.micro Instances usage free that are running on MySQL, MariaDB, and PostgreSQL databases each month. When the usage exceeds more than one instance, then the usage gets aggregated across instance classes.
  • 20 GB of storage for all the automated database backups in addition to any user-initiated DB Snapshots.
  • 750 hours of Amazon RDS Single-AZ db.t2.micro Instance usage running on Oracle BYOL or SQL Server. Here, if the user is using the Oracle BYOL db.t3.micro Single-AZ Instance usage then also falls under the AWS RDS free tier. The usage gets aggregated when the user runs both a db.t2.micro Single-AZ Instance and a db.t3.micro Single-AZ Instance on Oracle BYOL.

Pricing Structure for AWS RDS Multi-AZ vs AWS RDS Single-AZ:

  • AWS RDS Multi-AZ is only available for MariaDB, Amazon RDS for MySQL, Amazon RDS for PostgreSQL, Amazon RDS for Oracle, and Amazon RDS for SQL Server. Whereas AWS RDS Multi-AZ with two readable standbys is only available for AWS RDS for MySQL and RDS for PostgreSQL.
  • The price offered for AWS RDS Single-AZ deployments, Multi-AZ deployments with one standby instance, and Multi-AZ deployments with two readable standbys are priced at per DB instance-hour consumed that too ranging between the time a DB instance was launched until it is stopped or terminated(deleted).
  • Also, AWS RDS Multi-AZ is comparatively twice the costs of AWS RDS Single-AZ where for example you might get charged
    • $0.017/hour for db.t2.micro single and $0.034/hour for db.t2.micro multi.
  • For partial DB instance hours, the Billing is charged in one-second increments where a 10 minute minimum charge is accounted followed by a billable status change like starting, creating, or even changing or modifying the DB instance class.

Benefits of RDS Multi-AZ Deployments

Listed below are the four major benefits that AWS RDS Multi-AZ offers its users:

Increased high availability

By running Multi-AZ deployments, we achieve enhanced database availability. This happens when a loss of Availability Zone or DB Instance failure occurs, the availability is only impacted for the limited time taken for the automatic failover to completely come up. This automatic failover is under one minute for Amazon Aurora and less than 30 seconds with MariaDB Connector or a maximum goes till one to two minutes for any other database engines. For any planned maintenance and backups, the operations are first applied on standby, before the automatic failover. This allows the availability is back only within the time required for the automatic failover to complete.

Automatic failover When the primary instance fails during Multi-AZ deployment, Amazon RDS initiates an automatic failover to either one of the up-to-date standby or a replica in the case of Amazon Aurora. No administrative or manual intervention is required during automatic failover as the AWS RDS kees a check ad continuously monitors the health of the primary as well as standby instances.

Magnified durability With AWS RDS Multi-AZ deployments utilizing synchronous replication helps to maintain the updated data on standby with the primary. While with the SQL Server engine this synchronous replication achieves the same result, by employing SQL Server-native Mirroring or Always-on technology. All the above techniques and approach channels towards safeguarding the data during Availability Zone failure or any DB Instance failure magnified the durability of AWS RDS Multi-AZ.

Database performance is protected With Multi-AZ deployments, we get the protection of our Database performance as no I/O activity is kept on hold from the primary during backup. The backup happens from the standby while you may experience some latencies for a few minutes. Also, during instance failure, AWS RDS uses the RDS Multi-AZ feature to automate failover on one of the 15 Amazon Aurora Replicas created from any of three Availability Zones. When no Amazon Aurora Replicas are provisioned, then Amazon RDS attempts the creation of a new Amazon Aurora DB instance automatically for the same.

Difference between Multi-AZ and Read Replicas in Amazon RDS

So far, we learned about the AWS RDS Multi-AZ and its features and benefits, we might believe that Multi-AZ deployments and Read Replicas in Amazon RDS are similar. This can be assumed as both offering high availability and high durability by maintaining an additional copy of the data, let us go through the below comparison table to understand the differences between both of them:

Comparison FeatureMulti-AZ deploymentsRead replicas
PurposeOffers High availabilityOffers High scalability
BackupsThe automated backups for Aurora are taken from the shared storage layer whereas for Non-Aurora these are taken from standby.By default, the automated backups are not configured
AvailabilityThe Availability within a single region is always spaned for at least two Availability ZonesThe Availability is spanned for either an Availability Zone, Cross-AZ, or Cross-Region
ReplicationAurora: asynchronous replication whereas for Non-Aurora: synchronous replicationOffers Asynchronous replication
How Active the instances areFor Aurora: all instances remain active whereas for Non-Aurora only the primary instance remains active.Accessibility is high across all the read replicas which can be used for read scaling
Automatic failoverWhenever a problem or error is detected the automatic failover happens on read replica for Aurora instances whereas the automatic failover happens to the standby for Non-Aurora instances.Whenever a problem or error is detected, automatic failover happens manually. The manual promotion happens to be the primary instance for Aurora instances whereas it happens on a standalone database for Non-Aurora instances.
Database engine version upgradeThe database engine version upgrades for Aurora happened on all of its instances together whereas for Non-Aurora upgrades happen only on the primary instanceThe database engine version upgrades for Aurora happened on all of its instances together whereas for Non-Aurora the upgrade is independent of the source instance.

Conclusion

  • AWS RDS Multi-AZ helps to provide high availability and enhanced durability by deploying the relational databases across up to three Availability Zones (AZs).
  • With Multi-AZ deployments, we get the protection of our Database performance as no I/O activity is kept on hold from the primary during backup. The backup happens from the standby while you may experience some latencies for a few minutes.
  • The price offered for AWS RDS Single-AZ deployments, Multi-AZ deployments with one standby instance, and Multi-AZ deployments with two readable standbys are priced at per DB instance-hour consumed that too ranging between the time a DB instance was launched until it is stopped or terminated(deleted).
  • Amazon RDS Multi-AZ with two readable standbys Offers high availability with automatic database failover. This automatic failover is gathered back within 35 seconds. The automatic failover happens without any manual intervention and at zero data loss.
  • AWS RDS Multi-AZ with two readable standby gives up to 2x faster transaction commits when compared with the AWS RDS Multi-AZ with one standby.