Database ACID and CAP Theory

Source: Internet
Author: User

Database ACID and CAP theory 1. ACID is the theoretical cornerstone of RDBMS. Atomiclty is the transaction atomicity. C is consistent and inserts A table data, will affect other (index/other tables) consistency. I isolation (ioslation) transactions are independent, closed; Isolation Strength; D persistence (Durabilty) Data persists. Corresponding to distributed databases, some services do not require all consistent transactions, and one of them can be weakened to provide other response speeds. Understanding: transaction A atomicity means that A transaction is either completely committed or completely rolled back to ensure that the committed data is consistent with the external response. Or the submission fails, and the database is completely rolled back. This transaction atom ensures the rationality of many business phenomena in real life. For example, if a bank deposit is successfully saved, the database must be completely modified. If the storage fails, the database must be completely rolled back. You cannot store only half of the database or roll back half of the database. C. Transaction consistency: before and after a transaction is executed, the database must be in the consistent State. For example, Tables a and B have primary and foreign key constraints and update, cascade B values must be updated in a consistent manner. I is the isolation of transactions. There are four levels of transaction isolation (read Uncommitted, read committed, rapeatable read, serializable). To prevent database read inconsistency, you can set the isolation of different levels of transactions. D. Durability: after the transaction is completed, the data is permanently stored in the database and will not be rolled back. 2. The famous CAP Theory: in distributed database applications, any distributed system can only meet two of CAP's requirements. Consistency (Consistency), consistent data updates, and all data changes are synchronized. Availability (Availability), good response performance. Partition tolerance (Partition fault tolerance) reliability. The CA system requires high availability and real-time consistency. Single-point databases comply with this architecture, such as the supermarket cash register system and the book management system. A system that satisfies the availability and partition adequacy of an AP usually has lower consistency requirements. For example, a blog system. The CP system must meet the consistency and partition adequacy requirements. The performance is usually not very high. For example, the train ticket sales system. Advice: architects should choose not to waste their energy on designing a perfect distributed system that meets the three requirements. 3. The final consistency system conforms to the AP theoretical architecture and has high requirements on availability and partition fault tolerance, and has low requirements on real-time data consistency. The system architecture of online forums or weibo is consistent with that of applications. 4. Database middleware service is a management system for distributed databases. Load Balancing and scalability are the core of distributed databases.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.