Reasonably use transactions to improve performance

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.