-
Notifications
You must be signed in to change notification settings - Fork 902
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
Rackaware placement policy support local node awareness by hostname #4057
Merged
hangc0276
merged 3 commits into
apache:master
from
hangc0276:chenhang/new-ensemble-rack-aware-local-node
Sep 20, 2023
Merged
Rackaware placement policy support local node awareness by hostname #4057
hangc0276
merged 3 commits into
apache:master
from
hangc0276:chenhang/new-ensemble-rack-aware-local-node
Sep 20, 2023
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
hangc0276
requested review from
merlimat,
sijie,
dlg99,
eolivelli,
zymap,
wenbingshen and
StevenLuMT
August 22, 2023 16:01
@horizonzy Please help take a look, thanks. |
eolivelli
approved these changes
Aug 24, 2023
zymap
reviewed
Aug 25, 2023
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java
Outdated
Show resolved
Hide resolved
...eper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java
Show resolved
Hide resolved
...-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
Show resolved
Hide resolved
horizonzy
reviewed
Aug 28, 2023
bookkeeper-server/src/main/java/org/apache/bookkeeper/conf/AbstractConfiguration.java
Outdated
Show resolved
Hide resolved
...eper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicy.java
Show resolved
Hide resolved
...-server/src/test/java/org/apache/bookkeeper/client/TestRackawareEnsemblePlacementPolicy.java
Show resolved
Hide resolved
horizonzy
approved these changes
Aug 30, 2023
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.
merlimat
approved these changes
Sep 1, 2023
Ghatage
pushed a commit
to sijie/bookkeeper
that referenced
this pull request
Jul 12, 2024
…pache#4057) ### Motivation Rack-aware placement policies enable preference for bookies that reside in the same rack as the bookie client. - Initiate local node by resolving the rack information https://github.com/apache/bookkeeper/blob/5b5c05331757e7356579076970e61f119f5d34ae/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java#L207-L215 - When generating new ensembles for a ledger, the selecting algorithm will set the localNode's rack to `curRack` and select one bookie from `curRack` first https://github.com/apache/bookkeeper/blob/5b5c05331757e7356579076970e61f119f5d34ae/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java#L420-L426 However, when resolving the local node's rack information, we use IP to resolve the rack name, which is unfriendly with k8s deployment. https://github.com/apache/bookkeeper/blob/5b5c05331757e7356579076970e61f119f5d34ae/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java#L209 In k8s deployment, we usually use the hostname as bookieId and Pulsar broker name instead of IP, because the IP will be changed when the pods migrated to other nodes. ### Modification In order not to bring break change to the current behavior, I introduced a flag `useHostnameResolveLocalNodePlacementPolicy` in the BookKeeper client configuration to control whether to use the hostname to resolve the bookie client's local node rack information. The flag is `false` by default, which is the same behavior as the current logic. Due to this PR doesn't introduce any break changes, I think we can cherry-pick it back to the patch releases (branch-4.14, branch-4.15 and branch-4.16)
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
Rack-aware placement policies enable preference for bookies that reside in the same rack as the bookie client.
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
Lines 207 to 215 in 5b5c053
curRack
and select one bookie fromcurRack
firstbookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
Lines 420 to 426 in 5b5c053
However, when resolving the local node's rack information, we use IP to resolve the rack name, which is unfriendly with k8s deployment.
bookkeeper/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/RackawareEnsemblePlacementPolicyImpl.java
Line 209 in 5b5c053
In k8s deployment, we usually use the hostname as bookieId and Pulsar broker name instead of IP, because the IP will be changed when the pods migrated to other nodes.
Modification
In order not to bring break change to the current behavior, I introduced a flag
useHostnameResolveLocalNodePlacementPolicy
in the BookKeeper client configuration to control whether to use the hostname to resolve the bookie client's local node rack information. The flag isfalse
by default, which is the same behavior as the current logic.Due to this PR doesn't introduce any break changes, I think we can cherry-pick it back to the patch releases (branch-4.14, branch-4.15 and branch-4.16)