Skip to content

Consistent hashing support server tag#2994

Merged
wwbmmm merged 2 commits into
apache:masterfrom
egolearner:fix_constentent_hashing_server_tag
Jun 20, 2025
Merged

Consistent hashing support server tag#2994
wwbmmm merged 2 commits into
apache:masterfrom
egolearner:fix_constentent_hashing_server_tag

Conversation

@egolearner

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number:2993

Problem Summary:

What is changed and the side effects?

Changed:

  1. 在判断Node是否相同时,依次比较hash/server_addr/tag
  2. 在生成hash时,包含tag。

Side effects:

  • Performance effects:

  • Breaking backward compatibility:


Check List:

@egolearner

Copy link
Copy Markdown
Contributor Author

fix #2993

@egolearner

Copy link
Copy Markdown
Contributor Author

@chenBright @wwbmmm please take a look

@wwbmmm

wwbmmm commented Jun 16, 2025

Copy link
Copy Markdown
Contributor

Thank you for your contribution! I suggest to add a flag for backward compatibility: If the flag is on, add server tag for hash computing, if the flag is off, remain the original logic. Since consistent-hashing is always used in senarios that the servers are stateful, changing hashing logic may cause the request routed to new server that does not contain previous data for that request.

Comment thread src/brpc/policy/consistent_hashing_load_balancer.cpp Outdated
@egolearner egolearner force-pushed the fix_constentent_hashing_server_tag branch from aab5ae8 to 4512205 Compare June 16, 2025 08:02
@egolearner

Copy link
Copy Markdown
Contributor Author

Thank you for your contribution! I suggest to add a flag for backward compatibility: If the flag is on, add server tag for hash computing, if the flag is off, remain the original logic. Since consistent-hashing is always used in senarios that the servers are stateful, changing hashing logic may cause the request routed to new server that does not contain previous data for that request.

done

@egolearner

Copy link
Copy Markdown
Contributor Author

@chenBright @wwbmmm please take a look, thx

@chenBright chenBright left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@chenBright chenBright changed the title fix: consistent hashing support server tag Consistent hashing support server tag Jun 20, 2025
@wwbmmm wwbmmm merged commit 7dfc3f5 into apache:master Jun 20, 2025
15 checks passed
@egolearner egolearner deleted the fix_constentent_hashing_server_tag branch June 20, 2025 06:11
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.

3 participants