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

[Dubbo-7054]消费者端Executor改为全局共享,不再按提供者Port共享。 #7109

Merged
merged 8 commits into from
Feb 22, 2021
Merged

[Dubbo-7054]消费者端Executor改为全局共享,不再按提供者Port共享。 #7109

merged 8 commits into from
Feb 22, 2021

Conversation

zhangyz-hd
Copy link
Contributor

@zhangyz-hd zhangyz-hd commented Jan 18, 2021

What is the purpose of the change

目前社区版本消费者端的executor线程池是按提供者的Port的做了共享,当一个提供者下线时,AbstractClient就会将executor销毁,造成后续处理ChannelState.DISCONNECTED事件,以及消费者再调用其他提供者时无可用的executor,就会重新在创建一个executor,这个模式会导致#7054 所描述的问题。
同时考虑到消费者维护N个executor的开销,因此将消费者端的executor改为全局1个,在节点shutdown时再销毁。

Brief changelog

1,DefaultExecutorRepository分配executor时,消费者的key使用Integer.MAX_VALUE,保证消费者使用1个executor,提供者保持原装(按协议的port分配executor);同时getExecutor()内不再createExecutor,当executor为null则直接降级返回SHARED_EXECUTOR;
2,AbstractClient在close0时不关闭其持有的executor;
3,DubboBootstrap.destroy()时销毁ExecutorRepository;

Follow this checklist to help us incorporate your contribution quickly and easily:

  • 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.
  • Format the pull request title like [Dubbo-XXX] Fix UnknownException when host config not exist #XXX. 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.
  • 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.
  • Run mvn clean install -DskipTests=false & mvn clean test-compile failsafe:integration-test to make sure unit-test and integration-test pass.
  • If this contribution is large, please follow the Software Donation Guide.

@codecov-io
Copy link

Codecov Report

Merging #7109 (7c8dfcd) into master (bd43fa7) will decrease coverage by 0.54%.
The diff coverage is 81.81%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #7109      +/-   ##
============================================
- Coverage     60.07%   59.53%   -0.55%     
+ Complexity      506      287     -219     
============================================
  Files          1028     1001      -27     
  Lines         41531    39918    -1613     
  Branches       6038     5904     -134     
============================================
- Hits          24951    23765    -1186     
+ Misses        13813    13448     -365     
+ Partials       2767     2705      -62     
Impacted Files Coverage Δ Complexity Δ
.../threadpool/manager/DefaultExecutorRepository.java 83.87% <78.94%> (-4.27%) 0.00 <0.00> (ø)
.../apache/dubbo/config/bootstrap/DubboBootstrap.java 41.88% <100.00%> (-0.16%) 0.00 <0.00> (ø)
...pache/dubbo/remoting/transport/AbstractClient.java 65.71% <100.00%> (+2.70%) 0.00 <0.00> (ø)
...che/dubbo/common/utils/CharSequenceComparator.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...che/dubbo/rpc/cluster/support/FailfastCluster.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...bo/rpc/cluster/interceptor/ClusterInterceptor.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...java/org/apache/dubbo/remoting/etcd/Constants.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...pache/dubbo/metadata/report/support/Constants.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...igurator/override/OverrideConfiguratorFactory.java 0.00% <0.00%> (-100.00%) 0.00% <0.00%> (ø%)
...e/dubbo/registry/status/RegistryStatusChecker.java 0.00% <0.00%> (-81.25%) 0.00% <0.00%> (ø%)
... and 175 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 bd43fa7...7c8dfcd. Read the comment docs.

reFix ExecutorRepositoryTest
Copy link
Contributor

@kevinw66 kevinw66 left a comment

Choose a reason for hiding this comment

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

LGTM

@wongoo
Copy link

wongoo commented Jun 30, 2021

@zhangyz-hd pls check this issue #8172, do u have any idea to fix it?

@zhangyz-hd zhangyz-hd deleted the fix_7054_again branch July 5, 2021 02:22
vio-lin pushed a commit to vio-lin/incubator-dubbo that referenced this pull request Jun 2, 2023
fixes apache#7054

(cherry picked from commit 2dadaf8)

# Conflicts:
#	dubbo-common/src/test/java/org/apache/dubbo/common/threadpool/manager/ExecutorRepositoryTest.java
#	dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java
vio-lin added a commit to vio-lin/incubator-dubbo that referenced this pull request Oct 9, 2023
消费者端Executor改为全局共享,不再按提供者Port共享。 (apache#7109)

See merge request framework/dubbo!66
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.

6 participants