-
Notifications
You must be signed in to change notification settings - Fork 26.4k
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
Enhancement for graceful shutdown #1021
Conversation
因为现在大多数用dubbo的公司,为了避免极端情况下的雪崩和流量风暴,大部分接口都会关闭重试机制,这样,对于当前dubbo优雅停机的设定,就无法做到优雅停机了,所以这里通过比较简单的方式,加大了在不重试情况下优雅停机的成功率。 |
测试方案: B模块是provider,会启动多个,端口号不同,配置和代码:
A模块是consumer,重试设置成0,配置和代码:
|
改造前,如果创建1个A模块实例和5个B模块实例,在启动后,使用kill杀掉其中一个B模块,A模块将会产生如下异常:
使用改造后的dubbo,所有配置都不变,kill其中一个B模块,A模块没有抛任何异常。 |
如果想调整provider和consumer的等待时间,只需要在dubbo.properties中设置如下key就可以: |
@chickenlj 先给我点时间了解下49525b0,呵呵 |
That's what I need !!! |
…ication before destroy server.
What is the purpose of the change
目前不管是用的最多的2.5.3版本还是最新的2.5.7版本,亲自测试在不设置重试机制下是无法做到优雅停机的,这次改动主要是修改一点点代码,加上可配置的等待时间,就能简单的做到“不开启重试也能优雅停机”。
其主要实现机制就是在【provider断连注册中心之后,关闭应答之前】和【consumer移除掉invoker后,关闭client之前】这两个阶段加入可配置的等待时间,目前亲测可以做到不配置重试也能优雅停机。
Brief changelog
modified: dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java
modified: dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ProtocolConfig.java
modified: dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/protocol/AbstractInvoker.java
modified: dubbo-rpc/dubbo-rpc-default/src/main/java/com/alibaba/dubbo/rpc/protocol/dubbo/DubboInvoker.java
modified: dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftInvoker.java
Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
[Dubbo-XXX] Fix UnknownException when host config not exist
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipITs
to make sure unit-test pass. Runmvn clean test-compile failsafe:integration-test
to make sure integration-test pass.