Skip to content

feat: Allow JDBC to configure directpath for connection #3927

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

Merged
merged 2 commits into from
Jun 27, 2025

Conversation

sakthivelmanii
Copy link
Collaborator

@sakthivelmanii sakthivelmanii commented Jun 26, 2025

BEGIN_COMMIT_OVERRIDE
chore: Allow JDBC to configure directpath for connection
END_COMMIT_OVERRIDE

Description:

Directpath allows GCP VM to connect to Spanner directly instead of going through public Google frontend. It improves the performance of the client library since all the requests are directly flowing to Spanner directly.

If client workload is deployed in non GCP VM, directpath will not work. it will fallback to connecting to Google public frondend.

In JDBC, we will be providing the support where customers can add the property attemptDirectPath=true which will enable directpath for the connection.

@sakthivelmanii sakthivelmanii requested review from a team as code owners June 26, 2025 17:52
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: spanner Issues related to the googleapis/java-spanner API. labels Jun 26, 2025
@sakthivelmanii sakthivelmanii requested a review from olavloite June 26, 2025 17:53
@@ -1604,6 +1604,12 @@ public Builder disableLeaderAwareRouting() {
return this;
}

@BetaApi
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since directpath is not public GA, I have marked as @BetaApi

@@ -1000,7 +1000,7 @@ public static class Builder
private String compressorName;
private String emulatorHost = System.getenv("SPANNER_EMULATOR_HOST");
private boolean leaderAwareRoutingEnabled = true;
private boolean attemptDirectPath = true;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this configuration wasn't used at all so far, I changed the default behaviour.

@sakthivelmanii sakthivelmanii force-pushed the provide_support_to_enable_directpath branch from 63ca2f2 to 9b0c7bc Compare June 26, 2025 17:56
olavloite
olavloite previously approved these changes Jun 26, 2025
@olavloite olavloite merged commit 393a80d into main Jun 27, 2025
42 checks passed
@olavloite olavloite deleted the provide_support_to_enable_directpath branch June 27, 2025 05:33
@sakthivelmanii sakthivelmanii added the release-please:force-run To run release-please label Jun 27, 2025
@release-please release-please bot removed the release-please:force-run To run release-please label Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/java-spanner API. size: m Pull request size is medium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants