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

[tag subnets] add tag by subnets for near-rpc #216

Merged
merged 6 commits into from
Aug 14, 2023

Conversation

carlvine500
Copy link
Contributor

@carlvine500 carlvine500 commented Aug 1, 2023

What is the purpose of the change

fix issue: apache/dubbo#12763

most people depoy service in three zone for HA , we expect service rpc in same zone :

WeChat59657f69ec05d9cc588af6d033f03e95

tag-subnets:

cn|shanghai|a:
- 172.37.66.0/24 #zone=cn-shanghai-a
- 172.37.67.0/24 #zone=cn-shanghai-a
cn|shanghai|b:
- 172.37.68.0/24 #zone=cn-shanghai-b
cn|shanghai|c:
- 172.37.69.0/24 #zone=cn-shanghai-c

some company's service are in a big zone , we expect service rpc in same cell :

WeChata0d541688dc3fb1b8b84931642e6ad33 tag-subnets:
cn|shanghai|a|cell-1:
- 172.31.35.0/24 #zone=cn-shanghai-a
cn|shanghai|a|cell-2:
- 172.31.36.0/24 #zone=cn-shanghai-a
cn|shanghai|a|cell-3:
- 172.31.37.0/24 #zone=cn-shanghai-a

some company's service are in serveral city, we expect service prefer rpc in same zone , and rpc special service across zone( such as stock quantity service):

WeChatacb485d9d2e4cb56bd50c4f3557e83b4 tag-subnets:
cn|shanghai|a:
- 172.37.66.0/24 #zone=cn-shanghai-a
cn|hangzhou|b:
- 172.37.67.0/24 #zone=cn-hangzhou-b
cn|shenzhen|c:
- 172.37.68.0/24 #zone=cn-shenzhen-c
"":
- 172.37.69.0/24 #zone=cn-shanghai-d, as common service

Brief changelog

  • add a configuration in configcenter: /dubbo/config/dubbo/tag.subnets , content is :
cn|shanghai|a:
- 172.37.66.0/24 #zone=cn-shanghai-a
cn|shanghai|b:
- 172.37.68.0/24 #zone=cn-shanghai-b
cn|shanghai|c:
- 172.37.69.0/24 #zone=cn-shanghai-c
  • ServiceConfig.java will add a tag by subnet, such as :
    service on host 172.37.66.1 will add a dubbo.tag=cn|shanghai|a

  • and then service in cn-shanghai-a will rpc same zone

  • pull request tag support multi level dubbo#12673 will help to prefer rpc with long tag-level, for example:
    consumer rpc tag=cn|shanghai|a
    prefer1: service tag=cn|shanghai|a
    prefer2: service tag=cn|shanghai
    prefer3: service tag=cn
    prefer4: service tag=""

Verifying this change

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2023

Codecov Report

Merging #216 (95285ca) into master (abd907b) will increase coverage by 0.19%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master     #216      +/-   ##
============================================
+ Coverage     33.63%   33.83%   +0.19%     
- Complexity      497      505       +8     
============================================
  Files           154      156       +2     
  Lines          5280     5326      +46     
  Branches        655      662       +7     
============================================
+ Hits           1776     1802      +26     
- Misses         3306     3326      +20     
  Partials        198      198              

see 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@carlvine500 carlvine500 changed the title tag subnets [tag subnets] add tag by subnets for near-rpc Aug 1, 2023

<properties>
<javax.ws.rs.version>2.1</javax.ws.rs.version>
<argline>-Dnetwork_interface_denylist=docker0</argline>
Copy link
Member

Choose a reason for hiding this comment

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

Why add this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why add this?

Thanks for your review , I will remove these redundant properties .

remove redundant properties.
@carlvine500 carlvine500 requested a review from AlbumenJ August 10, 2023 00:52
Comment on lines 56 to 59
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
Copy link
Member

Choose a reason for hiding this comment

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

Is this dependency necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this dependency necessary?

like most of the extensions pom.xml , import org.junit.jupiter in testcontainers . can I import jupiter instead of testcontainers ?

Copy link
Member

Choose a reason for hiding this comment

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

sure

Copy link
Contributor Author

@carlvine500 carlvine500 Aug 11, 2023

Choose a reason for hiding this comment

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

sure

ok , test depend on junit-jupiter-engine now .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AlbumenJ please check it again .

@carlvine500 carlvine500 requested a review from AlbumenJ August 10, 2023 05:41
<version>1.0.2-SNAPSHOT</version>
<artifactId>dubbo-tag-subnets</artifactId>
<name>${project.artifactId}</name>
<description>The SOFARegistry module of Dubbo project</description>
Copy link
Member

Choose a reason for hiding this comment

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

Is this typo?

Others LGTM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is this typo?

Others LGTM

sorry, I forget to change description, it's ok now .

@AlbumenJ AlbumenJ merged commit a6e6eb1 into apache:master Aug 14, 2023
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