-
Notifications
You must be signed in to change notification settings - Fork 186
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
loadbalancer-experimental: make connection selection strategy modular #2815
Merged
bryce-anderson
merged 15 commits into
apple:main
from
bryce-anderson:bl_anderson/configurable_connection_selection
Apr 2, 2024
Merged
loadbalancer-experimental: make connection selection strategy modular #2815
bryce-anderson
merged 15 commits into
apple:main
from
bryce-anderson:bl_anderson/configurable_connection_selection
Apr 2, 2024
Conversation
This file contains 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
…ancer Motivation: The configurable `linearSearchSpace` is used as a strategy for picking among sessions in a particular host but it is not highly used and mayber for good reason: sessions that are beyond the max size are always in the odd position of getting picked a lot or seldom, depending on how many sessions there are. There is not way to set how many times it will attempt to pick a random entry after the linear search space so if you exceed the linear space by just 1 the extra connection will be re-attempted 64 times in a row before failing. There is probably room for customizing the connection pool selection strategy but we can probably make it more modular. Modifications: Delete the notion of a `linearSearchSpace` from the DefaultLoadBalancer. Result: Less code to worry about.
servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java
Outdated
Show resolved
Hide resolved
servicetalk-loadbalancer/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
9abe7e5
to
ca93833
Compare
…ble_connection_selection
...dbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategy.java
Show resolved
Hide resolved
...er-experimental/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategyFactory.java
Outdated
Show resolved
Hide resolved
...er-experimental/src/test/java/io/servicetalk/loadbalancer/P2CConnectionPoolStrategyTest.java
Show resolved
Hide resolved
...perimental/src/main/java/io/servicetalk/loadbalancer/LinearSearchConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
...dbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
...lancer-experimental/src/main/java/io/servicetalk/loadbalancer/P2CConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
...lancer-experimental/src/main/java/io/servicetalk/loadbalancer/P2CConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
...lancer-experimental/src/main/java/io/servicetalk/loadbalancer/P2CConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
...r-experimental/src/main/java/io/servicetalk/loadbalancer/CorePoolConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
...r-experimental/src/main/java/io/servicetalk/loadbalancer/CorePoolConnectionPoolStrategy.java
Outdated
Show resolved
Hide resolved
…ble_connection_selection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great enhancement!
...alancer-experimental/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategies.java
Outdated
Show resolved
Hide resolved
...er-experimental/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategyFactory.java
Outdated
Show resolved
Hide resolved
...dbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/ConnectionPoolStrategy.java
Show resolved
Hide resolved
idelpivnitskiy
approved these changes
Apr 1, 2024
...loadbalancer-experimental/src/main/java/io/servicetalk/loadbalancer/LoadBalancerBuilder.java
Outdated
Show resolved
Hide resolved
…of ConnectionPoolStrategy
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.
Motivation:
The configurable
linearSearchSpace
is used as a strategyfor picking among sessions in a particular host but it is not
highly used and mayber for good reason: sessions that are beyond
the max size are always in the odd position of getting picked a
lot or seldom, depending on how many sessions there are. There is
not way to set how many times it will attempt to pick a random
entry after the linear search space so if you exceed the linear
space by just 1 the extra connection will be re-attempted 64
times in a row before failing. There are potentially better ways to
select hosts such as encouraging a core pool of connections, etc.
Modifications:
Make the connection selection policy modular and have multiple
supported patterns that users can experiment with.