当前位置:网站首页>Construction scheme of distributed websocket
Construction scheme of distributed websocket
2022-06-25 04:42:00 【Over the abyss】
One 、 background
- The company is websocket The architecture is a single application , It needs to be changed to cluster .
Two 、 Retrofit scheme
2.1 Scheme 1 :
utilize mq The publish subscribe feature implements :
advantage : Implement a simple
shortcoming : need mq Support broadcast mode , The message should be de duplicated at the receiver , Every machine receives messages .
This content cannot be displayed outside the document for the time being
2.2 Option two :
1. utilize redis Store the relationship between the user and the machine (userid,topic identification )
2.mq Used for message communication between services , Each service has its own queue
advantage : Unwanted mq Broadcast mode , Reduce repeated message sending
shortcoming :
1. One for each machine topic, Expansion needs to be applied in advance topic Or it can be created randomly by code
2. One topic Corresponding to one sender, You need to dynamically create a new machine on the old machine topic Of sender
3.k8s To start, you need to configure environment variables separately for each service to determine the corresponding environment variables for each machine topic
4. machine hostname It needs to be fixed , Used to correspond to and topic The relationship between
This content cannot be displayed outside the document for the time being
2.3 Option three :
Consistent hash ring
advantage : decoupling , The expansion is convenient , Dynamic capacity reduction and expansion only affect some users , Reduce component dependencies
shortcoming : The implementation is complex , Longer time consuming , Big changes
This content cannot be displayed outside the document for the time being
2.3.1 Implementation steps of scheme III :
step :
- Build the gateway module project :
1.1 Integrate zk/nacos, Listen for machine node change information
1.2 Integrate mq, Receive business system requests
1.3 Integration consistency hash Algorithm , Real virtual node planning , Dynamic routing , Dynamic update ha
边栏推荐
- GBASE 8s的触发器
- Anaconda installation +tensorflow installation +keras installation +numpy installation (including image and version information compatibility issues)
- GBASE 8s的多线程结构
- GBASE 8s 索引R树
- CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
- Code scanning payment flow chart of Alipay payment function developed by PHP
- Sleep more, you can lose weight. According to the latest research from the University of Chicago, sleeping more than 1 hour a day is equivalent to eating less than one fried chicken leg
- Blob page in gbase 8s
- Xiaobai learns MySQL - Statistical 'opportunism'
- php开发支付宝支付功能之扫码支付流程图
猜你喜欢

Record small knowledge points

Bingbing's learning notes: implementation of circular queue

Part I Verilog quick start

leetcode1221. 分割平衡字符串

ROS2/DDS/QoS/主题的记录

JS arguments

第九章 APP项目测试(2) 测试工具

Machine learning deep learning -- Vectorization

【FLink】access closed classloader classloader.check-leaked-classloader
![[untitled]](/img/68/5e711f7c473dcea54a56f7b7e48604.png)
[untitled]
随机推荐
cnpm : 无法加载文件 C:\Users\Administrator\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
第二十五周记录
Gbase 8s parallel operation problem scenario description
Successfully solved: selenium common. exceptions. TimeoutException: Message: timeout: Timed out receiving message from
Multithreading structure of gbase 8s
Code scanning payment flow chart of Alipay payment function developed by PHP
Concat() in JS
高效的NoSQL数据库服务Amozon DynamoDB体验分享
【Flink】RocksDB增量模式checkpoint大小持续增长的问题及解决
写shell脚本报错总结
Record the problem of C # print size once
mongodb集群
[untitled]
After the newly assigned variable of the applet is modified, the original variable will also be modified
Excel exports data to SQL and pictures to folder through macro | VBA
Machine learning deep learning -- Vectorization
OpenSea PHP开发包
Office macro virus bounce shell experiment
GBASE 8s存儲過程語法結構
计算学生成绩等级(虚函数和多态)