-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
auth: Significant performance degradation with new authentication library in Spanner client (100x slower) #10927
Comments
cc: @quartzmo |
Upon further investigation, we found that the latency is due to differences in how the grpc.ClientConn is created between the old and new authentication libraries. In the previous authentication library, On the other hand, in the new authentication library,
The key difference between By analyzing the runtime/trace tool, we discovered that in the new authentication library, takes longer time for resolving DNS. When we tried setting the default scheme to passthrough before running the benchmarks using I hope this additional investigation is helpful for addressing the issue. |
@toga4 Thank you for reporting this issue, and for your thorough and detailed analysis. We will prioritize a fix. |
@toga4 After investigating this issue a bit, I am not certain that the current implementation default (using the Will it work for you to use |
@quartzmo Thank you for considering about this issue. You’re absolutely right that some environments could benefit from the client-side load balancing benefits using the dns scheme. We can take the approach you suggested. Additionaly, I’ve confirmed that using When using the emulator, I think the benefits of client-side load balancing are limited in most cases. It might be worth considering a change where the passthrough scheme is used by default when the emulator is detected and no scheme is specified in the endpoint configuration. google-cloud-go/spanner/client.go Lines 405 to 413 in ece7426
That said, I understand that there are several places in the SDK source code where the emulator is detected, so implementing this change might require updates across multiple locations... |
Client
Spanner. probably all clients which uses new auth lib.
Environment
Apple M3
Code and Dependencies
go.mod
Expected behavior
equivalent performance.
Actual behavior
Additional context
After upgrading to a recent version of the Google Cloud Go SDK, we observed a significant slowdown in the execution time of our end-to-end tests using Cloud Spanner Emulator. The slowdown occurs at the point of the first communication after creating the Client, which led us to suspect that the issue might be related to authentication.
Upon investigating the differences between versions, we discovered that a new authentication library is being used in the updated SDK. The same issue occurs with the DatabaseAdminClient and InstanceAdminClient. We think that the problem likely affects all clients that rely on the new authentication library.
By switching back to the previous authentication library via environment variables
GOOGLE_API_GO_EXPERIMENTAL_DISABLE_NEW_AUTH_LIB
, we were able to restore the previous execution times.While we understand that in actual Google Cloud environments, factors like network latency and the frequency of authentication may make this performance difference less impactful, the issue becomes significant in cases where multiple Client instances are generated, such as in test code using the Emulator. In such scenarios, the slowdown can have a substantial impact, and we believe addressing this would be a meaningful improvement.
The text was updated successfully, but these errors were encountered: