当前位置:网站首页>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

边栏推荐
- Wu Enda's machine learning after class exercises - linear regression
- How is the launch of ros2 different?
- Credit card fraud detection based on machine learning
- [SVN] please execute the 'cleanup' command appears all the time. The solution is that there is no response after cleanup
- SwiftUI一日速成
- Soft simulation rasterization renderer
- Huawei issued another global convening order of "genius youth", and some people once gave up their annual salary of 3.6 million to join
- [project chapter - how to write and map the business model? (3000 word graphic summary suggestions)] project plan of innovation and entrepreneurship competition and application form of national Entrep
- VM virtual machine has no un bridged host network adapter, unable to restore the default configuration
- 2.9.4 Boolean object type processing and convenient methods of ext JS
猜你喜欢

Pat class a 1039 course list for student

HelloWorld case analysis

荐书丨《教育心理学》:送给明日教师的一本书~

firewall 命令简单操作

力扣每日一题-第42天-661. 图片平滑器

华为再发“天才少年”全球召集令,有人曾放弃360万年薪加入

1. Excel的IF函数

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

Huawei issued another global convening order of "genius youth", and some people once gave up their annual salary of 3.6 million to join

生活相关——十年的职业历程(转)
随机推荐
青少年创客教育的创意设计原理
RTSP/Onvif协议视频平台EasyNVR服务一键升级功能的使用教程
Function knowledge points
Li Kou daily question - day 42 -661. Picture smoother
Support proxy direct connection to Oracle database, jumpserver fortress v2.24.0 release
生活相关——十年的职业历程(转)
Under the high debt of Red Star Macalline, is it eyeing new energy?
Use of anonymous functions
荐书 |《学者的术与道》:写论文是门手艺
How to write abstract in English thesis?
HelloWorld case analysis
智装时代已来,智哪儿邀您一同羊城论剑,8月4日,光亚展恭候
How to write the summary? (including 7 easily ignored precautions and a summary of common sentence patterns in 80% of review articles)
[binary tree] the longest interleaved path in a binary tree
Linear basis property function code to achieve 3000 words detailed explanation, with examples
Several methods of realizing high-low byte or high-low word exchange in TIA botu s7-1200
VM virtual machine has no un bridged host network adapter, unable to restore the default configuration
MySQL - multi table query - Cartesian product sum, correct multi table query, equivalent connection and unequal connection, inner connection and outer connection
软模拟光栅化渲染器
Huawei executives talk about the 35 year old crisis. How can programmers overcome the worry of age?