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

提交之前请查看是否有相关 issue,谢谢。 #82

Open
TangYuFan opened this issue Mar 18, 2020 · 2 comments
Open

提交之前请查看是否有相关 issue,谢谢。 #82

TangYuFan opened this issue Mar 18, 2020 · 2 comments
Labels
question Further information is requested

Comments

@TangYuFan
Copy link

TangYuFan commented Mar 18, 2020

Bug 描述

  1. 用测试工具发起了几百个连接然后断开,发现map的size会大于实际的有效channel个数.
@crossoverJie
Copy link
Owner

  1. 按照map缓存channel的思路,我用测试工具发起了几百个连接然后断开,发现map的size会大于实际的有效channel个数,这个问题如何解决。

这个数量理论上是一致的,但出现网络抖动导致 channelInactive 函数无法触发就可能会导致大于实际数量。

但其实服务端也有心跳检测机制,超过一段时间没有上报心跳的客户端会被踢初,所以这个数据是最终一致的。

  1. 2.请问源码里面有消息限流功能吗,针对全局消息速率限流,针对单个channel消息速率限流。想尽量以服务端稳定为主。感谢

暂不支持,后续会考虑加入。

@crossoverJie crossoverJie added the question Further information is requested label Mar 31, 2020
@crossoverJie
Copy link
Owner

  1. 使用的是 ConcurrentHashMap 存放的 Channel,不会出现并发问题。
  2. 是否踢出新接入的客户端不应该由 Server 来做,直接放到路由层就可以,比如可以利用 Redis 记录各个节点的在线数,route 在分配 Server 的时候优先将较少的连接的服务端分配出去,已经达到上限的就直接剔除,这也是权重分配的模式。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants