In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the principle of CAP and the idea of BASE". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
CAP theory in distributed domain
Consistency (consistency), data is updated consistently, and all data changes are synchronized
Availability (availability), good response performance
Partition tolerance (partition tolerance) reliability
Theorem: any distributed system can only satisfy two points at the same time, not all three.
Advice: instead of wasting energy on how to design a perfect distributed system that meets all three, architects should make choices.
The ACID model of relational databases with high consistency and availability is difficult to partition:
Atomicity atomicity: all operations in a transaction must be completed, or none must be completed.
Consistency consistency. The database should be in a consistent state at the beginning or end of the transaction.
Isolation isolation layer. The transaction will assume that it is the only one operating the database and does not know each other.
Durability. Once the transaction is complete, it cannot be returned.
Commit transactions across two segments of the database: 2PC (two-phase commit), 2PC is the anti-scalability pattern (Pat Helland) is anti-scalable, and JTA transactions in JavaEE can support 2PC. Because 2PC is an anti-pattern, try not to use 2PC and use BASE to avoid it.
BASE model anti-ACID model, completely different ACID model, at the expense of high consistency to achieve availability or reliability:
Basically Available is basically available. Failed to support partitioning (e.g. sharding fragmentation database)
Soft state soft state can be out of sync and asynchronous for a period of time.
Eventually consistent is finally consistent, and the final data is consistent, not high consistency from time to time.
The main implementations of BASE ideas are
1. Divide the database by function
2.sharding fragments
The idea of BASE mainly emphasizes basic usability. If you need High availability, that is, pure high performance, then you have to sacrifice consistency or tolerance. The solution of BASE idea still has potential in performance.
Now that the NOSQL movement enriches and expands the idea of BASE, special solutions can be tailored to specific circumstances, such as ignoring consistency, achieving high availability, and so on. NOSQL should have the following two genres:
1. Key-Value storage, such as Amaze Dynamo, can flexibly choose database products with different tendencies according to the three principles of CAP.
two。 Domain model + distributed cache + storage (Qi4j and NoSql movement) can customize a flexible distributed scheme according to the three principles of CAP combined with our own project, which is difficult.
What the two have in common: both are options other than relational database SQL. With the distribution of data, any model can persist itself, separate data processing from data storage, separate read from write, and store them asynchronously or synchronously, depending on the degree of consistency required.
The difference: Key-Value storage products such as NOSQL are products that meet with relational databases, BOX, which can be suitable for non-Java areas such as PHP RUBY, and it is a product that can be used with it. Domain model + distributed cache + storage is a complex architectural solution, not a product, but this approach is more flexible and should be mastered by architects.
This is the end of the content of "what is the principle of CAP and BASE thought". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.