Distributed - Distributed Systems Services ACID CAP BASE theory theory

Distributed definition

  • Distributed systems is a hardware or software components located on different network computers, and passes only the coordination system communicates through a message between one another.

Distributed Features

  1. Distribution: distributed randomly in space
  2. Reciprocity: a distributed computer system, there is no master / min from it, each of the computer nodes are peers.
  3. Concurrency: concurrent operation of shared resources
  4. The lack of a global clock: Perform the sequence of events is difficult to determine. The lack of a global clock sequence.
  5. Failure always occurred: presupposition and not pre-failure problems will occur

Problems in distributed environments

  1. Communication Exception: a network problem, a hardware problem, typically nanosecond memory access (approximately 10ns), network access delay in milliseconds, a hundred times the network delay of memory access.
  2. Network partition: network anomaly resulting in only a subset of nodes can communicate normally, in extreme cases lead to local clusters need to complete all the tasks independently, including transaction processing of the data, which creates challenges for distributed consensus.
  3. Tristate: success, failure, timeout, the timeout is usually caused by a non-delivery request (e.g., transmission loss), in response to a non-delivery
  4. Node failure: nodes distributed system environment downtime. Each node may fail.

ACID and CAP / BASE

ACID

  • A transaction program operation is a series of data access and the team system composed of the updated execution logic

Affairs database operations to ensure data consistency support

  • Four characteristics of a transaction: atomicity, consistency, isolation, durability
  1. Atomicity (Atomicity): a transaction must be atomic, or do not do, or do it all. Failure to revoke do
  2. Consistency (Consistency): data manipulation operations ensure transaction from one consistent state to another consistent state.
  3. Isolation (Isolation): refers isolated from one another concurrent transaction environment, do not interfere with each other, is generally achieved by pessimistic or optimistic locking.
  4. Persistent (Durability): data permanently altered.
  • Transaction isolation level (standard SQL specification)
  1. Uncommitted Read (Read Uncommitted): isolation lowest level; a transaction can read data another transaction has not been submitted. It will have dirty reads, non-repeatable read, phantom read
  2. Read Committed (Read Committed): Read-only data submitted, to prevent dirty reads, produces non-repeatable read, phantom read
  3. Repeatable read (Repeatable Read): the transaction is not completed, other transactions can not modify records, to solve the dirty read, non-repeatable read, will produce phantom reads.
  4. Serialization (Serialiizable): serial execution of a transaction, one by one process, rather than concurrently.

Distributed Transaction

  • Distributed transaction can be seen as a sequence of operations consisting of a plurality of distributed. It is a simple case of two different services in one of the systems to be increased to reduce the party, failure to complete only one party, we need to roll back. Because the system is distributed, so when executing the transaction is more complicated.

CAP theory

  • CAP means: consistency, availability, partition fault tolerance, which needs only three at most two of them meet.
  1. Consistency (Consistency): to ensure that multiple nodes in the system, a node after the change data, for any node acquires data up to date.
  2. Availability (Availability): data processing request can return results in a limited time.
  3. Partition fault tolerance (Partition tolerance): distributed systems guarantee in the event of failure, to provide external consistency and availability to meet service unless the entire network environment has failed.
  • Give up one of them:
    1. Give up P: If you want to avoid partition fault tolerance, the simplest approach is to (transaction-related) data on a node, P means giving up giving up system scalability.
    2. Give up A: Once the system encounters a fault, then the affected services will become unavailable.
    3. Give up C: give up the strong data consistency, the same can not guarantee real-time, but ensures that end is the same.

BASE theory

  • BASE theory refers to: basic available, soft state, eventual consistency; it is based on CAP theory evolved, the key point of which is the eventual consistency.
  1. Basic available (Basically Available): Allow availability loss portion. It can be less or partial loss of function over time.
  2. Soft state (Soft state): data synchronization process allows each node there is a delay.
  3. The final consistency (Eventually consistent): copies of all the data has been updated over time will become consistent.
Published 34 original articles · won praise 7 · views 8174

Guess you like

Origin blog.csdn.net/ilo114/article/details/88372118