Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the BASE theory?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is BASE Theory". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is BASE Theory"?

Overview

BASE theory is the abbreviation of three phrases: Basically Available (basic availability), Soft State (soft state) and Eventually Consistent (ultimate consistency). BASE theory is the result of the tradeoff between consistency and usability in CAP. Its core idea is that it is impossible to achieve strong consistency (Strong consistency), but each application can make the system achieve final consistency (Eventual consistency) in an appropriate way according to its own business characteristics. BASE theory is the extension of AP in CAP theory.

The core of BASE theory is basic availability (Basically Available) and ultimate consistency (Eventually consistent). The soft state describes a transition state of system data when achieving service availability, that is to say, there are temporary differences in data copies between different nodes. The soft state is an intermediate transition state.

Basic availability

When unpredictable failures occur in distributed systems, it is allowed to lose the availability of some functions and ensure the availability of core functions.

Flow peaking

12306 the booking system sells tickets in different regions, staggering access requests and weakening the request peak. During the Spring Festival travel season, train tickets for Shenzhen and Beijing go on sale at 8: 00 and 9: 00 respectively. One of the main functions of distributed message queues is peak clipping.

Delayed response

Normally, the search engine returns the results to the user in 0.5 seconds, while the basic available search engines can return the results in 2 seconds. Ensure the operation of core functions by sacrificing the availability of response time

Experience degradation

Replace the original picture with a small picture, and improve the processing power of the system by reducing the clarity and size of the picture. Taobao will turn off the query ability of shopping history in the early days of Singles Day holiday.

Overload protection

The received request is queued for processing in the specified queue. If the waiting time of the request expires (assuming 100ms), the timeout request is rejected directly; for example, after the queue is full, a certain number of queued requests are cleared to protect the system from overloading and achieve the basic availability of the system.

Final consistency

It can't be soft all the time, there must be a time limit. After the expiration of the period, all copies should be ensured to maintain data consistency, so as to achieve the ultimate consistency of the data. This time period depends on network latency, system load, data replication scheme design, and so on. The final consistency can be divided into five categories:

Causal consistency (Causal consistency)

Causal consistency means that if node A notifies node B after updating some data, then node B's subsequent access to and modification of the data is based on the updated value of A. At the same time, there is no such restriction on data access of node C which has no causal relationship with node A.

Read what you write (Read your writes)

Reading what you write means that after node A updates a data, it can always access the latest value it has updated without seeing the old value. In fact, it is also a kind of causal consistency.

Session consistency (Session consistency)

Session consistency frames the access to system data in a session: the system can guarantee the consistency of "reading and writing" in the same valid session, that is, after performing the update operation, the client can always read the latest value of the data item in the same session.

Monotone read consistency (Monotonic read consistency)

Monotone read consistency means that if a node reads a value of a data item from the system, the system should not return an older value for any subsequent data access to that node.

Monotone write consistency (Monotonic write consistency)

Monotone write consistency means that a system should be able to ensure that writes from the same node are performed sequentially.

In practice, these five systems are often used together to build a distributed system with ultimate consistency.

In fact, it is not only distributed systems that use ultimate consistency, but relational databases also use ultimate consistency for certain functions. For example, backup, the replication process of the database takes time, in this replication process, the value read by the business is old. Of course, data consistency was finally achieved. This is also a classic case of ultimate consistency. Almost all Internet systems adopt ultimate consistency, and strong consistency or transactions are used only when final consistency cannot be used. for example, for sensitive metadata that determines the operation of the system, strong consistency needs to be considered. for money-related payment system or financial system data, transactions need to be considered.

At this point, I believe you have a deeper understanding of "what is BASE theory". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report