chore(spanner): add LatencyTracker interface and default implementation#12729
Open
chore(spanner): add LatencyTracker interface and default implementation#12729
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new latency tracking mechanism using Exponentially Weighted Moving Average (EWMA), including a LatencyTracker interface, its EwmaLatencyTracker implementation, and comprehensive unit tests. The primary feedback concerns the initial state of the EwmaLatencyTracker, specifically that an uninitialized tracker currently returns a score of 0.0. This is problematic as it implies a perfect score, potentially leading to incorrect load balancing decisions. It is suggested that an uninitialized tracker should instead return Double.POSITIVE_INFINITY to accurately reflect its unmeasured state, and a new test case should be added to verify this behavior.
...r/google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/EwmaLatencyTracker.java
Show resolved
Hide resolved
...ogle-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/EwmaLatencyTrackerTest.java
Show resolved
Hide resolved
bc8842b to
274308d
Compare
Adds an internal LatencyTracker interface and a default implementation that allows the client to track the latency of requests. This can be used for automatic replica selection and load balancing.
274308d to
c50bb2e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an internal LatencyTracker interface and a default implementation that allows the client to track the latency of requests. This can be used for automatic replica selection and load balancing.