Big Data Processing-how to ensure processing integrity when PHP processes Big Data

Source: Internet
Author: User
PHP processes big data and how to ensure processing integrity. For example, how to ensure one trigger for transferring money to users at the same time so that all users' transfers are received. Please describe in detail! How can PHP ensure the integrity of big data processing;
For example, if you transfer funds to users at the same time, how can we ensure that all users' transfers are received at one time.
Please describe in detail!

Reply content:

How can PHP ensure the integrity of big data processing;
For example, if you transfer funds to users at the same time, how can we ensure that all users' transfers are received at one time.
Please describe in detail!

I think what you want is
1. Ensure that the operations of a single user are accurate. If one of the steps fails, roll back immediately and start the transfer step again.
2. operations performed on a single user, whether successful or not, will not affect operations performed on other users.

For example,
For example, 10 steps are required for transferring funds. You can write 10 interfaces,
Each interface has a return value (indicating whether the operation is successful). These 10 interfaces are placed in the queue (this ensures that the 10 steps of transfer are processed in an orderly manner ),

When transferring money, the user uses the transfer procedure queue,

The above is the transfer operation, and the following is the process for users

We regard users as objects. User information is the attributes of objects. We put all objects in the queue, traverse the queue, and perform the following operations for each user:
1. Record the status of this user first (if unexpected recovery occurs ),
2. Transfer step queue
2-an error occurs. Restore the user's initial information and add the user to the end of the queue.

All of the above is to ensure the integrity of the processing. The following describes the speed problem.
To speed up reading and writing (I am talking about a lot of content), you can use a nosql database such as redis, which contains the queue data structure. You can check it on Baidu.

Next, we can consider using multithreading to create 10 threads, user shards, and 1 thread to process users.

Hope to help you

Use memcacheq and other queues to process them slowly

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.