当前位置:网站首页>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 index R tree
- 为什么TCP握手刚刚好是3次呢?
- 机器学习深度学习——向量化
- Paper notes: multi label learning ESMC (I don't understand it, but I haven't written it yet, so I'll put it here for a place temporarily)
- Multithreading structure of gbase 8s
- 第九章 APP项目测试(2) 测试工具
- 【Flink】RocksDB增量模式checkpoint大小持续增长的问题及解决
- i. Max development board learning record
- Immutable学习之路----告别传统拷贝
- 冰冰学习笔记:循环队列的实现
猜你喜欢

Cnpm: unable to load file c:\users\administrator\appdata\roaming\npm\cnpm PS1 because running scripts is prohibited on this system.

Join() in JSZ

2.0SpingMVC使用RESTful

A detailed summary of TCP connection triple handshake

Successfully solved: selenium common. exceptions. TimeoutException: Message: timeout: Timed out receiving message from

Anaconda installation +tensorflow installation +keras installation +numpy installation (including image and version information compatibility issues)

Gbase 8s index R tree

Simple text analysis of malicious samples - Introduction

CTF_ Web:8-bit controllable character getshell

jsz中的join()
随机推荐
Anaconda installation +tensorflow installation +keras installation +numpy installation (including image and version information compatibility issues)
GBASE 8s存储过程执行和删除
GBASE 8s存储过程流程控制
i. Max development board learning record
机器学习深度学习——向量化
「 每日一练,快乐水题 」1108. IP 地址无效化
Kotlin Compose 监听软键盘 点击enter提交事件
Mongodb cluster
GBASE 8s存储过程语法结构
Data import and export for gbase 8s
Immutable learning road -- farewell to traditional copy
GBASE 8s的并行操作问题场景描述
PostgreSQL数据库WAL——RM_HEAP_ID日志记录动作
高效的NoSQL数据库服务Amozon DynamoDB体验分享
为什么SQL语句命中索引比不命中索引要快?
ROS2/DDS/QoS/主题的记录
[Flink] problems and solutions of the continuous growth of checkpoint size in rocksdb incremental mode
【无标题】
CTF_ Web: Advanced questions of attack and defense world expert zone WP (1-4)
Cannot import name 'escape' from 'jinja2' [solved successfully]