-
Notifications
You must be signed in to change notification settings - Fork 929
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
Support gracefully offline without registry #1973
Support gracefully offline without registry #1973
Conversation
…fully shutdown 1. using sliding window for better logic to support gracefully shutdown, Signed-off-by: TheR1sing3un <87409330+TheRising3un@users.noreply.github.com>
…fully shutdown 1. using sliding window for better logic to support gracefully shutdown, Signed-off-by: TheR1sing3un <ther1sing3un@163.com>
…/github.com/TheR1sing3un/dubbo-go into support_gracefully_offline_without_registry
@LaurenceLiZhixin Please check! |
Codecov Report
@@ Coverage Diff @@
## 3.0 #1973 +/- ##
==========================================
+ Coverage 44.32% 44.50% +0.18%
==========================================
Files 283 283
Lines 17067 17037 -30
==========================================
+ Hits 7565 7583 +18
+ Misses 8696 8650 -46
+ Partials 806 804 -2
Continue to review full report at Codecov.
|
@LaurenceLiZhixin pls review this pr. thx. |
…onfig#OfflineRequestWindowTimeout 1. delete the "default" of config.graceful_shutdown_config#OfflineRequestWindowTimeout Signed-off-by: TheR1sing3un <ther1sing3un@163.com>
…/github.com/TheR1sing3un/dubbo-go into support_gracefully_offline_without_registry
maybe we can add an issue for the pr? just personal advice. |
yep! I will do it! |
What this PR does:
这一块是不基于注册中心的优雅下线的第一个小功能点。原本的逻辑是以10ms为间隔轮询counter,在等待未超时的情况下,一旦发现counter为0,就结束该步骤了。那么这样可能会有问题,在那一轮询counter的一瞬间,当前的请求刚好都返回,但是在这一瞬间之前一直都有请求过来,在这瞬间之后也仍有请求继续。那么这时候结束该步骤是不妥的,因此可以维护一个滑动窗口,假设窗口期为x ms,在x ms之内都没有新的请求到来,那么这时候就可以认为该步骤可以结束了。
算法思路就是,在counter计数的基础上,维护一个最近一个请求的时间戳。
该改动在当前版本不会体现出作用,因为目前的优雅下线在该步骤之前已经拒绝了请求,因此滑动窗口现在还不会起作用,后续开发的下线逻辑在该处就不会直接拒绝这些请求,而是先放进来,然后使用到该处的滑动窗口逻辑来继续接收请求并正确响应,并且在响应中携带标识使客户端感知到服务端处于下线状态,以此做出响应的逻辑处理。
目前仍使用基于注册中心的下线逻辑,因此这一块更改的作用不会立马体现在当前版本中,同样也不会影响到当前的下线功能,属于是平滑升级。
Which issue(s) this PR fixes:
Fixes #
You should pay attention to items below to ensure your pr passes our ci test
We do not merge pr with ci tests failed