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.