当前位置:网站首页>Integrated architecture of performance and cost: modular architecture
Integrated architecture of performance and cost: modular architecture
2022-07-26 04:22:00 【Pineapple - Qiqi】

The little friend who heard about the modular architecture for the first time may be a little confused for a moment , I've heard of micro service architecture 、 Grid architecture and so on, but what the hell is the cellular architecture ?
In fact, many are commonly used in our mobile phones APP They are all modular architectures , Similar to Gaode navigation 、 Financial banking APP It has been a modular architecture for many years , We all know navigation APP For the request RT And request stability are very strict , If RT The delay is high , When you have passed a certain intersection , The navigation suddenly tells you that you need to turn .... At this time, are 10000 grass mud horses pouring out of your heart , So this navigation APP You must unload it immediately when you get home
What is a modular architecture ?
So called unit , It refers to a self-contained set that can complete all business operations , This collection contains all the services required by all businesses , And the data assigned to this unit .
If a business has 30 100 million data , If you deploy with a modular architecture , We can disassemble the data into 3 Share , each 10 100 million data , establish 3 A unit , These three units , Business services are exactly the same , But the data stored in the database is different , Namely 10 100 million data .
Here, the unit is split according to the data , Data needs to have separable properties , Such as user ID And other globally unique identification information , Otherwise, the unit cannot be split .
The traditional layered architecture is shown in the figure below :
- Each layer of service has multiple nodes , The upper layer calls the lower layer with uniform traffic
- Each layer of services can be expanded or reduced separately

The modular architecture is shown in the figure below :
- It is also divided into multi-layer structure , But the number of different service nodes in each layer is fixed , The call chain is also fixed
- A closed loop is formed inside a unit
Advantages of modular architecture :
No matter the traditional distributed architecture or the unitary architecture, there is no perfect design , Any architecture design needs to make corresponding choices according to the changes of use scenarios
Traditional distributed architecture (SOA As a service ) The advantages are obvious , Different layered services can be deployed independently , However, the problem with this architecture is that the service level is split , The database must be divided into databases and tables , Otherwise, the increasing traffic will cause problems in the database , But the problem of the number of connections brought by the service cannot be solved by dividing the database into databases and tables , Eventually, the database connection will explode , If the database is split horizontally, the transformation and intrusion of code will also be huge
As computer hardware is getting better , The era of lower and lower costs , In fact, vertical expansion is also a new idea , Cellular architecture is a kind of vertical extension , However, this vertical expansion is different from the traditional vertical expansion , It belongs to complete logic + Data slicing

Just like cards , If a machine room is under great pressure and cannot be expanded , Then put one card in another computer room for deployment , And if some unitization occurs DOWN On the plane , The impact is also small , This method is very flexible. Whether it is horizontal expansion or multi live deployment in different places, it can be completed immediately
Process comparison :
In a conventional distributed architecture , When there is a strong demand for bank deposits and withdrawals , Usually, the request will be completed to the database master in a service that specially operates the user account DB The operation of , Then master DB In the synchronization to replica node , Because this scenario requires high data consistency , Therefore, subsequent withdrawals will also be operated to the main DB Not to the replica DB, Although the data security guarantee conforms to , But the performance is too low , Because it is a strong operation on a piece of data in the database , It is bound to be blocked and the experience will be reduced
If it is a modular architecture , It will become the following process
- This is the simplest unit interaction structure , The data of each unit passes MQ Sync , But this is not the only way to use it in real scenes , Usually, we will use a faster method of small batch data synchronization, that is, the synchronization of memory middleware , However, although this method is fast, it is not suitable for scenarios with a large amount of synchronized data

request Make sure users ID The corresponding routing unit remains unchanged for a period of time , Even if the attribute of the user's relevant latitude changes, the routing unit can remain unchanged for a period of time ( Navigation type APP Unitization will have more detailed logic ), Then there is an essential difference between this process and the above process ,A Users don't care B Whether the user's account is operated successfully , as long as A If the account operation is successful, then A The account is deducted immediately , This unit uses the synchronization mechanism to tell other units , At this point if B To withdraw money ,B If the unit is not synchronized to the latest data B Can't see new money , This is why there is a waiting time for bank transfers
Core elements :
- Route nearby
- Incremental synchronization of data copies
this 2 If the core elements are completed, then the cellular architecture with many activities in different places can basically run , Closed loop inside the unit + The request route is allocated nearby , this 2 This mechanism ensures that the performance is higher than that of the traditional distributed deployment , But the problems are complexity and original architecture ( Code ) The rectification cost is relatively high
Nearest route scheme :
To meet the RT requirement , Then the services in the unit should complete the closed loop as much as possible to reduce the interaction with other units , Therefore, the routing strategy must consider this
- User mode routing
- User's common location routing
- Device routing

The usual entry packet routing strategy is still adopted , The mapping relationship of the routing table is user -- Group relationship , Group -- Unit relationship
After the storage structure is determined , We also need to determine the storage scheme , Because the whole user - Group analysis depends on a large number of call log analysis , When the number of users is also very objective, we have to consider the storage cost , We may immediately think of :bitmap、db、 The bloon filter
In the routing scenario, cross cell routing is considered , The impact on the user's request is only RT elevated , So as long as the probability is very small, the business is basically acceptable , Therefore, it is more appropriate to choose a Bronte filter , It can support users ID、 equipment ID And other ways of routing , The storage cost and computing performance are good , The probability of routing errors is also acceptable
There is, of course, another situation , After user grouping calculation , No group was found where the user should be , At this time, we need a thorough routing strategy , That's the mold strategy

边栏推荐
- dijikstra(先预处理)+dfs,relocation truncated to fit
- Recommendation Book Educational Psychology: a book for tomorrow's teachers~
- LeetCode:1184. 公交站间的距离————简单
- Linear basis property function code to achieve 3000 words detailed explanation, with examples
- Dijikstra (preprocessing first) +dfs, relocation truncated to fit
- How mantium uses deepspeed to implement low latency gpt-j reasoning on Amazon sagemaker
- 机器学习之信用卡欺诈检测
- Matrix and Gauss elimination [matrix multiplication, Gauss elimination, solving linear equations, solving determinants] the most detailed in the whole network, with examples and sister chapters of 130
- Credit card fraud detection based on machine learning
- 智装时代已来,智哪儿邀您一同羊城论剑,8月4日,光亚展恭候
猜你喜欢

How does win11 change the power mode? Win11 method of changing power mode

理性认知教育机器人寓教于乐的辅助作用

Share | 2022 big data white paper of digital security industry (PDF attached)

吴恩达机器学习课后习题——逻辑回归

Constructing verb sources for relation extraction

How does win11 22h2 skip networking and Microsoft account login?

文献|关系研究能得出因果性结论吗

Soft simulation rasterization renderer

LeetCode:1184. 公交站间的距离————简单
![[SVN] please execute the 'cleanup' command appears all the time. The solution is that there is no response after cleanup](/img/44/69c434fc9564078e11735881d9bf34.png)
[SVN] please execute the 'cleanup' command appears all the time. The solution is that there is no response after cleanup
随机推荐
How engineers treat open source -- the heartfelt words of an old engineer
Pathmatchingresourcepatternresolver parsing configuration file resource file
生活相关——一个华科研究生导师的肺腑之言(主要适用于理工科)
软模拟光栅化渲染器
Helloworld案例分析
匿名函数的作用
[SVN] please execute the 'cleanup' command appears all the time. The solution is that there is no response after cleanup
How to write the abbreviation of the thesis?
Comprehensive evaluation and decision-making method
建设面向青少年的创客教育实验室
Postman 导入curl 、导出成curl、导出成对应语言代码
I.MX6U-ALPHA开发板(主频和时钟配置实验)
Sweet butter
动态规划 爬楼梯
测试用例设计方法之——招式组合,因果判定
再获认可 | 赛宁网安连续上榜《CCSIP 2022中国网络安全产业全景图》
MySQL日志分类:错误日志、二进制日志、查询日志、慢查询日志
How is the launch of ros2 different?
Scroll view pull-down refresh and pull-up load (bottom)
规则引擎Drools的使用