Amazon RDS Multi-AZ Deployments vs Read Replica

Amazon RDS Multi-AZ Deployments vs Read Replica

Amazon RDS (Relational Database Service) provides several features to enhance the availability, scalability, and reliability of your databases. Two of these features are Read Replicas and Multi-AZ (Availability Zone) deployments. Here is the explanation of how each of these works internally and their respective use cases:

Read Replica in Amazon RDS

Read Replica is a feature that allows you to create read-only copies of your database instance. This helps distribute read traffic and offload queries from the primary database, improving performance and scalability.

How Read Replicas Work Internally:

  1. Primary Instance: The original database instance where data changes are made.
  2. Asynchronous Replication: Changes made to the primary database are asynchronously replicated to the read replica. This means that the replication process does not wait for the changes to be applied to the replica before completing the transaction on the primary instance.
  3. Replication Mechanism:
    • MySQL, MariaDB, PostgreSQL: Use native asynchronous replication features.
    • Oracle: Uses Data Guard for replication.
    • SQL Server: Uses SQL Server transactional replication.
  4. Read-Only: The read replica databases are set up to handle read-only operations. That means, write operations are not allowed.
  5. Lag: Because replication is asynchronous, there can be a lag between the primary instance and the read replica. This lag is the time it takes for the data to be copied from the primary to the replica.
  6. Multiple Read Replicas: You can create multiple read replicas for a single primary instance to further distribute the read load.
  7. Promotion to Primary: If needed, a read replica can be promoted to become a standalone primary instance, converting it into a read-write instance.

Benefits of Read Replicas:

  • Scaling Read Operations: Offload read-heavy operations from the primary instance to one or more read replicas. This is useful for applications with high read-to-write ratios.
  • Geographical Distribution: Place read replicas in different regions to reduce latency for users globally.
  • Data Analytics: Use read replicas to run analytical queries without impacting the performance of the primary database.

Multi-AZ Deployments in Amazon RDS

Multi-AZ Deployment is designed to enhance the availability and reliability of the database by automatically replicating data across multiple Availability Zones (AZs).

How Multi-AZ Works Internally:

  1. Primary Instance: The main database instance where read/write operations occur.
  2. Standby Instance: A synchronized standby instance is created in a different AZ within the same region.
  3. Synchronous Replication: Unlike read replicas, Multi-AZ uses synchronous replication. This means changes are immediately and automatically replicated from the primary instance to the standby instance.
  4. Automatic Failover: In the event of an infrastructure failure (e.g., hardware failure, network outage) or maintenance, Amazon RDS automatically fails over to the standby instance. The database endpoint remains the same, so the application can reconnect without requiring changes.
  5. Continuous Monitoring: RDS monitors the health of the primary and standby instances and manages failover automatically.
  6. Recovery from Failover: The standby instance is promoted to primary, and a new standby is created in another AZ if necessary.

Benefits of Multi-AZ:

  • High Availability: Critical applications that require high availability and resilience against AZ failures.
  • Disaster Recovery: Applications that need automatic failover capabilities to minimize downtime and maintain business continuity during outages.

Discover more from Coursity

Subscribe to get the latest posts sent to your email.

Leave a Comment


No comments yet. Why don’t you start the discussion?

    Leave a Reply

    Your email address will not be published. Required fields are marked *