A distributed transaction processing method and system
By scanning global transaction information, designing local transaction processing logic, and defining compensation strategies, the problem of balancing consistency, availability, and partition tolerance in distributed transaction processing is solved, and adaptability and efficiency are improved.
Patent Information
- Application Number
- CN202410782236.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-18
AI Technical Summary
It is difficult for existing distributed transaction processing to balance consistency, availability and partition tolerance, and the compensation measures are single, resulting in insufficient adaptability.
Determine CAP requirements by scanning basic information of global transactions, design local transaction processing logic, split global transactions into multiple local transactions, test concurrency levels, define compensation strategies and processing priorities, and divide processing batches in the Try, Confirm and Cancel phases and sequence.
It improves the adaptability and efficiency of distributed transaction processing, ensures the balance of the three CAPs, and reduces losses when local transactions fail.
Smart Images

Figure CN118349320B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and more specifically, to a distributed transaction processing method and system. Background Art
[0002] Distributed transaction processing involves coordinating and managing transactions on multiple network nodes to ensure data consistency and system reliability. The core of this is the CAP theory, which states that in a distributed system, consistency, availability, and partition tolerance cannot be achieved at the same time, and trade-offs must be made during design. Key technologies include the two-phase commit protocol to ensure strong consistency, and the eventual consistency model based on event tracing and CRDTs to improve system availability and scalability. Compensating transaction strategies are used to handle failed operations to maintain system status. Monitoring and automation tools are used to track system performance and optimize transaction processing processes.
[0003] In the prior art, distributed transaction processing cannot balance the relationship among consistency, availability and partition tolerance, and the compensation measures are relatively simple, which cannot guarantee the adaptability of distributed transaction processing.
[0004] Therefore, how to improve the adaptability of distributed transaction processing is a technical problem that needs to be solved. Summary of the invention
[0005] The present invention provides a distributed transaction processing method to solve the technical problem of low adaptability of distributed transaction processing in the prior art. The method comprises:
[0006] Scan the basic information of global transactions and determine the CAP requirements based on the basic information of global transactions;
[0007] Design local transaction processing logic, programming language, framework and library according to CAP requirements, split global transactions into multiple local transactions, and conduct a series of tests on the processing logic to determine the concurrency level;
[0008] Define a compensation strategy for each local transaction and determine the processing priority of each local transaction;
[0009] Based on the processing priority and compensation strategy of local transactions, the processing batches and order of local transactions in the Try, Confirm and Cancel stages are divided to perform transaction processing.
[0010] In some embodiments of the present application, determining the CAP requirement according to the basic information of the global transaction includes:
[0011] The basic information of global transactions includes business requirements, system environment, user experience requirements, network conditions and data types;
[0012] Determine the first CAP requirement interval and the second CAP requirement interval respectively according to business requirements and system environment;
[0013] determining a standard CAP requirement interval based on the first CAP requirement interval and the second CAP requirement interval;
[0014] Determine the third CAP requirement range based on user experience requirements, network conditions, and data types;
[0015] Determine CAP requirements through the third CAP requirement interval and the standard CAP requirement interval;
[0016] Among them, CAP requirements include consistency requirements, availability requirements, and partition tolerance requirements.
[0017] In some embodiments of the present application, determining a standard CAP requirement interval based on the first CAP requirement interval and the second CAP requirement interval includes:
[0018] If there is an intersection between each requirement interval in the first CAP requirement interval and the second CAP requirement interval, the intersection interval of the three requirements is used as the standard CAP requirement interval, and the degree of intersection of each item in the standard CAP requirement interval is determined respectively. Two of the three requirements are regarded as strong compliance requirements and one as weak compliance requirement according to the degree of intersection;
[0019] If only two requirements in the requirement intervals of the first CAP requirement interval and the second CAP requirement interval have an intersection, then calculate the distance between the two intervals of the item in the first CAP requirement interval and the second CAP requirement interval that does not have an intersection, and based on the distance, select a section of the item in the second CAP requirement interval, and use this section and the intersection of the other two requirements as the standard CAP requirement interval, and use the one requirement that does not have an intersection as a weakly conforming requirement, and the other two requirements that have an intersection as strong conforming requirements.
[0020] In some embodiments of the present application, determining the CAP requirement through the third CAP requirement interval and the standard CAP requirement interval includes:
[0021] ;
[0022] Among them, Q is one of the CAP requirements, namely, consistency requirement, availability requirement or partition tolerance requirement. is a range in the third CAP requirement range, is a certain interval of the standard CAP requirement interval, and For the same requirement, is the first objective function about the minimum, average and maximum values of the intersection interval, exp is the exponential function, is a strong or weak correlation function about the intersection of two intervals, is the constant corresponding to the category and intersection of this requirement, is the second objective function about the minimum, average and maximum values of the union interval, is a strong or weak correlation function about the union of two intervals, A constant corresponding to the category and union of the item required.
[0023] In some embodiments of the present application, a series of tests are performed on the processing logic to determine the concurrency level, including:
[0024] Quantify the degree of control of each control method, combine the degrees of control of different control methods to determine the control effect, and determine the mapping relationship between the control effect and the concurrency level;
[0025] Testing includes unit testing, integration testing, load testing, and stress testing, quantifying the results of each test;
[0026] The test also includes operation test, which tests various operation indicators;
[0027] Determine the concurrency level based on test results and running tests;
[0028] ;
[0029] Where L is the concurrency level, n is the number of tests, is the weight corresponding to the i-th test, is the result score corresponding to the i-th test, is the result function of the overall test, m is the number of running indicators, is the weight corresponding to the j-th operating indicator, is the parameter of the jth operating indicator, To run the test result function, A parallel result function that is a combination of the result function of the overall test and the result function of the running test. is the third constant, and [] is the rounding symbol.
[0030] In some embodiments of the present application, a compensation strategy is defined for each local transaction, including:
[0031] When the local transaction has an opposite operation, the opposite operation is used as a compensation strategy;
[0032] Otherwise, analyze the impact and urgency of the local transaction failure, as well as the operational feasibility and compensation effect of each compensation method for the local transaction;
[0033] Determine the relative compensation effect based on the impact of the local transaction failure and the compensation effect of the compensation means;
[0034] Determining relative compensation feasibility based on the urgency of the local transaction failure and the operational feasibility of the compensation means;
[0035] The compensation means are divided into multiple compensation echelons with different priorities based on relative compensation effects and relative compensation feasibility, and the order of compensation means in each compensation echelon is confirmed.
[0036] In some embodiments of the present application, the processing priority of each local transaction is determined, including:
[0037] The processing priority of each local transaction is evaluated by the four-quadrant rule. If there are local transactions with the same processing priority, the importance of the failure is determined according to the impact and urgency of the local transaction failure, and the processing priority of the same local transactions is distinguished according to the importance of the failure.
[0038] Correspondingly, the present application also provides a distributed transaction processing system, including:
[0039] The first module is used to scan the basic information of global transactions and determine the CAP requirements based on the basic information of global transactions;
[0040] The second module is used to design local transaction processing logic, programming language, framework and library according to CAP requirements, split global transactions into multiple local transactions, and conduct a series of tests on the processing logic to determine the concurrency level;
[0041] The third module is used to define a compensation strategy for each local transaction and determine the processing priority of each local transaction;
[0042] The fourth module is used to divide the processing batches and sequence of local transactions in the Try, Confirm and Cancel stages based on the processing priority and compensation strategy of local transactions, so as to perform transaction processing.
[0043] By applying the above technical solutions, the basic information of global transactions is scanned, and the CAP requirements are determined based on the basic information of global transactions; the local transaction processing logic, programming language, framework and library are designed according to the CAP requirements, and the global transaction is split into multiple local transactions, and a series of tests are performed on the processing logic to determine the concurrency level; a compensation strategy is defined for each local transaction, and the processing priority of each local transaction is determined; based on the processing priority and compensation strategy of local transactions, the processing batches and sequence of local transactions in the Try, Confirm and Cancel stages are divided to perform transaction processing. This application determines the CAP requirements through the basic information of global transactions, thereby designing the processing logic, framework, etc., and determines the concurrency level through testing, ensuring the balance of the three CAPs. A compensation strategy is defined for each local transaction to ensure that the loss is minimized when the local transaction fails, improve the adaptability of distributed transaction processing, and effectively improve the efficiency of distributed processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 A schematic diagram showing a flow chart of a distributed transaction processing method proposed in an embodiment of the present invention;
[0046] Figure 2 A schematic diagram of the structure of a distributed transaction processing system proposed in an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] The present application embodiment provides a distributed transaction processing method, such as Figure 1 As shown, the method comprises the following steps:
[0049] Step S101 , scanning basic information of global transactions, and determining CAP requirements according to the basic information of global transactions.
[0050] In this embodiment, the CAP theorem points out that in a distributed computing environment, it is impossible to simultaneously meet the three basic requirements of consistency, availability, and partition tolerance. At most, only two of them can be met at the same time. Therefore, when designing and implementing a distributed system, it is necessary to make trade-offs based on specific business scenarios and requirements. Here, two strong compliance requirements and one weak compliance requirement (i.e., one requirement that cannot be met) are set.
[0051] In some embodiments of the present application, determining the CAP requirement according to the basic information of the global transaction includes:
[0052] The basic information of global transactions includes business requirements, system environment, user experience requirements, network conditions and data types;
[0053] Determine the first CAP requirement interval and the second CAP requirement interval respectively according to business requirements and system environment;
[0054] determining a standard CAP requirement interval based on the first CAP requirement interval and the second CAP requirement interval;
[0055] Determine the third CAP requirement range based on user experience requirements, network conditions, and data types;
[0056] Determine CAP requirements through the third CAP requirement interval and the standard CAP requirement interval;
[0057] Among them, CAP requirements include consistency requirements, availability requirements, and partition tolerance requirements.
[0058] In this embodiment, business requirements: Different business scenarios have different requirements for consistency, availability, and partition tolerance. System environment: If the system is deployed in a stable intranet environment, the possibility of network partition is small, and consistency and availability can be considered. In a cloud environment or a system deployed across data centers, the possibility of network partition is high, and partition tolerance is particularly important. Therefore, different system environments have different requirements for consistency, availability, and partition tolerance.
[0059] User experience: If the business has a high demand for real-time performance and users cannot accept any form of delay, then availability may be more important and mainly affect availability.
[0060] Data type: For some important data, a certain degree of consistency must be maintained, which mainly affects consistency.
[0061] Network conditions include network delays, network outages, node failures, etc., which mainly affect partition tolerance.
[0062] Network latency: In a distributed system, communication between nodes may be affected by network latency. Network outage: A network outage is a complete interruption of communication between nodes, which may be caused by hardware failure, software errors, or other reasons. Network outages affect the collaboration between nodes in a distributed system and may cause the system to not function properly. Node failure: Nodes in a distributed system may fail, such as going down or crashing.
[0063] In some embodiments of the present application, determining a standard CAP requirement interval based on the first CAP requirement interval and the second CAP requirement interval includes:
[0064] If there is an intersection between each requirement interval in the first CAP requirement interval and the second CAP requirement interval, the intersection interval of the three requirements is used as the standard CAP requirement interval, and the degree of intersection of each item in the standard CAP requirement interval is determined respectively. Two of the three requirements are regarded as strong compliance requirements and one as weak compliance requirement according to the degree of intersection;
[0065] If only two requirements in the requirement intervals of the first CAP requirement interval and the second CAP requirement interval have an intersection, then calculate the distance between the two intervals of the item in the first CAP requirement interval and the second CAP requirement interval that does not have an intersection, and based on the distance, select a section of the item in the second CAP requirement interval, and use this section and the intersection of the other two requirements as the standard CAP requirement interval, and use the one requirement that does not have an intersection as a weakly conforming requirement, and the other two requirements that have an intersection as strong conforming requirements.
[0066] In this embodiment, since business requirements are often relatively adapted to the system environment, situations other than the above two situations are not considered.
[0067] In this embodiment, the distance between two intervals of an item that does not intersect in the first CAP requirement interval and the second CAP requirement interval is calculated, which refers to the distance between the adjacent endpoints of the two intervals. Based on the distance, a segment of the item is selected in the second CAP requirement interval, and different distances correspond to different segment intervals, and the starting point is the adjacent endpoint of the second CAP requirement interval.
[0068] It should be noted that the corresponding relationships involved in the full text can be obtained from mathematical models or historical experience.
[0069] In some embodiments of the present application, determining the CAP requirement through the third CAP requirement interval and the standard CAP requirement interval includes:
[0070] ;
[0071] Among them, Q is one of the CAP requirements, namely, consistency requirement, availability requirement or partition tolerance requirement. is a range in the third CAP requirement range, is a certain interval of the standard CAP requirement interval, and For the same requirement, is the first objective function about the minimum, average and maximum values of the intersection interval, exp is the exponential function, is a strong or weak correlation function about the intersection of two intervals, is the constant corresponding to the category and intersection of this requirement, is the second objective function about the minimum, average and maximum values of the union interval, is a strong or weak correlation function about the union of two intervals, A constant corresponding to the category and union of the item required.
[0072] In this embodiment, the intersection or union of different requirements has different first and second objective functions, strong or weak correlation functions, and constants.
[0073] Step S102, design the local transaction processing logic, programming language, framework and library according to the CAP requirements, split the global transaction into multiple local transactions, and perform a series of tests on the processing logic to determine the concurrency level.
[0074] In this embodiment, the concurrency level is the number of requests or transactions that the system can process per unit time. This indicator reflects the load capacity of the system, that is, the number of users who can use the system at the same time, and needs to be determined through a series of tests.
[0075] In some embodiments of the present application, a series of tests are performed on the processing logic to determine the concurrency level, including:
[0076] Quantify the degree of control of each control method, combine the degrees of control of different control methods to determine the control effect, and determine the mapping relationship between the control effect and the concurrency level;
[0077] Testing includes unit testing, integration testing, load testing, and stress testing, quantifying the results of each test;
[0078] The test also includes operation test, which tests various operation indicators;
[0079] Determine the concurrency level based on test results and running tests;
[0080] ;
[0081] Where L is the concurrency level, n is the number of tests, is the weight corresponding to the i-th test, is the result score corresponding to the i-th test, is the result function of the overall test, m is the number of running indicators, is the weight corresponding to the j-th operating indicator, is the parameter of the jth operating indicator, To run the test result function, A parallel result function that is a combination of the result function of the overall test and the result function of the running test. is the third constant, and [] is the rounding symbol.
[0082] In this embodiment, the control means refers to optimizing code, expanding hardware resources, asynchronous processing, current limiting strategy, etc.
[0083] In this embodiment, the operation indicators include performance indicators such as error rate, delay, and throughput.
[0084] In this embodiment, Represents a concurrent function (parallel result function) obtained based on the result function of the overall test and the result function of the running test.
[0085] Step S103: define a compensation strategy for each local transaction and determine the processing priority of each local transaction.
[0086] In this embodiment, the compensation strategy is a method for handling transaction failures in a distributed system, especially in long-running transactions and microservice architectures. The basic idea is that for each operation, an opposite compensation operation is defined to undo it. When a transaction cannot be completed normally, the compensation operation of the completed operation is executed to achieve the purpose of restoring the system state. The following are some typical business operations and corresponding compensation operations:
[0087] Adding a record: If the original operation is to add a record in the database, then the corresponding compensating operation is to delete this record.
[0088] Deleting records: If the original operation is to delete a record, then the compensation operation is to reinsert the record into the database. To implement this compensation operation, you may need to save a backup of the record before deleting it.
[0089] Modify a record: If the original operation is to modify a record, then the compensation operation is to restore the record to its state before the modification. Similarly, you also need to save a backup of the record before modifying it.
[0090] However, if the business does not have a clear opposite operation, how to reduce the impact after failure is a problem that needs to be solved.
[0091] In some embodiments of the present application, a compensation strategy is defined for each local transaction, including:
[0092] When the local transaction has an opposite operation, the opposite operation is used as a compensation strategy;
[0093] Otherwise, analyze the impact and urgency of the local transaction failure, as well as the operational feasibility and compensation effect of each compensation method for the local transaction;
[0094] Determine the relative compensation effect based on the impact of the local transaction failure and the compensation effect of the compensation means;
[0095] Determining relative compensation feasibility based on the urgency of the local transaction failure and the operational feasibility of the compensation means;
[0096] The compensation means are divided into multiple compensation echelons with different priorities based on relative compensation effects and relative compensation feasibility, and the order of compensation means in each compensation echelon is confirmed.
[0097] In this embodiment, the compensation means include but are not limited to the following:
[0098] Retry mechanism: Set up a retry mechanism for failed transactions. In many cases, transaction failure may be caused by temporary network problems or excessive system load. By retrying, it is possible to successfully execute the transaction.
[0099] Idempotence design: If transactions cannot be directly reversed, try to design system operations to have idempotence characteristics. Idempotence means that executing the same operation multiple times will not produce different results. In this way, even if repeated execution occurs, there will be no additional impact on the system state.
[0100] Backup and recovery: Before performing risky operations, make sure to back up the current data or system state. If the transaction fails, you can use the backup to recover to a stable state.
[0101] Service degradation: If transaction failures could cause system instability, consider temporarily shutting down or degrading certain features until the problem is resolved.
[0102] Fault-tolerant design: Introducing fault-tolerant mechanisms into system design, such as the circuit breaker pattern in microservices, can fail quickly when errors are detected to prevent errors from spreading.
[0103] Step S104, dividing the processing batches and sequence of the local transactions in the Try, Confirm and Cancel phases based on the processing priority and compensation strategy of the local transactions, thereby performing transaction processing.
[0104] In this embodiment, each local transaction is executed using the TCC model:
[0105] Try phase: The trial phase is to perform business checks and reserve necessary business resources.
[0106] Confirm phase: In the confirmation phase, the business resources reserved in the Try phase are confirmed. If the Try phase is successfully executed, this phase is entered to complete the actual business operation.
[0107] Cancel phase: When the Try phase fails, the Cancel operation is triggered to release the business resources reserved in the Try phase.
[0108] In some embodiments of the present application, the processing priority of each local transaction is determined, including:
[0109] The processing priority of each local transaction is evaluated by the four-quadrant rule. If there are local transactions with the same processing priority, the importance of the failure is determined according to the impact and urgency of the local transaction failure, and the processing priority of the same local transactions is distinguished according to the importance of the failure.
[0110] In this embodiment, according to the Eisenhower principle, also known as the four-quadrant rule, the tasks that are both urgent and important should be dealt with first. These tasks are usually time-sensitive and critical to the success of the project. Determining the importance of failure according to the impact and urgency of the failure of the local transaction means determining the importance of failure according to the corresponding weights of the two.
[0111] By applying the above technical solutions, the basic information of global transactions is scanned, and the CAP requirements are determined based on the basic information of global transactions; the local transaction processing logic, programming language, framework and library are designed according to the CAP requirements, and the global transaction is split into multiple local transactions, and a series of tests are performed on the processing logic to determine the concurrency level; a compensation strategy is defined for each local transaction, and the processing priority of each local transaction is determined; based on the processing priority and compensation strategy of local transactions, the processing batches and sequence of local transactions in the Try, Confirm and Cancel stages are divided to perform transaction processing. This application determines the CAP requirements through the basic information of global transactions, thereby designing the processing logic, framework, etc., and determines the concurrency level through testing, ensuring the balance of the three CAPs. A compensation strategy is defined for each local transaction to ensure that the loss is minimized when the local transaction fails, improve the adaptability of distributed transaction processing, and effectively improve the efficiency of distributed processing.
[0112] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present invention can be implemented by hardware, or by software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present invention.
[0113] In order to further explain the technical idea of the present invention, the technical solution of the present invention is now described in combination with specific application scenarios.
[0114] Correspondingly, the present application also provides a distributed transaction processing system, such as Figure 2 As shown, including:
[0115] The first module is used to scan the basic information of global transactions and determine the CAP requirements based on the basic information of global transactions;
[0116] The second module is used to design local transaction processing logic, programming language, framework and library according to CAP requirements, split global transactions into multiple local transactions, and conduct a series of tests on the processing logic to determine the concurrency level;
[0117] The third module is used to define a compensation strategy for each local transaction and determine the processing priority of each local transaction;
[0118] The fourth module is used to divide the processing batches and sequence of local transactions in the Try, Confirm and Cancel stages based on the processing priority and compensation strategy of local transactions, so as to perform transaction processing.
[0119] Those skilled in the art will appreciate that the modules in the system in the implementation scenario can be distributed in the system of the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more systems different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0120] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A distributed transaction processing method, characterized in that: include: Scan the basic information of global transactions and determine the CAP requirements based on the basic information of global transactions; Design local transaction processing logic, programming language, framework and library according to CAP requirements, split global transactions into multiple local transactions, and conduct a series of tests on the processing logic to determine the concurrency level; Define a compensation strategy for each local transaction and determine the processing priority of each local transaction; Based on the processing priority and compensation strategy of local transactions, the processing batches and order of local transactions in the Try, Confirm and Cancel stages are divided to perform transaction processing; Determine CAP requirements based on basic global transaction information, including: The basic information of global transactions includes business requirements, system environment, user experience requirements, network conditions and data types; Determine the first CAP requirement interval and the second CAP requirement interval respectively according to business requirements and system environment; determining a standard CAP requirement interval based on the first CAP requirement interval and the second CAP requirement interval; Determine the third CAP requirement range based on user experience requirements, network conditions, and data types; Determine CAP requirements through the third CAP requirement interval and the standard CAP requirement interval; Among them, CAP requirements include consistency requirements, availability requirements, and partition tolerance requirements; Determining a standard CAP requirement interval based on the first CAP requirement interval and the second CAP requirement interval includes: If there is an intersection between each requirement interval in the first CAP requirement interval and the second CAP requirement interval, the intersection interval of the three requirements is used as the standard CAP requirement interval, and the degree of intersection of each item in the standard CAP requirement interval is determined respectively. Two of the three requirements are regarded as strong compliance requirements and one as weak compliance requirement according to the degree of intersection; If only two requirements in the requirement intervals of the first CAP requirement interval and the second CAP requirement interval have an intersection, then calculate the distance between the two intervals of the item in the first CAP requirement interval and the second CAP requirement interval that does not have an intersection, and based on the distance, select a section of the item in the second CAP requirement interval, and use this section and the intersection of the other two requirements as the standard CAP requirement interval, and use the one requirement that does not have an intersection as a weakly conforming requirement, and the other two requirements that have an intersection as strong conforming requirements.
2. The distributed transaction processing method according to claim 1, characterized in that: CAP requirements are determined through the third CAP requirement range and the standard CAP requirement range, including: ; Among them, Q is one of the CAP requirements, namely, consistency requirement, availability requirement or partition tolerance requirement. is a range in the third CAP requirement range, is a certain interval of the standard CAP requirement interval, and For the same requirement, is the first objective function about the minimum, average and maximum values of the intersection interval, exp is the exponential function, is a strong or weak correlation function about the intersection of two intervals, is the constant corresponding to the category and intersection of this requirement, is the second objective function about the minimum, average and maximum values of the union interval, is a strong or weak correlation function about the union of two intervals, A constant corresponding to the category and union of the item required.
3. The distributed transaction processing method according to claim 1, characterized in that: A series of tests are performed on the processing logic to determine the level of concurrency, including: Quantify the degree of control of each control method, combine the degrees of control of different control methods to determine the control effect, and determine the mapping relationship between the control effect and the concurrency level; Testing includes unit testing, integration testing, load testing, and stress testing, quantifying the results of each test; The test also includes operation test, which tests various operation indicators; Determine the concurrency level based on test results and running tests; ; Where L is the concurrency level, n is the number of tests, is the weight corresponding to the i-th test, is the result score corresponding to the i-th test, is the result function of the overall test, m is the number of running indicators, is the weight corresponding to the j-th operating indicator, is the parameter of the jth operating indicator, To run the test result function, A parallel result function that is a combination of the result function of the overall test and the result function of the running test. is the third constant, and [] is the rounding symbol.
4. The distributed transaction processing method according to claim 1, characterized in that: Define a compensation strategy for each local transaction, including: When the local transaction has an opposite operation, the opposite operation is used as a compensation strategy; Otherwise, analyze the impact and urgency of the local transaction failure, as well as the operational feasibility and compensation effect of each compensation method for the local transaction; Determine the relative compensation effect based on the impact of the local transaction failure and the compensation effect of the compensation means; Determining relative compensation feasibility based on the urgency of the local transaction failure and the operational feasibility of the compensation means; The compensation means are divided into multiple compensation echelons with different priorities based on relative compensation effects and relative compensation feasibility, and the order of compensation means in each compensation echelon is confirmed.
5. The distributed transaction processing method according to claim 4, characterized in that: And determine the processing priority of each local transaction, including: The processing priority of each local transaction is evaluated by the four-quadrant rule. If there are local transactions with the same processing priority, the importance of the failure is determined according to the impact and urgency of the local transaction failure, and the processing priority of the same local transactions is distinguished according to the importance of the failure.
6. A distributed transaction processing system, using the distributed transaction processing prevention described in any one of claims 1 to 5, characterized in that: include: The first module is used to scan the basic information of global transactions and determine the CAP requirements based on the basic information of global transactions; The second module is used to design local transaction processing logic, programming language, framework and library according to CAP requirements, split global transactions into multiple local transactions, and conduct a series of tests on the processing logic to determine the concurrency level; The third module is used to define a compensation strategy for each local transaction and determine the processing priority of each local transaction; The fourth module is used to divide the processing batches and sequence of local transactions in the Try, Confirm and Cancel stages based on the processing priority and compensation strategy of local transactions, so as to perform transaction processing.
