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

Feat/direct notify #995

Closed
wants to merge 13 commits into from

Conversation

LaurenceLiZhixin
Copy link
Contributor

What this PR does:
This pr does: when provider is close, it notify consumer through getty-session, not only notified by registry.
This is quicker for consumer to delete target invoker in directory.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
I add a common sync.Map in common/dubbo_dir_refresh.go, which links dubbo-getty and registryDirectory.
when session is on close or on errror, it call dir.Notify(deleteEvent) to refresh quickly.

Does this PR introduce a user-facing change?:

NONE


@codecov-io
Copy link

codecov-io commented Jan 14, 2021

Codecov Report

Merging #995 (dad63a5) into develop (0cb6edb) will increase coverage by 0.02%.
The diff coverage is 59.09%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #995      +/-   ##
===========================================
+ Coverage    59.66%   59.68%   +0.02%     
===========================================
  Files          261      261              
  Lines        12919    12928       +9     
===========================================
+ Hits          7708     7716       +8     
- Misses        4240     4241       +1     
  Partials       971      971              
Impacted Files Coverage Δ
cluster/router/chain/chain.go 67.96% <0.00%> (ø)
cluster/router/healthcheck/health_check_route.go 73.07% <ø> (+2.70%) ⬆️
cluster/router/tag/tag_router.go 73.84% <ø> (+1.25%) ⬆️
registry/directory/directory.go 77.27% <28.57%> (-1.70%) ⬇️
remoting/getty/pool.go 63.51% <75.00%> (+0.16%) ⬆️
remoting/getty/listener.go 42.48% <77.77%> (+1.40%) ⬆️
remoting/getty/getty_client.go 44.30% <100.00%> (ø)
...tocol/rest/server/server_impl/go_restful_server.go 48.78% <0.00%> (+4.87%) ⬆️

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 9a666eb...11b1a19. Read the comment docs.

@AlexStocks AlexStocks force-pushed the develop branch 3 times, most recently from 25c3b98 to 9a666eb Compare January 23, 2021 11:12
@AlexStocks AlexStocks added this to the v1.5.6 milestone Jan 23, 2021
// look up at:
// remoting/getty/listener.go
// registry/directory/directory.go
var DirMap sync.Map
Copy link
Member

Choose a reason for hiding this comment

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

Why use public variable in this module? Although you have comment in this variable,but It can be used in all modules in dubbo-go.Even the module out of dubbo-go.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's the best way to achieve the direct notify from remoting.session to directory

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't find another way to link this two pkg. As there may be unexpected loop refer.

Copy link
Member

Choose a reason for hiding this comment

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

请允许我使用中文,关于这个问题,我先说一下我的看法。
先看一下现在的结构,我没理解错应该是:
invoker-》client-》getty pool-》session(connection)
现在是直接加在 session 的 close/error 上。

针对这个 PR,我有以下几个疑问:

  • 这个功能是否应该加在 invoker / client ?为什么我这么说?请看第二个问题。
  • 因为有可能有 10 个 connection,其中 n ( n < 10 )个因为网络抖动连不上,然后就去删除 DIr 中的 cache?这也可能和第三个问题有关联。
  • 我只看到在 session(connection)上删除,但是我没看到如何加回去?
  • 如果按照现在的套路,如果 n ( n > 1) 个 registry 要加回去,是不是会造成:频繁增加。

我的建议是:
调整到 invoekr 或者 client,通过判断窗口期中多少个请求失败,再触发删除 cache,最后记得加上恢复 registry 的代码。
但是如果按照我的建议做的话,是否能基于:ActiveFilter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我仔细想了想,这里的确有问题。
我写这个pr的是以:“这个session一旦被关闭,证明server端就一定关闭了”为前提的。一旦session因为网络抖动出现了err,会直接删除掉dir的cache,这样设计不太合理。
我先表述一下这个pr的初衷:是为了提高客户端对于server端下线的感知速度:不只通过regisgtry感知,而是通过session感知。如果判断窗口期请求,我觉得是不太现实,因为这个时间可能registry都通知过来了。
感觉这个需求可能有点问题。
另一方面,我的另一个pr:#976
有提供invoke前的健康检查机制,感觉这两个pr在功能上是有重复的,我和展图讨论下。

@cityiron cityiron changed the base branch from develop to 1.5 January 26, 2021 13:49
@cityiron cityiron removed this from the v1.5.6 milestone Feb 2, 2021
@AlexStocks AlexStocks closed this Feb 25, 2021
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.

5 participants