Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 multiple shared links #2457
Support multiple shared links #2457
Changes from 4 commits
d7092c8
dc602c8
444d70d
99c6e63
32197c5
5ecdbe7
71c1ac2
1467d21
52a3ac7
1cb48fc
d6ddcd5
f376c1e
06e29bc
63962a1
52d69f3
b3fdee6
e75855c
268f8c4
39a433c
560dfb9
cf47e78
13fbc63
f511240
7b907c9
a9e7d87
768b7b5
593f4a3
c75808c
d739ded
9dc2f65
52efa43
33039fc
4a5943e
5aea875
9c19fd4
4cb08bc
8f4efc0
42fd2c7
de4c9be
209f966
4d00308
30557d3
9dc5c1b
dc2bad3
53aa630
5042de1
6b68053
35b9e31
51ba855
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ghostClientMap
is a mapping between URL and client, butreferenceClientMap
is a mapping between URL and a list of clients.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delayed connections are used to reduce the number of long connections. Create a long connection when a call is initiated. <dubbo:protocol name="dubbo" lazy="true" />Note: This configuration only works for dubbo protocols that use long connections.
Later I read the code about the delayed connection and found that LazyConnectExchangeClient has two purposes:
So, no matter how many ExchangeClients a URL corresponds to, it only needs a ghost connection in the ghostClientMap, which is a LazyConnectExchangeClient.
Also, only the shared ExchangeClient will use the ReferenceCountExchangeClient, so the default client used to share a TCP connection is the ReferenceCountExchangeClient, and the separate TCP connection set by connections does not need or use the ReferenceCountExchangeClient.
延迟连接用于减少长连接数。当有调用发起时,再创建长连接。<dubbo:protocol name="dubbo" lazy="true" />注意:该配置只对使用长连接的 dubbo 协议生效。
后面我有仔细阅读了关于延迟连接的代码,发现LazyConnectExchangeClient有两个用途:
所以,不管一个URL对应多少个ExchangeClient,它在ghostClientMap中最多只需要一个幽灵连接,即一个LazyConnectExchangeClient。
并且,只有共享的ExchangeClient才会用到ReferenceCountExchangeClient,所以默认的共享1条TCP连接所使用的client就是ReferenceCountExchangeClient,而通过connections设置的单独TCP连接不需要也没有使用ReferenceCountExchangeClient。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand the mistake, please correct me, thank you