If a primary node fails or becomes overloaded, replication to read-only nodes can become abnormal. This prevents the cluster from processing read and write requests when accessed through a database proxy. However, the read-only nodes can still serve read requests. You can set a minimum number of reserved instances for the database proxy. This reserves a specified number of read-only nodes to handle read requests, which improves instance availability during exceptions.
Feature description
Setting the minimum number of reserved instances allows the cluster to retain a specified number of read-only nodes to process read requests during exceptions, such as a primary node breakdown or a replication interruption on a read-only node. After you set this value, the database proxy ensures that at least min{Minimum number of reserved instances, Number of running read-only nodes with a read weight greater than 0} read-only nodes are available.
A running read-only node is a node in the Running state. This applies regardless of its replication status.
Scenarios
The minimum number of reserved instances applies to the following two scenarios:
A faulty primary node causes a replication interruption on a read-only node.
In this scenario, you can set the minimum number of reserved instances to ensure that the database proxy endpoint can still handle read requests.
A high volume of write operations on the primary node causes the replication delay of read-only nodes to exceed the maximum latency threshold, which affects load balancing.
When the replication delay exceeds the threshold, all read traffic is forwarded to the primary node. This can overload or even suspend the primary node. If you set a minimum number of reserved instances, the reserved read-only nodes will share the read traffic. This prevents the primary node from being suspended due to a high CPU load.
Node retention policy
If the number of routable read-only nodes falls below the specified minimum number of reserved instances, the system retains read-only nodes based on the following policy:
The system first retains read-only nodes that are already being routed. Then, the system prioritizes retaining nodes whose replication delay is higher than the maximum latency threshold but are not interrupted. If the number of nodes is still insufficient, the system retains nodes with replication interruptions until the minimum number of reserved instances is met.
If multiple nodes have the same replication status and meet the preceding priority criteria, they are sorted by read weight. Nodes with higher read weights are prioritized for retention.
After you set the minimum number of reserved instances, traffic can be routed to nodes whose replication delay exceeds the maximum latency threshold. However, traffic cannot be routed to nodes with a read weight of 0.
The following examples illustrate the node retention policy:
Example of node retention for different replication statuses
Scenario
Minimum number of reserved instances
Maximum latency threshold
RO1 (Replication delay)
RO2 (Replication delay)
RO3 (Replication delay)
Proxy readable
Readable nodes
1
1
-1
-1
-1
-1
Yes
RO1
2
-1
50
60
Yes
RO2
3
1
30
0
40
40
Yes
RO1
4
40
50
60
Yes
RO1
5
-1
-1
-1
Yes
RO1
6
-1
50
60
Yes
RO2
7
2
30
20
60
40
Yes
RO1,RO2
8
20
-1
60
Yes
RO1,RO3
9
20
-1
-1
Yes
RO1,RO2
NoteA replication delay of
-1indicates a replication interruption.0indicates no replication delay. A value greater than 0 indicates a replication delay without an interruption.ROindicates a read-only node.Example of node retention for the same replication status but different read weights
Scenario
Minimum number of reserved instances
RO1 (Node weight)
RO2 (Node weight)
RO3 (Node weight)
Readable
Readable nodes
10
2
0
20
0
Yes
RO2
11
0
0
0
No
None
12
0
20
20
Yes
RO2,RO3
NoteA read weight of
0indicates that the node does not participate in routing. A value greater than 0 indicates that the node participates in routing.
Prerequisites
The database proxy is enabled, and the version is 2.9.5 or later. For more information, see Enable the database proxy.
Usage notes
After you set the minimum number of reserved instances, traffic may be routed to read-only nodes even if their replication delay exceeds the latency threshold.
The minimum number of reserved instances applies to both read/write mode and read-only mode.
Procedure
Go to the RDS Instances page. At the top of the page, select the region where the target instance is located. Then, click the instance ID.
In the navigation pane on the left, click Database Proxy.
In the Connection Information section, find the target database proxy endpoint and click Modify Configuration in the Actions column.
In the dialog box that appears, enter a value for Minimum Reserved Instances and click OK.
API reference
| Operation | Description |
|---|---|
| DescribeDBProxy | Queries the detailed database proxy settings of an RDS instance |
| DescribeDBProxyEndpoint | Queries information about a database proxy endpoint |
| ModifyDBProxyEndpoint | Modifies the connection settings for a database proxy endpoint |