当前位置:网站首页>Extensible database (I)
Extensible database (I)
2022-06-28 03:34:00 【Ultipa】
The extension of the database layer is the fourth layer of the five layer architecture of a typical cloud application , And the most complicated layer ( Some people think that scalable storage systems are more complex , I think , It depends on the business application mode . For applications with complex transaction processing types , The challenge of its database layer implementation is obviously higher ; For simple massive data and simple event processing applications , The database tier doesn't even need to exist , The implementation of cloud storage layer is more complex ).
There are four types of solutions for database expansion :
·Scale-Up
·Master-Slaves( One master and many servants ) Read agent mode
·Master-Master Pattern
·Sharding Pattern
(1)Scale-Up: Vertical expansion
In addition to upgrading the hardware configuration, the vertical expansion method can improve the throughput of the database system , At the software level, it mainly optimizes the table structure , For example, reasonable use of indexes , Avoid multi table Association queries ( Such as multiple tables join). This kind of method is regarded as typical in the application of the second platform “ Expand ” Pattern . In the cloud application of the third platform , such Scale-up only Obviously, it can not achieve high enough scalability .
(2) Master servant read agent mode
The level of the database layer is scalable (Scale-Out) There are many ways , Among them, the most basic ( concise ) Yes. Master-Slave( Lord - Servant ) Pattern , Pictured 4-3 Shown . It's usually made up of Master The node is responsible for reading and writing , And by one or more Slave The node is responsible for read-only operations . Such a design is equivalent to improving the data reading performance several times ( And write performance because Master The load of nodes decreases relatively and increases correspondingly ). We know that most database systems have far more read operations than write operations ( If changed 、 Delete 、 add to ), Therefore, the acceleration of read operations can effectively solve the performance bottleneck of such systems .
chart : Implementation of database extension Read-Proxy
Lord - A key point of the slave database design is that only a single node performs write operations , This design can avoid data synchronization caused by multi-point data writing 、 The complexity of replication . Of course ,Master The node is still responsible for synchronizing the updated data sets 、 Copy to all read-only nodes . therefore , In the main - High bandwidth is usually required between slave nodes 、 Low latency to avoid data read / write inconsistencies caused by untimely data replication .
Usually , In the main - In the slave database architecture, we need to add load balancing components to ensure that the application server layer can make full use of Slave Nodes improve the efficiency of read operations . It's important to point out that , The load balancing operation at this layer usually works in TCP/UDP layer , And most of them are customized database operation communication protocols , Not on the application layer LB The standard of layers HTTP/S agreement .
(3)Master-Master Pattern
Ahead Master-Slave Pattern solves the problem of system read scalability , So is there a way to solve the scalability of write operations ? The answer is yes , Yes . But the complexity will be much higher . Review what we discussed in the previous chapter CAP theory , A strongly consistent database system (ACID System ) emphasize CAP Data consistency in (Consistency), While multiple nodes support concurrent read and write operations at the same time, it is very easy to cause data inconsistency between nodes . therefore , The biggest challenge of such a system is how to ensure the architecture design adopted by each node to achieve data consistency .
The following is an example ,MySQL The database supports multiple Master Node mode , The data synchronization between them is circular replication (Circular Replication). in other words , In three database server clusters , In the first cluster Master Node to the corresponding node of the second cluster (Slave) Synchronous data , The node of the second cluster is represented by Master The identity of the node to the third cluster Slave Nodes transmit synchronous data , Finally, the node of the third cluster synchronizes data to the same node of the first cluster . The main reason for this design is to avoid time-order conflict( timing violation ), That is, when two or more nodes send an update data set to another node at the same time , When a dataset exists overlapping( intersection ) when , It is very easy to cause inconsistency in the final data .
chart :MySQL Ring data replication among multiple master nodes of database ( Sync )
Avoid in many places Master The solution of data consistency conflict in node database system is nothing more than 4 strip
· Avoid multi node write operations completely ( So it's back Master-Slaves Pattern )
· Strictly distinguish the differences in the application layer logic Master The write area of the node , Make sure there is no intersection between ( for example , Do not change the same row at the same time )
· Guarantee different Master Nodes operate on the same region in non overlapping time periods
· Synchronous replication (Synchronous Replication), Write operations are performed simultaneously on all nodes , And when all nodes are successfully completed , The whole operation will return . This mode obviously requires very high network bandwidth , And in order to meet the data consistency (C), At the expense of usability (Availability)
边栏推荐
- Floating point and complex type of go data type (4)
- 新手开哪家的证券账户是比较好?炒股开户安全吗
- 十年职场软件工程师感悟
- Question bank and answers of special operation certificate for R1 quick opening pressure vessel operation in 2022
- 【PaddleDetection】ModuleNotFoundError: No module named ‘paddle‘
- Go 数据类型篇(四)之浮点型与复数类型
- WebSocket(简单体验版)
- 2022 electrician (elementary) recurrent training question bank and online simulation examination
- Tardigrade: Trino's solution to ETL scenarios
- 「运维有小邓」监控文件及文件夹变更
猜你喜欢
matlab习题 —— 矩阵的常规运算
基于 WPF 的酷炫 GUI 窗口的简易实现
Import an excel file, solve the problem of skipping blank cells without reading and moving the subscript forward, and return_ BLANK_ AS_ Null red
Flow based depth generation model
Basic operation of stack (implemented in C language)
"9 No" principle and "5 measurement dimensions" of extensible system
导入Excel文件,解决跳过空白单元格不读取,并且下标前移的问题,以及RETURN_BLANK_AS_NULL报红
composition api在项目中的使用总结
2022 operation of simulated examination platform of special operation certificate examination question bank for safety management personnel of hazardous chemical business units
2022电工(初级)复训题库及在线模拟考试
随机推荐
Flow based depth generation model
剑指 Offer 49. 丑数(三指针法)
nn.Parameter和torch.nn.init系列函数给模型参数初始化
剑指 Offer 53 - I. 在排序数组中查找数字 I(改进二分)
mysql获取当前时间是一年的第多少天
matlab习题 —— 符号运算相关练习
2022年R1快开门式压力容器操作特种作业证考试题库及答案
Etcd database source code analysis -- network layer server rafthandler between clusters
Sublime Text 3 基本配置教程
Win 10出现bitlocke恢复,蓝屏错误代码0x1600007e
Necessary software tools in embedded software development
Custom controls under WPF and adaption of controls in Grid
Summary of the use of composition API in the project
Agileplm exception resolution session
劲爆!YOLOv6又快又准的目标检测框架开源啦(附源代码下载)
Floating point and complex type of go data type (4)
17 `bs对象.节点名h3.parent` parents 获取父节点 祖先节点
Apache——阿帕奇簡介
可扩展数据库(下)
Establishment of SSH Framework (Part I)