On base theory


Base: they are basically available, soft state, and eventually consistent.
Base theory, the result of consistency and usability measurement in cap theorem. The core idea is that even if strong consistency cannot be achieved, the final consistency should be achieved through appropriate methods.

  • Basically available: allows the loss of partial availability when a distributed system fails.
  • Soft state: allows the state of an application to be out of sync for a certain period of time, and allows intermediate states. For example, in the e-commerce system, the user places an order and pays. Due to the distributed architecture, whether the payment is successful or not is completed by the payment module. The system does not wait for the payment module to return the result to the customer. Instead, the system sets the status to being paid, returns it to the customer, and then the payment module determines the success, and then sets the status to payment completed. In this way, the corresponding speed of the system can be improved. In payment, it is in the middle.
  • Eventually consistent (final consistency): for the above soft state, it will not always be soft. For the same example, if the payment is successful, the status will be successful; if it is failed, the status will be failed, and the customer’s money will be returned. In this way, although the data in the process are not consistent, they will eventually be consistent. Or database master-slave synchronization, master database and synchronization, due to network transmission delay, network jitter, network failure and other reasons, the data may be inconsistent at a certain time, but it is still consistent in the end.