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

session序列化 #149

Open
lxl233 opened this issue Oct 23, 2020 · 15 comments
Open

session序列化 #149

lxl233 opened this issue Oct 23, 2020 · 15 comments

Comments

@lxl233
Copy link

lxl233 commented Oct 23, 2020

你好,我想在rabbitmq中使用session参数,rabbitmq序列化session对象失败,请问该怎么解决。谢谢了

@YeautyYE
Copy link
Owner

rabbitmq中使用session参数是什么意思,是将session通过rabbitmq发出去吗?

@lxl233
Copy link
Author

lxl233 commented Oct 24, 2020

我是打算把用户的session传递到消费者中。消费者使用session发送消息 ,请问可以吗?

@lxl233
Copy link
Author

lxl233 commented Oct 24, 2020

这个框架如何实现向某个用户组发送消息,不用遍历session转发

@YeautyYE
Copy link
Owner

我是打算把用户的session传递到消费者中。消费者使用session发送消息 ,请问可以吗?

websocket的session是对应一条真实的连接,有状态的,和http的session的原理不一样。
可以参考#116

@YeautyYE
Copy link
Owner

这个框架如何实现向某个用户组发送消息,不用遍历session转发

向用户组发送消息,本质上也是遍历,因为cpu执行指令本质上是串行的

@lxl233
Copy link
Author

lxl233 commented Oct 24, 2020

那这个向用户组广播只能把session存在map里头,需要的时候遍历一次吗?

@YeautyYE
Copy link
Owner

那这个向用户组广播只能把session存在map里头,需要的时候遍历一次吗?

是的

@lxl233
Copy link
Author

lxl233 commented Oct 24, 2020

我要是需要向几万个用户转发,怎么解决效率问题哦

@YeautyYE
Copy link
Owner

我要是需要向几万个用户转发,怎么解决效率问题哦

正常用就好了,不会有效率问题
参考#9

@lxl233
Copy link
Author

lxl233 commented Oct 24, 2020

非常感谢

@ufiredong
Copy link

可以考虑hash一致性 实现免遍历,

@lxl233
Copy link
Author

lxl233 commented Dec 21, 2020

可以考虑hash一致性 实现免遍历,

不是太懂,有文章可以参考下吗?

@YeautyYE
Copy link
Owner

YeautyYE commented Dec 22, 2020

可以考虑hash一致性 实现免遍历,

不存在不遍历的,CPU的时钟是有序的,所以执行是一条条的。
而且网络传输时,物理层也是一个一个bit传输(一条网线,通过电信号传输,也就是一瞬间只能存在一个bit),所以也不可能不遍历。
广播的本质也是遍历发送,不像真实世界拿一个喇叭对大家说话,大家同时听到

@la3rence
Copy link

la3rence commented Dec 24, 2020

可以考虑hash一致性 实现免遍历,

不是太懂,有文章可以参考下吗?

https://lawrenceli.me/blog/websocket-cluster
序列化 Session 的场景是集群,这里面提到了一些方案,仅供参考。

还有,你的意思是消费的内容是 Session 本身吗?你不一定要去存放整个 Session 对象,只要维护一个静态 Map,用 SessionId 来作为 Session 的查询 key 就行。

@ufiredong
Copy link

可以考虑hash一致性 实现免遍历,

不是太懂,有文章可以参考下吗?

我最近再想办法实现,好了call你

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

4 participants