More sensitive data such as amount modification can only be operated by one person at the same time. Imagine that two people modify the amount at the same time, one adding the amount and the other subtracting the amount. In order to prevent data inconsistency caused by simultaneous operations, a lock is required. If it is required by the database The only thing is row lock or table lock. If it is in a cluster, multiple clients modify a shared data at the same time, which requires distributed lock
For example, multiple machines can execute a certain task regularly. If the task is restricted to be executed by only one machine at a time and cannot be executed repeatedly, distributed locks can be used to mark it.
More sensitive data such as amount modification can only be operated by one person at the same time. Imagine that two people modify the amount at the same time, one adding the amount and the other subtracting the amount. In order to prevent data inconsistency caused by simultaneous operations, a lock is required. If it is required by the database The only thing is row lock or table lock. If it is in a cluster, multiple clients modify a shared data at the same time, which requires distributed lock
For example, multiple machines can execute a certain task regularly. If the task is restricted to be executed by only one machine at a time and cannot be executed repeatedly, distributed locks can be used to mark it.