当前位置:网站首页>分布式websocket搭建方案
分布式websocket搭建方案
2022-06-25 04:01:00 【于万丈深渊】
一、背景
- 公司目前websocket架构为单体应用,需要更改为集群。
二、改造方案
2.1方案一:
利用mq发布订阅特性实现:
优点:实现简单
缺点:需要mq支持广播模式,消息要在接收方做去重,每台机器都会接收到消息。
暂时无法在文档外展示此内容
2.2方案二:
1.利用redis存储用户和机器之间的关系(userid,topic标识)
2.mq用来做服务之间消息通信,每个服务制定自己专属队列
优点:不需要mq广播模式,减少消息重复发送
缺点:
1.每台机器需要一个topic,扩容需要提前申请topic或者也可以代码随机创建
2.一个topic对应一个sender,需要在旧机器上动态创建新机器上对应topic的sender
3.k8s启动需要为每个服务单独配置环境变量决定每台机器对应的topic
4.机器hostname需要固定,用来对应和topic之间的关系
暂时无法在文档外展示此内容
2.3方案三:
一致性哈希环
优点:解耦,扩容方便,动态缩容扩容只影响部分用户,减少组件依赖
缺点:实现复杂,耗时较长,改动较大
暂时无法在文档外展示此内容
2.3.1 方案三落地步骤:
步骤:
- 搭建网关模块项目工程 :
1.1 集成zk/nacos,监听机器节点变化信息
1.2 集成mq,接收业务系统请求
1.3 集成一致性hash算法,真实虚拟节点规划,动态路由,动态更新ha
边栏推荐
- Comparison of towe/ JIRA / tapd / Zen collaboration platforms
- 微信小程序父子组件之间传值
- php开发支付宝支付功能之扫码支付流程图
- EasyRecovery15非常好用的电脑数据恢复软件
- What is the storage engine and the three common database storage engines for MySQL
- GBASE 8s存储过程执行和删除
- Laravel document sorting 7. View
- 【esp32学习之路6——flash加密】
- UCLA | 用于黑盒优化的生成式预训练
- CTF_ Web: Advanced questions of attack and defense world expert zone WP (1-4)
猜你喜欢

Easyrecovery15 very easy to use computer data recovery software

Record small knowledge points

NFT insider 63: the sandbox reached a cooperation with Time magazine, and YGG established Spain's subdao

js中的concat()

English Grammar - pronunciation rules

CTF_ Web: Advanced questions of attack and defense world expert zone WP (1-4)

js的arguments

【esp32学习之路6——flash加密】

CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone

GBASE 8s 总体架构
随机推荐
ThinkPHP is integrated with esaywechat. What's wrong with wechat payment callback without callback?
Immutable学习之路----告别传统拷贝
GBASE 8s的数据导入和导出
Gbase 8s index R tree
kenlm
Comparison of towe/ JIRA / tapd / Zen collaboration platforms
PHP encapsulates curl to send get and post request methods, and uses
Nodejs connects to MySQL through heidisql, and ER appears_ BAD_ DB_ ERROR: Unknown database 'my_ db_ books'
GBASE 8s的级联删除功能
Laravel document sorting 1. Installation and Preliminary Configuration
Intel 13th generation core showed its true colors for the first time: 68mb cache improved significantly
我的IC之旅——资深芯片设计验证工程师成长——“胡”说IC工程师完美进阶
Leetcode points to the leetcode road of offering II 091 house painting [dynamic planning] heroding
GBASE 8s存储过程语法结构
A detailed summary of four handshakes (or four waves) over TCP connections
JS arrow function
Finereport (sail soft) handling the problem that the histogram data label is blocked
三角形类(构造与析构)
515. 在每个树行中找最大值 / 剑指 Offer II 095. 最长公共子序列
CTF_ Web: file contains pseudo protocol with PHP