Think of a sentence: "Add a layer, you can solve the problem"

Source: Internet
Author: User

Near time in making ha (highly available) design, database using MongoDB, test scenario is 1 Master 2 from

The test found that when the data is written to MongoDB in bulk (100w), the primary node goes down, the current request throws an exception, the next request is automatically switched to the slave node, and 100w of data has 30w+ data synchronized to the slave node. Illustrates that MongoDB can throw an exception if the primary node goes down at the time of the crud execution and does not guarantee the consistency of the data, that is, 100w data is either all inserted or not inserted.

Therefore, add a layer of data Access Layer (DAO) between the application layer and MongoDB, and after catching an exception in DAO, clear the state of the error operation (such as purging some of the inserted data, etc.) and re-execute it to achieve full transparency to the application.

Think of a sentence: "Add a layer, you can solve the problem"

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.