当前位置:网站首页>Concurrency Control & NoSQL and new database
Concurrency Control & NoSQL and new database
2022-07-07 14:52:00 【weixin_ forty-five million seven hundred and fifty thousand fou】
concurrency control
1、 Why concurrency control in database ? What characteristics of transactions can concurrency control technology ensure ?
Share resources when database , Usually multiple transactions are executed at the same time . Simultaneous reads occur when multiple transactions are accessed simultaneously / Write the same data . If you do not control concurrent operations, you may access incorrect data , Destroy the consistency of transactions .
Concurrency control ensures the consistency and isolation of transactions
2、 What kinds of data inconsistencies will be caused by concurrent operations ? How can we avoid
1) Missing changes , Two transactions modify the same data at the same time , Then the operation of one transaction will be overwritten by the modification of another transaction .
2) It can't be read repeatedly , After a transaction reads some data , Another transaction updates it , Then when you read it again, you will get different data from the last time .
3) Read dirty data , A transaction modifies some data and writes it back to disk , After another transaction reads the data , The previous transaction was cancelled for some reason .
The way to avoid inconsistency is concurrency control , Common concurrency control methods include blocking method 、 Timestamp method 、 Optimistic control 、 Multi version concurrency control method, etc
3、 Blockade and types of blockade
Blockade is business T Before operating on a data , Send a request to the system first , Lock it , After you lock the data, you must have control over the transaction , In the transaction T Before releasing the lock , Other transactions cannot update or read the data
The types of blockade are : Exclusive lock 、 Shared lock
4、 What problems can the three-level agreement solve
Add X lock , Release until the transaction is over . Solved the problem of missing modifications .
stay 1 Add on the basis S lock , After reading, you can release , Solved the problem of reading dirty data .
stay 1 Add on the basis S lock , Release until the transaction is over , Solved the unrepeatable read problem
5、 Live lock 、 Causes and solutions of live lock
When a series of blocking operations cannot be performed in the correct order , It may cause transactions to wait indefinitely for a blockade .
The way to avoid livelocks is to use FCFS
6、 Deadlock 、 Deadlock solution
Deadlock refers to the execution of two or more processes , A blocking phenomenon caused by competition for resources or communication with each other , If there is no external force , They will not be able to move forward . These processes that are always waiting for each other are called deadlock processes .
There are two ways to prevent deadlock : Deadlock prevention 、 Deadlock diagnosis and release
There are two ways to prevent deadlocks : One time blockade 、 Sequential blockade
Deadlock diagnosis and resolution : Overtime method 、 Transaction wait graph
Relief law : Choose the transaction with the lowest deadlock cost , Release it
7、 What kind of concurrent scheduling is the correct scheduling
Serializable concurrent scheduling is the correct scheduling . Serializable scheduling definition : Concurrent execution of multiple transactions is correct , When and
Only if the result is the same as that of serial execution executed in a certain order .
8、 How to ensure the correctness of concurrent scheduling
Conflicts can be serialized , Use two-stage lock protocol
NoSQL and New database
since 1970 Since then , Database technology has developed to the fourth generation , The first generation is 60~70 Hierarchical and mesh database system in early , The second generation is 70 The relational database system started in the mid-s , The third generation is 80 Object database system and 90 Expand the model of , Make the relational database system have object-oriented function .
since 2000 Since then ,Web technology 、 Social networks 、 Advances in mobile computing and the Internet of things have led to semi-structured applications generated worldwide 、 Unstructured data is growing explosively , Such applications create a variety of different requirements , Including horizontal scalability 、 Support large-scale and massive data processing capacity , The system should have high availability and fault tolerance to deal with hardware and software failures , And can respond to client requests by using additional resources , So as to improve the query processing speed , This leads to the fourth generation database technology NoSQL and NewSQL The emergence of Technology .
NoSQL The key feature of a database is :(1) Use graphics 、 Trees 、 Key value 、 Data models other than tabular models such as documents ;(2) There is no fixed schema definition in database design ;(3) Provide implicit support for horizontal scalability ;(4) Have final consistency rather than strong consistency .NoSQL Another important concept of is CAP Theorem , It provides some constraints on the attributes that are crucial to distributed systems , namely : Uniformity 、 Availability and partition fault tolerance .CAP The theorem shows that , The distributed system can only meet the following requirements at any given time 2 Attributes .
NewSQL It is the latest generation of database system , It not only provides NoSQL The database system has scalability and scalability
Usability , It also retains the traditional relational database ACID characteristic 、 Relational data model and SQL query language
边栏推荐
- STM32CubeMX,68套组件,遵循10条开源协议
- Analysis of arouter
- Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
- 拼多多败诉,砍价始终差0.9%一案宣判;微信内测同一手机号可注册两个账号功能;2022年度菲尔兹奖公布|极客头条...
- Substance painter notes: settings for multi display and multi-resolution displays
- Simple steps for modifying IP of sigang electronic scale
- Emqx 5.0 release: open source Internet of things message server with single cluster supporting 100million mqtt connections
- Protection strategy of server area based on Firewall
- 小米的芯片自研之路
- What is cloud primordial? This time, I can finally understand!
猜你喜欢
用于增强压缩视频质量的可变形卷积密集网络
C 6.0 language specification approved
STM32CubeMX,68套组件,遵循10条开源协议
EfficientNet模型的完整细节
Discussion on CPU and chiplet Technology
2022年13个UX/UI/UE最佳创意灵感网站
Internal sort - insert sort
【历史上的今天】7 月 7 日:C# 发布;Chrome OS 问世;《仙剑奇侠传》发行
In the field of software engineering, we have been doing scientific research for ten years!
Data connection mode in low code platform (Part 2)
随机推荐
Leetcode one question per day (636. exclusive time of functions)
Deformable convolutional dense network for enhancing compressed video quality
《微信小程序-进阶篇》组件封装-Icon组件的实现(一)
回归测试的分类
时空可变形卷积用于压缩视频质量增强(STDF)
PLC: automatically correct the data set noise, wash the data set | ICLR 2021 spotlight
CPU与chiplet技术杂谈
What is the process of ⼀ objects from loading into JVM to being cleared by GC?
Apache多个组件漏洞公开(CVE-2022-32533/CVE-2022-33980/CVE-2021-37839)
Simple steps for modifying IP of sigang electronic scale
用于增强压缩视频质量的可变形卷积密集网络
The world's first risc-v notebook computer is on pre-sale, which is designed for the meta universe!
ES日志报错赏析-trying to create too many buckets
安恒堡垒机如何启用Radius双因素/双因子(2FA)身份认证
PD virtual machine tutorial: how to set the available shortcut keys in the parallelsdesktop virtual machine?
Navigation - are you sure you want to take a look at such an easy-to-use navigation framework?
一文读懂数仓中的pg_stat
一款你不容错过的Laravel后台管理扩展包 —— Voyager
Yyds dry goods inventory # solve the real problem of famous enterprises: cross line
Lidar Knowledge Drop