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

Ftr: Nearest first for multiple registry #659

Merged
merged 13 commits into from
Aug 9, 2020
Merged

Conversation

cityiron
Copy link
Contributor

What this PR does:
This extension provides a strategy to decide how to distribute traffics among them:

  1. registry marked as 'preferred=true' has the highest priority.
  2. check the zone the current request belongs, pick the registry that has the same zone first.
  3. Evenly balance traffic between all registries based on each registry's weight.
  4. Pick anyone that's available.

Which issue(s) this PR fixes:

Fixes #597

Special notes for your reviewer:
@zouyx
Does this PR introduce a user-facing change?:


Copy link
Member

@zouyx zouyx left a comment

Choose a reason for hiding this comment

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

Well done bro.

But i think this is a new featrue for dubbo-go , so should change the title base on https://github.com/apache/dubbo-go/blob/master/contributing.md

If not ready for merge , should change the status to draft as below
image

@zouyx zouyx requested review from AlexStocks and hxmhlt July 15, 2020 17:20
@zouyx zouyx linked an issue Jul 15, 2020 that may be closed by this pull request
@AlexStocks AlexStocks changed the title fix: Nearest first for multiple registry Ftr: Nearest first for multiple registry Jul 15, 2020
@cityiron
Copy link
Contributor Author

https://github.com/apache/dubbo-go/blob/master/contributing.md

OK,I will do better next.

@hxmhlt
Copy link
Contributor

hxmhlt commented Jul 17, 2020

I think it should be a new feature. But the original extension registry_aware_cluster_invoker should be hold back?

@zouyx zouyx requested a review from fangyincheng July 17, 2020 09:58
@zouyx zouyx added the enhancement New feature or request label Jul 17, 2020
@AlexStocks
Copy link
Contributor

Have u finished you pr? Plc merge the latest develop branch to fix the conflict problembs.

cluster/loadbalance/util.go Outdated Show resolved Hide resolved
config/reference_config.go Outdated Show resolved Hide resolved
cityiron and others added 2 commits July 27, 2020 09:36
@cityiron
Copy link
Contributor Author

I think it should be a new feature. But the original extension registry_aware_cluster_invoker should be hold back?

This feature base on java implementation,no registryAware but zoneAware only.

@zouyx zouyx added this to the 1.5.1 milestone Jul 28, 2020
@cityiron
Copy link
Contributor Author

Have u finished you pr? Plc merge the latest develop branch to fix the conflict problembs.

Finish and merge develop branch.

cluster/cluster_impl/zone_aware_cluster.go Outdated Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster.go Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster.go Outdated Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster_invoker.go Outdated Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster_invoker.go Outdated Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster_invoker_test.go Outdated Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster_invoker_test.go Outdated Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster_invoker_test.go Outdated Show resolved Hide resolved
cluster/cluster_impl/zone_aware_cluster_invoker_test.go Outdated Show resolved Hide resolved
config/reference_config.go Outdated Show resolved Hide resolved
config/registry_config.go Outdated Show resolved Hide resolved
cluster/cluster_impl/failover_cluster.go Outdated Show resolved Hide resolved
cluster/loadbalance/util.go Show resolved Hide resolved
common/constant/key.go Outdated Show resolved Hide resolved
config/reference_config.go Outdated Show resolved Hide resolved
config/reference_config.go Outdated Show resolved Hide resolved
cityiron and others added 2 commits August 7, 2020 09:30
# Conflicts:
#	common/constant/key.go
#	config/registry_config.go
common/constant/key.go Outdated Show resolved Hide resolved
cluster/cluster_interceptor.go Outdated Show resolved Hide resolved
cluster/cluster_impl/base_cluster_invoker.go Outdated Show resolved Hide resolved
Copy link
Contributor

@fangyincheng fangyincheng left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov-commenter
Copy link

Codecov Report

Merging #659 into develop will increase coverage by 0.34%.
The diff coverage is 74.46%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #659      +/-   ##
===========================================
+ Coverage    63.58%   63.93%   +0.34%     
===========================================
  Files          239      238       -1     
  Lines        12650    12487     -163     
===========================================
- Hits          8044     7983      -61     
+ Misses        3821     3740      -81     
+ Partials       785      764      -21     
Impacted Files Coverage Δ
cluster/loadbalance/util.go 66.66% <61.11%> (-19.05%) ⬇️
cluster/cluster_impl/zone_aware_cluster_invoker.go 68.00% <68.00%> (ø)
cluster/cluster_impl/base_cluster_invoker.go 72.15% <85.71%> (+1.31%) ⬆️
cluster/cluster_impl/failover_cluster.go 100.00% <100.00%> (ø)
cluster/cluster_impl/zone_aware_cluster.go 100.00% <100.00%> (ø)
config/reference_config.go 79.82% <100.00%> (+0.92%) ⬆️
config/registry_config.go 80.64% <100.00%> (+1.33%) ⬆️
cluster/router/tag/router_rule.go 71.42% <0.00%> (-12.79%) ⬇️
config/config_center_config.go 64.28% <0.00%> (-9.05%) ⬇️
config/consumer_config.go 56.25% <0.00%> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e377f4...4dfc8aa. Read the comment docs.

Copy link
Member

@zouyx zouyx left a comment

Choose a reason for hiding this comment

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

Wait for travis pass

@zouyx zouyx merged commit f0017a8 into apache:develop Aug 9, 2020
@cityiron
Copy link
Contributor Author

cityiron commented Aug 9, 2020

sample pr: dubbogo/dubbo-samples#6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Align with Dubbo: Nearest first for multiple registry
6 participants