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-4556] fix dubbo startup is slow #4603

Merged
merged 2 commits into from
Aug 1, 2019
Merged

Conversation

crossoverJie
Copy link
Member

What is the purpose of the change

fix #4556

Brief changelog

modify:dubbo/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/ServiceConfig.java

@codecov-io
Copy link

codecov-io commented Jul 18, 2019

Codecov Report

Merging #4603 into master will decrease coverage by 0.26%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #4603      +/-   ##
============================================
- Coverage     64.17%   63.91%   -0.27%     
+ Complexity      453      449       -4     
============================================
  Files           768      769       +1     
  Lines         32869    33160     +291     
  Branches       5179     5226      +47     
============================================
+ Hits          21094    21193      +99     
- Misses         9358     9545     +187     
- Partials       2417     2422       +5
Impacted Files Coverage Δ Complexity Δ
...in/java/org/apache/dubbo/config/ServiceConfig.java 59.14% <100%> (+0.72%) 0 <0> (ø) ⬇️
.../apache/dubbo/qos/protocol/QosProtocolWrapper.java 64.1% <0%> (-17.95%) 0% <0%> (ø)
...e/dubbo/remoting/transport/netty/NettyChannel.java 54.11% <0%> (-8.24%) 19% <0%> (-2%)
...apache/dubbo/rpc/protocol/dubbo/FutureAdapter.java 53.84% <0%> (-7.7%) 0% <0%> (ø)
...beans/factory/annotation/ReferenceBeanBuilder.java 68% <0%> (-7%) 0% <0%> (ø)
...ng/transport/dispatcher/all/AllChannelHandler.java 51.42% <0%> (-5.72%) 0% <0%> (ø)
.../org/apache/dubbo/remoting/ExecutionException.java 15.78% <0%> (-5.27%) 0% <0%> (ø)
.../apache/dubbo/remoting/transport/AbstractPeer.java 63.04% <0%> (-4.35%) 0% <0%> (ø)
...g/p2p/exchange/support/MulticastExchangeGroup.java 72.34% <0%> (-4.26%) 0% <0%> (ø)
...mmon/serialize/kryo/utils/AbstractKryoFactory.java 75% <0%> (-3.58%) 0% <0%> (ø)
... and 35 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 d7d4d67...bc1a8dc. Read the comment docs.

@tswstarplanet
Copy link
Contributor

The pr alarm user that getting ip is too slow by log ?

@crossoverJie
Copy link
Member Author

Yes, I've seen a Dubbo service take two hours to start.

image

image

See here for more information:
https://crossoverjie.top/2019/07/05/troubleshoot/dubbo-start-slow/

Of course, we can also add a timeout period, and once the timeout occurs,
the service start fails.

Copy link
Member

@beiwei30 beiwei30 left a comment

Choose a reason for hiding this comment

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

I cannot agree with this solution, since it does nothing useful but keep printing out the warning message every 10 secs.

Instead of doing this, why don't we simply put more logging messages for this method?

logger.info(hostToBind + " is not valid local host, try to find valid host from DNS.");
hostToBind = InetAddress.getLocalHost().getHostAddress();

@crossoverJie
Copy link
Member Author

I cannot agree with this solution, since it does nothing useful but keep printing out the warning message every 10 secs.

Instead of doing this, why don't we simply put more logging messages for this method?

logger.info(hostToBind + " is not valid local host, try to find valid host from DNS.");
hostToBind = InetAddress.getLocalHost().getHostAddress();

I think the root cause of this problem is that once the response is slow due to InetAddress.getLocalHost().getHostAddress(), the user does not know where to find the problem.

For logs printed every 10s, we can add some help to find the problem; for example: check DNS server or configure /etc/hosts.

Although the reason for executing InetAddress.getLocalHost().getHostAddress() is also caused by an invalid address, I don't think it can help the user find the problem quickly.

@chickenlj
Copy link
Contributor

I agree with the idea suggested by @beiwei30.

try to find a valid host from DNS... would be enough to warn the user where the problem is once the process hangs, that's the last message the user can see and obviously searching DNS is very likely to be a blocking operation.

@crossoverJie
Copy link
Member Author

@beiwei30 @chickenlj

Thank you for your advice.

Now think about adding a thread for a small probability event, it is too heavy.

I have revised it again.

Copy link
Member

@beiwei30 beiwei30 left a comment

Choose a reason for hiding this comment

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

LGTM.

@beiwei30
Copy link
Member

beiwei30 commented Aug 1, 2019

I can merge it once CI passes.

@beiwei30 beiwei30 merged commit 1173b40 into apache:master Aug 1, 2019
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.

Dubbo service startup is slow
6 participants