1. perform various verifications before entering the transaction. If the verification fails, you do not need to enter the transaction.
For example: (1) atm transfers should first determine whether the account is legal, whether it is transferred to itself, whether the amount in the card is greater than the transfer amount...
(2) to participate in an activity, you need to determine whether there is a chance, whether it is in the blacklist, whether the number of participants today has reached the upper limit or other restrictions ....
2. Do not put the preparation work into the transaction,Only put necessary operations into transactions
3. transactions are executed sequentially and are enemies of parallel computing. The smaller the scope, the higher the performance.
4. Do not use technical transactions such as JTA 2 PC or optimistic database locks to solve business-related transactions.
Reasonably use transactions to improve performance