Skip to content

Document DB behavior when the replica instance fails

0

Hey guys, I've been trying to find the answer to this question but there is no clear documentation around this specific topic. When we have an HA DocumentDB cluster we know that in case of a failure on the primary instance, the replica instance will promote but what happen to the read querys at that time when the reader is promoting to the primary and there is no another replica instance available to respond?

We have an application that uses the reader and writer endpoints of our HA cluster, as I said above, when the primary fails the replica will be promoted but what happen when the reader instance fails and there is only one replica instance? Will the read queries stop working? Will the read queries be redirected to the primary till the read replica is available or replaced?

Can you please share your thoughts around those specific questions? Thanks in advance.

asked a year ago105 views
1 Answer
0

When dealing with Amazon DocumentDB in a high availability (HA) configuration, it's important to understand the behavior during failover events, particularly concerning read replicas. Here’s what typically happens when the primary instance fails, and there's only one read replica:

Behavior When the Primary Instance Fails

Primary Instance Failure

  1. Promotion of Replica: If the primary instance fails, the read replica will be promoted to become the new primary instance. This process usually takes a few minutes, depending on various factors like the size of your dataset and network latency.

  2. Read Query Behavior:

    • During Promotion: When the read replica is promoting to primary, any read queries directed to the reader endpoint will fail until the promotion is complete. This is because the reader endpoint will temporarily be unavailable during the promotion process.
    • Post-Promotion: Once the promotion is complete, the new primary instance will accept both read and write queries. However, there may be a slight delay as it catches up on any writes that were pending at the time of the failover.

No Additional Replicas

If the reader instance itself fails and there are no additional replicas:

  1. Read Queries Fail: Any read queries directed to the reader endpoint will stop working while the reader is unavailable. There won’t be a fallback to the primary instance for reads unless you have explicitly coded your application to handle such failovers by redirecting read queries to the primary endpoint.

  2. Handling Failures: It is crucial for your application to have logic for handling such scenarios. Implementing retry mechanisms or fallbacks to the primary instance can help mitigate downtime during replica failures.

Here are some links to the official AWS documentation that provide further details on these behaviors:

  1. Amazon DocumentDB High Availability

  2. Failover in Amazon DocumentDB

  3. Amazon DocumentDB FAQ

  4. Monitoring Amazon DocumentDB

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.