当前位置:网站首页>Thinking on multi system architecture design
Thinking on multi system architecture design
2022-07-28 05:24:00 【Little madman green】
The first consideration is that there are many downstream application systems .
This method assumes that users have a unique id, Its access rights in each system need to be configured , When are permissions assigned ?
The first time a user registers with the platform , Need to produce its default permissions ( Platform wide default permissions ), When its registration is completed, it logs in to a platform for the first time A You may need to get some personal information , At this time, the platform A How to obtain these necessary personal information ? When some information is updated , platform A You may also need to get updated information , How should he get this information at this time ? Therefore, only user login and update information may cause concurrency problems . So we should take the initiative to inform , When a user registers / When the central system updates personal information, it will push the user's information to other systems for update , When all systems need to update the user's master information, they call a central information update interface .
It can be used rabitMq To narrate these thoughts :

To avoid the pressure of modifying the server , You can consider setting the modification time limit or frequency limit for the modification of the center information , At present, wechat 、 douban 、csdn They have time limit or frequency limit for modifying important information like , I don't know what they are thinking .
When the user logs in , It's not just about login password verification , At the same time, it also involves the return of login permission , So that the front end can display the interface module according to different permissions .
Suppose a user tries to access the platform A, But the user is on the platform A I haven't logged in , Will jump to the login page , When jumping, we can set a hidden parameter param1 Take it to the login page , When the user logs in, the authority is queried according to param1 To return users to the platform A Permission list on , Then navigate to the corresponding page through redirection , Such a platform A The login function of is completed .
Because the authority center of the system is a center , So we can achieve something similar to sso Single sign on function .
From this design framework , When evolving from a single system to a multi system, it is necessary to separate the user authority database from the business database at the early stage of design , At present, the system has not introduced the function of logging , Consider the following ways to introduce .
You can set all log data tables as one type of data table , This method can realize code reuse by introducing the log module , At the same time, the query system can also use code reuse to view the operation log . Maybe you can also generate and process logs in another way .
All system log operations are sent to a queue in a certain format , Then the log processing system records the log information into a certain kind of database , The log processing system can distinguish query logs according to different systems .
I think that when designing database logs in the early single architecture, we can refer to some necessary fields of the log platform to collect logs , This provides convenience for future conversion to the logging platform .
The above is the thinking of low concurrency multi system architecture , Next, consider the multi concurrent multi system architecture .
As the name suggests , The application itself also needs to be split , Authentication forward can also be regarded as application splitting .
From the perspective of architecture , The authentication center will also become a system bottleneck , At this time, we can start from the perspective of accessing different systems , Different systems have a corresponding authentication center , The architecture diagram can evolve as follows .
If there are still bottlenecks , You can consider according to different users id Map to different data tables , That is to split the table horizontally .
Through the above, I have such an idea , The user information table 、 Permission related tables 、 Business related table 、 Split the log related table , In this way, the code of the complete permission module can be completely reused in all future projects ( Because the user permission can only pass through the user id Locate with other associated tables ), If you can abstract enough , User information table can also be completely abstract , For example, only store users id、 User name 、 User ID number 、 You phone 、 Information such as user email .
In this way, the authentication pressure can be relieved , The next step is how to deal with downstream systems with high concurrency ?
If the traffic is low , We can solve the problem of data consistency by adding optimistic lock to the data table , But in the case of concurrency ,mysql Because of transactions, it will become a system bottleneck , What should be done at this time ?
1) Use redis Locking mechanism , The specific process is as follows 
My idea is to have two fields , A quantity variable used to store in sales A, The other is used to store the actual quantity B. The two fields are locked respectively , When the user places an order , Only observe variables A, Ensure variables A The atomicity of , When cutting data , You need to modify the data B And subtraction data A.
1)a The business calls b Business , But he doesn't care b What has the business done , For example, the logging system , It belongs to this way , You can split the log system ;
2)a The business calls b Business , Users care about the end result , however a and b Data consistency will not be involved , At this time, the message queue can also be used ;
The architecture diagram and some summaries will be added tomorrow , It's too late today .
边栏推荐
- POJ 3728 the merchant (online query + double LCA)
- Implementation of simple upload function in PHP development
- 2022 summer practice (first week)
- MySQL(5)
- How to send and receive reports through outlook in FastReport VCL?
- Dcgan:deep volume general adaptive networks -- paper analysis
- Transformer -- Analysis and application of attention model
- 【CVPR2022】Multi-Scale High-Resolution Vision Transformer for Semantic Segmentation
- Autoreleasepool problem summary
- Visual studio 2019 new OpenGL project does not need to reconfigure the environment
猜你喜欢

The research group passed the thesis defense successfully

MySQL(5)

数据库日期类型全部为0

Scanf function of input and output function in C language

The most detailed installation of windows10 virtual machine, install virtual machine by hand, and solve the problem that the Hyper-V option cannot be found in the home version window

Eccv2022 | 29 papers of Tencent Youtu were selected, including face security, image segmentation, target detection and other research directions

FreeRTOS personal notes - task notification

The solution after the samesite by default cookies of Chrome browser 91 version are removed, and the solution that cross domain post requests in chrome cannot carry cookies

Simulink automatically generates STM32 code details

PC端-bug记录
随机推荐
I interviewed a 38 year old programmer and refused to work overtime
Data imbalance: comprehensive sampling of anti fraud model (data imbalance)
21 day SQL punch in summary
Printf function of input and output function in C language
yandex robots txt
C language: addition and deletion of linked list in structure
【ARXIV2203】SepViT: Separable Vision Transformer
Classes and objects [medium]
多御安全浏览器将改进安全模式,让用户浏览更安全
11.< tag-动态规划和子序列, 子数组>lt.115. 不同的子序列 + lt. 583. 两个字符串的删除操作 dbc
Non functional test
PC side bug record
jsonp 单点登录 权限检验
block yandex bot
Google browser cannot open localhost:3000. If you open localhost, you will jump to the test address
基于MPLS构建虚拟专网的配置实验
[computer level 3 information security] overview of information security assurance
Advanced assignment method of ES6 -- Deconstruction assignment
阿里怎么用DDD来拆分微服务?
Autoreleasepool problem summary