Skip to content

Commit 10bf930

Browse files
authored
docs: fastest response strategy plugin (#1219)
1 parent b66e33d commit 10bf930

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

docs/using-the-jdbc-driver/ReaderSelectionStrategies.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ To balance connections to reader instances more evenly, different selection stra
88
| `roundRobin` | See the following rows for configuration parameters. | The round robin strategy will select a reader instance by taking turns with all available database instances in a cycle. A slight addition to the round robin strategy is the weighted round robin strategy, where more connections will be passed to reader instances based on user specified connection properties. | N/A |
99
| | `roundRobinHostWeightPairs` | This parameter value must be a `string` type comma separated list of database host-weight pairs in the format `<host>:<weight>`. The host represents the database instance name, and the weight represents how many connections should be directed to the host in one cycle through all available hosts. For example, the value `instance-1:1,instance-2:4` means that for every connection to `instance-1`, there will be four connections to `instance-2`. <br><br> **Note:** The `<weight>` value in the string must be an integer greater than or equal to 1. | `null` |
1010
| | `roundRobinDefaultWeight` | This parameter value must be an integer value in the form of a `string`. This parameter represents the default weight for any hosts that have not been configured with the `roundRobinHostWeightPairs` parameter. For example, if a connection were already established and host weights were set with `roundRobinHostWeightPairs` but a new reader node was added to the database, the new reader node would use the default weight. <br><br> **Note:** This value must be an integer greater than or equal to 1. | `1` |
11+
| `fastestResponse` | See the following rows for configuration parameters. | The fastest response strategy identifies the fastest response host, then stores this host in a cache for future use. <br><br> **Note:** The Fastest Response Strategy plugin must also be loaded into the plugins list by setting the `plugins` connection configuration parameter to include the `fastestResponseStrategy` plugin code. | N/A |
12+
| | `responseMeasurementIntervalMs` | Interval in millis between measuring response time to a database node. | `30000` |

docs/using-the-jdbc-driver/UsingTheJdbcDriver.md

+1
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ The AWS JDBC Driver has several built-in plugins that are available to use. Plea
207207
| [Developer Plugin](./using-plugins/UsingTheDeveloperPlugin.md) | `dev` | Any database | Helps developers test various everyday scenarios including rare events like network outages and database cluster failover. The plugin allows injecting and raising an expected exception, then verifying how applications handle it. | None |
208208
| [Aurora Initial Connection Strategy](./using-plugins/UsingTheAuroraInitialConnectionStrategyPlugin.md) | `initialConnection` | Aurora | Allows users to configure their initial connection strategy to reader cluster endpoints. | None |
209209
| [Limitless Connection Plugin](./using-plugins/UsingTheLimitlessConnectionPlugin.md) | `limitless` | Aurora | Enables client-side load-balancing of Transaction Routers on Amazon Aurora Limitless Databases . | None |
210+
| Fastest Response Strategy Plugin | `fastestResponseStrategy` | Aurora | When read-write splitting is enabled, this plugin selects the reader to switch to based on the host with the fastest response time. The plugin achieves this by periodically monitoring the hosts' response times and storing the fastest host in a cache. **Note:** the `readerHostSelectorStrategy` parameter must be set to `fastestResponse` in the user-defined connection properties in order to enable this plugin. See [reader selection strategies](./ReaderSelectionStrategies.md). | None |
210211

211212
[^1]: [RDS Multi-AZ DB Clusters do not support IAM](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/multi-az-db-clusters-concepts.Limitations.html).
212213
[^2]: Federated Identity and Okta rely on IAM. Due to [^1], RDS Multi-AZ Clusters are not supported.

wrapper/src/main/java/software/amazon/jdbc/plugin/strategy/fastestresponse/FastestResponseStrategyPlugin.java

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ public class FastestResponseStrategyPlugin extends AbstractConnectionPlugin {
5151
private static final Set<String> subscribedMethods =
5252
Collections.unmodifiableSet(new HashSet<String>() {
5353
{
54+
add("connect");
55+
add("forceConnect");
5456
add("notifyNodeListChanged");
5557
add("acceptsStrategy");
5658
add("getHostSpecByStrategy");

0 commit comments

Comments
 (0)