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

[Bug] 在这个方法中 ClusterSupport.doRefreshReferersByUrls #1053

Open
LaoZhang-best opened this issue Nov 29, 2023 · 1 comment
Open

Comments

@LaoZhang-best
Copy link

我使用consul暴露的是kubernetes的service别名,如果我启动了两个pod,那在referers中会存在两个一模一样的对象,加上netty的长连接,导致请求只会路由到固定的Pod上面。在getExistinReferer方法中,是否可以加入consul node的区分

@rayzhang0603
Copy link
Collaborator

Motan是长链接服务,不适合使用service别名进行负载均衡,建议使用ip进行服务发现。

getExistingReferer方法是为了复用已存在的referer,在小规模节点变化时不用重新建连所有server节点,这个方法是对比的server节点的url对象,server节点url中任何参数有变动都不再复用referer。

如果你们的场景必须使用service别名,可以参考ConsulRegistry自己实现一个定制的consul注册中心,在每次服务变更,生成URL时在URL参数中加入例如时间戳这种动态变化的参数,就会触发每次重新构建referer了。

实现SPI扩展可以参考编写一个motan扩展

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

No branches or pull requests

2 participants