Yii2 cross-server transaction processing?

Source: Internet
Author: User
Development language PHP, development framework YII2, database mysql (all hard conditions) status quo: due to business needs, the database will be distributed on different servers, there are business exchanges between servers problem 1: yii2 concurrency multi-server, but php does not support server transaction processing. How to ensure data accuracy... development language PHP, development framework YII2, database mysql (all hard conditions)
Status quo: due to business needs, databases are distributed on different servers, and there are business exchanges between servers.
Question 1: yii2 concurrent multi-server, but php does not support server transaction processing, how to ensure data accuracy
Problem 2: yii2 modifies three pieces of data on three servers, and the processing time is 15 seconds. A single operation is normal. Yii2 databases are dynamically connected.
Question 3: If you meet the hard conditions, please give a solution.

Reply content:

Development language PHP, development framework YII2, database mysql (all hard conditions)
Status quo: due to business needs, databases are distributed on different servers, and there are business exchanges between servers.
Question 1: yii2 concurrent multi-server, but php does not support server transaction processing, how to ensure data accuracy
Problem 2: yii2 modifies three pieces of data on three servers, and the processing time is 15 seconds. A single operation is normal. Yii2 databases are dynamically connected.
Question 3: If you meet the hard conditions, please give a solution.

1. If Yii connects to multiple different databases at the same time, there is no good way to accelerate this kind of data except asynchronous queues, yii always executes SQL statements on the master when executing transactions;
2. Same as above
3. You can consider the One-master-multiple-slave mode to execute transactions quickly. If three different business systems require real-time data. I can assume that the execution time is 0. It is unacceptable to calculate the connection time...

Yii2 modifies three pieces of data. Three pieces of data are stored on three servers, and the processing time reaches 15 seconds. A single operation is normal.
Check whether there is any relevant data to locate and troubleshoot the problem. You can try to locate the problem.

You can use a queue to split the business.

There is a problem with the architecture. PHP writes data to MYSQL. Which mysql is not written by PHP? use MYSQL middleware to proxy these operations.

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.