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

nacos作为发现注册中心时websocket集群问题 #2114

Closed
binaryjerry opened this issue Nov 27, 2019 · 7 comments
Closed

nacos作为发现注册中心时websocket集群问题 #2114

binaryjerry opened this issue Nov 27, 2019 · 7 comments
Labels
expired No active for a long time

Comments

@binaryjerry
Copy link

如果nacos能做到在redis中能维护一个集群hash环,环上有不同的客户端连接服务端集群的id的hash,
nacos监听到集群服务的上下线可以动态的调整环的大小,hash改变后,断掉的部分连接重新连接一次即可。提出个思路。

@nkorange
Copy link
Collaborator

nkorange commented Dec 4, 2019

这个主要是为了解决什么问题?

@binaryjerry
Copy link
Author

这个主要是为了解决什么问题?

集群情况下,支持ws协议长连接。

@nkorange
Copy link
Collaborator

nkorange commented Dec 6, 2019

你意思是Nacos集群支持长连接吗?

@binaryjerry
Copy link
Author

你意思是Nacos集群支持长连接吗?

我不是指的nacos本身的长连接,指的通过这个调整,更好的支持业务服务集群的长连接

@stale
Copy link

stale bot commented Jun 13, 2020

Thanks for your feedback and contribution. But the issue/pull request has not had recent activity more than 180 days. This issue/pull request will be closed if no further activity occurs 7 days later.
We may solve this issue in new version. So can you upgrade to newest version and retry?
If there are still issues or want to contribute again. Please create new issue or pull request again.

@stale stale bot added the expired No active for a long time label Jun 13, 2020
@stale stale bot closed this as completed Jun 20, 2020
@la3rence
Copy link

la3rence commented Dec 29, 2020

WebSocket 服务端的微服务应用是有状态的。服务端的内存中一般存在维持连接的 WebSocket Session,且此 Session 无法被序列化(WebSocket 协议本身不同于 HTTP 协议)。

具体诉求是这样的:
希望 Nacos 能够向有状态的微服务(作为 Nacos 客户端)维护一个哈希环来实现一致性哈希,能将 WebSocket 这类服务的每次来自特定客户端请求的连接被映射到 Nacos 的客户端(作为 WebSocket 后端)的同一个实例。并在同类服务实例上线或下线时更新此哈希环,或许其实只需要开放一个来自 Nacos 的 Hook 就行。

另外一个问题,是在别人使用 Nacos 来做 WebSocket 集群时发现的:

利用 nacos 的上下线功能实现模拟宕机,但是 nacos 的下线功能,仅仅是把当前服务从 websocket 微服务 list 中 remove 掉了, nacos 的健康机制显示它还是健康,如果下线的服务中 sessionPool 不为空存在长链接,并不会断掉,服务的下线只会影响以后链接的路由动向。

https://lawrenceli.me/blog/websocket-cluster

@fzdwx
Copy link

fzdwx commented Jan 12, 2022

有意向实现吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
expired No active for a long time
Projects
None yet
Development

No branches or pull requests

4 participants