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

loadbalancer-experimental: make connection selection strategy modular #2815

Conversation

bryce-anderson
Copy link
Contributor

@bryce-anderson bryce-anderson commented Jan 25, 2024

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 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.

…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.
@bryce-anderson bryce-anderson force-pushed the bl_anderson/configurable_connection_selection branch from 9abe7e5 to ca93833 Compare February 7, 2024 17:25
@bryce-anderson bryce-anderson changed the title WIP: core pool connection pool strategy loadbalancer-experimental: make connection selection strategy modular Feb 7, 2024
@bryce-anderson bryce-anderson marked this pull request as ready for review February 7, 2024 17:38
@bryce-anderson bryce-anderson requested a review from daschl March 27, 2024 21:54
Copy link
Member

@idelpivnitskiy idelpivnitskiy left a comment

Choose a reason for hiding this comment

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

LGTM, great enhancement!

@bryce-anderson bryce-anderson merged commit 71b5fa6 into apple:main Apr 2, 2024
15 checks passed
@bryce-anderson bryce-anderson deleted the bl_anderson/configurable_connection_selection branch April 2, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants