How to bulk process big data

Source: Internet
Author: User

1. Through the data status (not processed, processed, processing completed)

2. Split-page layering

3. Lock select for update via data (multithreaded security)

4. Business

Instance:

User form, redemption eligibility form, redemption eligibility statistics

1. Tens of thousands of users

2. The user obtains several redemption qualifications through the sign-in

3. Scheduled tasks at a fixed time to count the total number of non-redeemed per user last year

4. The user can be redeemed manually, at this time not redeemed and exchange, also need to update the statistics table

Specific implementation:

By select non-processing the user and lock, and then update the processing status to (in process)

Loop through the N data.

for{

Lock statistics

UPDATE STATISTICS

Update user tables for processing completion (these three steps in the same transaction)

}

Issue 1: Timed tasks Multithreading how each user does not repeat

Lock N users with select and then update those users into eligibility statistics. (These two steps are in the same transaction)

Then process the N users (in another transaction)

2: What happens if the user table status is still handled if an exception occurs at the end of processing? How do you differentiate between processing or handling exceptions?

Manually updating all processes before a point in time is not processed, such as 10 days ago. At this point even if two threads are processed at the same time, because the tab is locked, it will be processed successively, there is no data security problem.

How to bulk process big data

Related Article

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.