Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Availability Zone Affinity for Read-only Connections #1139

Open
2 tasks
aaronforest-wf opened this issue Oct 1, 2024 · 4 comments
Open
2 tasks

Support Availability Zone Affinity for Read-only Connections #1139

aaronforest-wf opened this issue Oct 1, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@aaronforest-wf
Copy link

Describe the feature

A new reader selection strategy that supports availability zone affinity would be useful for reducing latency similar to what is described here: https://aws.amazon.com/blogs/architecture/improving-performance-and-reducing-cost-using-availability-zone-affinity/

Use Case

I have multiple instances of a service running in EKS which are spread across different availability zones within 1 AWS region. I also have multiple RDS Aurora read replicas running across multiple availability zones within that same AWS region. Currently, when my service requests a connection to the RDS read-only endpoint, there is no priority given to RDS replica instances in the same availability zone as the service (even though same-AZ connections would have sub-millisecond latency versus single digit millisecond latency for cross-AZ connections).

Proposed Solution

Because the driver is already aware of the RDS cluster topology, most (all?) of the information required to implement availability zone affinity should be accessible. A new reader selection strategy could be implemented which will give a higher priority to replica instances within the current availability zone when establishing a new read-only connection.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

The AWS Advanced JDBC Driver version used

2.4.0

JDK version used

Corretto 21.0.3

Operating System and version

Amazon Linux 2

@aaronforest-wf aaronforest-wf added the enhancement New feature or request label Oct 1, 2024
@sergiyvamz
Copy link
Contributor

Hi, @aaronforest-wf

Thank you for reaching out with this issue. This idea has been discussed some time ago but unfortunately RDS API doesn't provide enough data to prioritize one cluster instance after another based on their availability zone. Availability zone for a cluster member isn't available through RDS API.

Thank you

@aaronforest-wf
Copy link
Author

@sergiyvamz I'm not sure how difficult it would be to integrate with this API, but it looks like the RDS DescribeDBInstances API does include an AvailabilityZone property for each DBInstance in the response.

@sergiyvamz
Copy link
Contributor

Hi @aaronforest-wf

Thank you for looking into this. RDS API has already integrated in some of our plugins and there's no issues to add DescribeDBInstances. We'll review this enhancement once again.

@Petersoj
Copy link

Petersoj commented Oct 19, 2024

Perhaps this feature can construct the AZ instance mappings not only using the RDS API, but also through custom RDS endpoints mappings provided by the user. Each custom RDS endpoint would contain instances of a specific AZ and these mappings are then provided via a data source property. Although, I suppose an integration with the RDS API would be a more seamless developer experience. Just some thoughts.

Follow up suggestion: now with Local Write Forwarding available on Aurora Postgres and MySQL, perhaps AZ affinity shouldn't be exclusive to read-only connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants