A method for controlling concurrent transaction number and related equipment

By dynamically adjusting the upper limit of transaction concurrency of each server in a distributed system, the problem of slowing down processing speed of distributed systems is solved, and the stability and efficiency of system performance are achieved.

CN113010272BActive Publication Date: 2025-05-02CHINA CONSTRUCTION BANK
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110290906.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-18
Publication Date
2025-05-02
Estimated Expiration
2041-03-18

AI Technical Summary

Technical Problem

When the processing speed of distributed systems slows down, it is easy to cause overall system performance to decline and fail to provide services normally.

Method used

By obtaining the current resource usage data of each server, dynamically adjust the transaction concurrency limit of each server to ensure that the single server concurrency threshold or target value does not exceed, and adjust it according to the overall transaction concurrency limit of the system.

Benefits of technology

It effectively reduces the impact of slower processing speed on distributed systems, avoids the overall processing speed of the system being slowed down, and ensures the stability and performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113010272B_ABST
    Figure CN113010272B_ABST
Patent Text Reader

Abstract

The present application discloses a transaction concurrency control method and related equipment. For the i-th server in the distributed system, the current resource usage data of the i-th server is obtained. After determining that the current resource usage data of the i-th server reaches the first fuse condition and the upper limit of the transaction concurrency of the i-th server is higher than the single-server concurrency threshold, the upper limit of the transaction concurrency of the i-th server is reduced according to the first ratio; after determining that the current resource usage data of the i-th server reaches the first recovery condition and the upper limit of the transaction concurrency of the i-th server is lower than the single-server concurrency target value, the upper limit of the transaction concurrency of the i-th server is increased according to the first ratio. In this way, the impact of the server with slow processing speed on the distributed system can be effectively reduced, thereby effectively avoiding the processing speed of the distributed system from being slowed down.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method for controlling the number of concurrent transactions and related equipment. Background Art

[0002] At present, distributed systems designed based on high availability are prone to an "avalanche" effect, which can be specifically described as follows: if the processing speed of a component (such as a server) in the distributed system slows down, the processing speed of the distributed system will be slowed down, resulting in the distributed system being unable to provide services normally.

[0003] However, how to prevent the processing speed of distributed systems from being slowed down is a technical problem that needs to be solved urgently. Summary of the invention

[0004] In order to solve the above technical problems existing in the prior art, the present application provides a transaction concurrency control method and related equipment, which can effectively control the upper limit of the transaction concurrency of each server in a distributed system, thereby effectively reducing the impact of components with slow processing speed (for example, servers) on the above-mentioned distributed system, and further effectively avoiding the processing speed of the distributed system from being slowed down.

[0005] In order to achieve the above purpose, the technical solutions provided by the embodiments of the present application are as follows:

[0006] The embodiment of the present application provides a method for controlling the number of concurrent transactions, the method for controlling the number of concurrent transactions is applied to a distributed system, the distributed system includes N servers;

[0007] The method comprises:

[0008] Get the current resource usage data of the i-th server; where i is a positive integer, i≤N, and N is a positive integer;

[0009] After determining that the current resource usage data of the i-th server reaches the first fuse condition and determining that the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold, reducing the upper limit of the number of concurrent transactions of the i-th server according to the first ratio;

[0010] After determining that the current resource usage data of the i-th server meets the first recovery condition and determining that the upper limit of the number of concurrent transactions of the i-th server is lower than the single-server concurrent number target value, increase the upper limit of the number of concurrent transactions of the i-th server according to the first ratio.

[0011] In a possible implementation, if the current resource usage data includes a current CPU usage rate, the first fuse condition is that the current CPU usage rate is higher than a first threshold, and the first recovery condition is that the current CPU usage rate is lower than a second threshold;

[0012] or,

[0013] If the current resource usage data includes a current memory usage rate, the first fuse condition is that the current memory usage rate is higher than a third threshold, and the first recovery condition is that the current memory usage rate is lower than a fourth threshold;

[0014] or,

[0015] If the current resource usage data includes the current CPU usage and the current memory usage, the first fuse condition is that the current CPU usage is higher than the first threshold or the current memory usage is higher than the third threshold, and the first recovery condition is that the current CPU usage is lower than the second threshold or the current memory usage is lower than the fourth threshold.

[0016] In a possible implementation, the method further includes:

[0017] After determining that there are at least a first number of first target servers among the N servers, and determining that the upper limit of concurrent transactions of the distributed system is higher than the first system concurrent number threshold, reducing the upper limit of concurrent transactions of the distributed system according to a second ratio, and updating the upper limit of concurrent transactions of each server according to the reduced upper limit of concurrent transactions of the distributed system, so that the reduced upper limit of concurrent transactions of the distributed system is equal to the sum of the upper limits of concurrent transactions of the N servers after the update; wherein the current resource usage data of the first target server reaches the second fuse condition;

[0018] After determining that there are at least a second number of second target servers among the N servers, and determining that the upper limit of transaction concurrency of the distributed system is lower than the target value of the first system concurrency, the upper limit of transaction concurrency of the distributed system is increased according to a second ratio, and based on the reduced upper limit of transaction concurrency of the distributed system, the upper limit of transaction concurrency of each server is updated, so that the increased upper limit of transaction concurrency of the distributed system is equal to the sum of the upper limits of transaction concurrency of the N servers after the update; wherein, the current resource usage data of the second target server meets the second recovery condition.

[0019] In a possible implementation, if the current resource usage data includes a current CPU usage rate, the second fuse condition is that the current CPU usage rate is higher than a fifth threshold, and the second recovery condition is that the current CPU usage rate is lower than a sixth threshold;

[0020] or,

[0021] If the current resource usage data includes a current memory usage rate, the second fuse condition is that the current memory usage rate is higher than a seventh threshold, and the second recovery condition is that the current memory usage rate is lower than an eighth threshold;

[0022] or,

[0023] If the current resource usage data includes the current CPU usage and the current memory usage, the second fuse condition is that the current CPU usage is higher than the fifth threshold or the current memory usage is higher than the seventh threshold, and the second recovery condition is that the current CPU usage is lower than the sixth threshold or the current memory usage is lower than the eighth threshold.

[0024] In a possible implementation, if the distributed system processes M transactions, the method further includes:

[0025] Obtaining the internal success rate of the system for the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, and M is a positive integer;

[0026] After determining that the system internal success rate of the j-th transaction code is lower than the first system success rate threshold, and determining that the system concurrent number upper limit of the j-th transaction code is higher than the system concurrent number threshold of the j-th transaction code, reducing the transaction concurrent number upper limit of the j-th transaction code according to a third ratio;

[0027] After determining that the system internal success rate of the j-th transaction code is higher than the second system success rate threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

[0028] In one possible implementation, if the distributed system processes M transactions and the jth transaction is processed by G in the distributed system j If the processing is performed by a server, the method further includes:

[0029] Get the g-th server success rate of the j-th transaction code; wherein the j-th transaction code is used to uniquely identify the j-th transaction; j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j is a positive integer;

[0030] After determining that the g-th server success rate of the j-th transaction code is lower than the first server success rate threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code, reducing the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio;

[0031] After determining that the g-th server success rate of the j-th transaction code is higher than the second server success rate threshold, and determining that the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code, the g-th server concurrency upper limit of the j-th transaction code is increased according to a fourth ratio.

[0032] In a possible implementation, if the distributed system processes M transactions, the method further includes:

[0033] Obtaining the system internal processing time of the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, and M is a positive integer;

[0034] After determining that the system internal processing time of the j-th transaction code is higher than the first system processing time threshold, and determining that the system concurrent number upper limit of the j-th transaction code is higher than the system concurrent number threshold of the j-th transaction code, reducing the transaction concurrent number upper limit of the j-th transaction code according to a third ratio;

[0035] After determining that the system internal processing time of the j-th transaction code is lower than the second system processing time threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

[0036] In one possible implementation, if the distributed system processes M transactions and the jth transaction is processed by G in the distributed system j If the processing is performed by a server, the method further includes:

[0037] Get the gth server processing time of the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j is a positive integer;

[0038] After determining that the g-th server processing time of the j-th transaction code is higher than the first server processing time threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code, reducing the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio;

[0039] After determining that the g-th server processing time of the j-th transaction code is lower than the second server processing time threshold, and determining that the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code, increase the g-th server concurrency upper limit of the j-th transaction code according to a fourth ratio.

[0040] In one possible implementation, if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes:

[0041] Get the response time of the fth associated transaction corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer;

[0042] After determining that the response time of the fth associated transaction corresponding to the jth transaction code exceeds the first associated transaction response time threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is higher than the upper limit of the number of concurrent transactions of the jth transaction code, reducing the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio;

[0043] After determining that the f-th associated transaction response time corresponding to the j-th transaction code is lower than the second associated transaction response time threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

[0044] In one possible implementation, if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes:

[0045] Get the response time of the fth associated transaction corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j, F j is a positive integer;

[0046] In determining the F j There are at least a third number of first target related transactions among the h related transactions, and it is determined that the hth related transactions j After the transaction concurrency upper limit of the first associated system exceeds the second system concurrency threshold, the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system; wherein the response time of the first target associated transaction exceeds the first associated transaction response time threshold;

[0047] In determining the F j There are at least a fourth number of second target related transactions among the related transactions, determining the F j The number of first target related transactions in the h related transactions is less than the third number, and it is determined that the hth related transaction j After the upper limit of the number of concurrent transactions of the first associated system is lower than the target value of the number of concurrent transactions of the second system, the hth associated system shall be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system is set; wherein the response time of the second target associated transaction is lower than the second associated transaction response time threshold.

[0048] In one possible implementation, if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes:

[0049] Obtain the success rate of the fth associated transaction system corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer;

[0050] After determining that the success rate of the fth associated transaction system corresponding to the jth transaction code is lower than the first associated transaction system success rate threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is higher than the upper limit of the number of concurrent transactions of the jth transaction code, reducing the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio;

[0051] After determining that the success rate of the f-th associated transaction system corresponding to the j-th transaction code is higher than the second associated transaction system success rate threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

[0052] In one possible implementation, if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes:

[0053] Obtain the success rate of the fth associated transaction system corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer;

[0054] In determining the F j There are at least a fifth number of third target related transactions among the h related transactions, and it is determined that the hth j After the transaction concurrency upper limit of the first associated system exceeds the second system concurrency threshold, the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system; wherein the system success rate of the third target associated transaction is lower than the system success rate threshold of the first associated transaction;

[0055] In determining the F j There are at least a sixth number of fourth target related transactions among the related transactions, determining the F j The number of the third target related transactions in the h related transactions is less than the fifth number, and it is determined that the hth j After the upper limit of the number of concurrent transactions of the first associated system is lower than the target value of the number of concurrent transactions of the second system, the hth associated system shall be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated systems; wherein the system success rate of the fourth target associated transaction is higher than the system success rate threshold of the second associated transaction.

[0056] The embodiment of the present application also provides a device for controlling the number of concurrent transactions, wherein the device for controlling the number of concurrent transactions is applied to a distributed system, wherein the distributed system includes N servers;

[0057] The transaction concurrent number control device comprises:

[0058] A first acquisition unit is used to acquire current resource usage data of the i-th server; wherein i is a positive integer, i≤N, and N is a positive integer;

[0059] a first reducing unit, configured to reduce the upper limit of the number of concurrent transactions of the i-th server according to a first ratio after determining that the current resource usage data of the i-th server reaches the first fuse condition and determining that the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold;

[0060] The first increasing unit is used to increase the upper limit of the number of concurrent transactions of the i-th server according to a first ratio after determining that the current resource usage data of the i-th server reaches the first recovery condition and determining that the upper limit of the number of concurrent transactions of the i-th server is lower than the target value of the number of concurrent transactions of a single server.

[0061] The present application also provides a device, the device comprising a processor and a memory:

[0062] The memory is used to store computer programs;

[0063] The processor is used to execute any implementation of the transaction concurrent number control method provided in the embodiments of the present application according to the computer program.

[0064] The embodiment of the present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute any implementation of the transaction concurrent number control method provided in the embodiment of the present application.

[0065] The embodiment of the present application also provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes any implementation of the method for controlling the number of concurrent transactions provided in the embodiment of the present application.

[0066] Compared with the prior art, the embodiments of the present application have at least the following advantages:

[0067] In the transaction concurrency control method applied to a distributed system provided in an embodiment of the present application, for the i-th server in the distributed system, the current resource usage data of the i-th server is obtained, and after determining that the current resource usage data of the i-th server reaches the first fuse condition and the upper limit of the transaction concurrency of the i-th server is higher than the single-server concurrency threshold, the upper limit of the transaction concurrency of the i-th server is reduced according to the first ratio; after determining that the current resource usage data of the i-th server reaches the first recovery condition and the upper limit of the transaction concurrency of the i-th server is lower than the single-server concurrency target value, the upper limit of the transaction concurrency of the i-th server is increased according to the first ratio. Wherein, i is a positive integer, i≤N, and N is a positive integer.

[0068] It can be seen that the embodiments of the present application can control the number of concurrent transactions for each server according to the current resource usage data of each server in the distributed system, so that the maximum number of transactions that each server can undertake can be more in line with the current resource level of each server. This can effectively reduce the impact of servers with slow processing speeds on the distributed system, thereby effectively avoiding the processing speed of the distributed system from being slowed down. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0070] Figure 1 A flowchart of a method for controlling the number of concurrent transactions provided in an embodiment of the present application;

[0071] Figure 2 A schematic diagram of the structure of a device for controlling the number of concurrent transactions provided in an embodiment of the present application. DETAILED DESCRIPTION

[0072] In order to facilitate the understanding and explanation of the technical solution of the present application, the technical terms involved in the present application are first introduced below.

[0073] The distributed system may include N servers, and the distributed system may process M transactions, where N is a positive integer and M is a positive integer.

[0074] Transaction concurrency control refers to preventing the transaction processing speed of the distributed system from slowing down by adjusting the transaction concurrency of the target object (for example, the distributed system, server, or transaction, etc.).

[0075] In their research on distributed systems, the inventors discovered that the impact of each server on the distributed system can be adjusted by controlling the number of concurrent transactions of each server in the distributed system. This can effectively reduce the impact of components with slowed processing speeds (for example, servers) on the above-mentioned distributed system, thereby effectively preventing the processing speed of the distributed system from being slowed down.

[0076] Based on this discovery, an embodiment of the present application provides a method for controlling the number of concurrent transactions, which includes: obtaining the current resource usage data of the i-th server, and after determining that the current resource usage data of the i-th server reaches the first fuse condition and the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold, reducing the upper limit of the number of concurrent transactions of the i-th server according to the first ratio; after determining that the current resource usage data of the i-th server reaches the first recovery condition and the upper limit of the number of concurrent transactions of the i-th server is lower than the single-server concurrent number target value, increasing the upper limit of the number of concurrent transactions of the i-th server according to the first ratio. Wherein, i is a positive integer, i≤N, and N is a positive integer.

[0077] It can be seen that the embodiments of the present application can control the number of concurrent transactions for each server according to the current resource usage data of each server in the distributed system, so that the maximum number of transactions that each server can undertake can be more in line with the current resource level of each server. This can effectively reduce the impact of servers with slow processing speeds on the distributed system, thereby effectively avoiding the processing speed of the distributed system from being slowed down.

[0078] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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.

[0079] Method Embodiment

[0080] See also Figure 1 , which is a flow chart of a method for controlling the number of concurrent transactions provided in an embodiment of the present application.

[0081] The method for controlling the number of concurrent transactions provided in the embodiment of the present application includes S1-S3:

[0082] S1: Get the current resource usage data of the i-th server, where i is a positive integer, i≤N, and N is a positive integer.

[0083] The current resource usage data of the i-th server is used to describe the resource level (e.g., resource usage degree, etc.) of the i-th server at the current moment. In addition, the embodiments of the present application do not limit the current resource usage data. For example, the current resource usage data may include the current CPU (central processing unit) usage rate and / or the current memory usage rate.

[0084] In addition, the embodiment of the present application does not limit the method for obtaining the current resource usage data of the i-th server. For example, the current resource usage data of the i-th server can be determined based on the resource usage information of the i-th server in the first time period. The end time point of the first time period is the current time, and the duration of the first time period can be preset, that is, the first time period can be expressed as [T 当 +L1,T 当 ].

[0085] In addition, the embodiment of the present application does not limit the time for obtaining the current resource usage data of the i-th server. For example, the data can be obtained at a preset time interval (eg, L2).

[0086] Based on the relevant content of S1 above, it can be known that the concurrent transaction number control can be repeated for each server at a preset time interval; and for the current round of concurrent transaction number control process of each server, the current resource usage data of each server (such as the current CPU usage rate or the current memory usage rate) can be obtained first, so that the corresponding concurrent transaction number upper limit control can be performed on each server based on the current resource usage data of each server.

[0087] S2: After determining that the current resource usage data of the i-th server reaches the first circuit breaker condition and determining that the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold, reduce the upper limit of the number of concurrent transactions of the i-th server according to the first ratio. Wherein, i is a positive integer, i≤N, and N is a positive integer.

[0088] The first fuse condition refers to the condition required to reduce the number of concurrent transactions on a single server; and the embodiment of the present application does not limit the first fuse condition. For ease of understanding, the following is an explanation with three examples.

[0089] Example 1: If the current resource usage data includes the current CPU usage rate, the first fuse condition may be that the current CPU usage rate is higher than the first threshold value.

[0090] It can be seen that when the current resource usage data includes the current CPU usage rate, if the current CPU usage rate of the i-th server is higher than the first threshold, it means that the current resource usage data of the i-th server reaches the first fuse condition.

[0091] Example 2: If the current resource usage data includes the current memory usage rate, the first fuse condition is that the current memory usage rate is higher than the third threshold.

[0092] It can be seen that when the current resource usage data includes the current memory usage rate, if the current memory usage rate of the i-th server is higher than the third threshold, it means that the current resource usage data of the i-th server reaches the first fuse condition.

[0093] Example three, if the current resource usage data includes the current CPU usage and the current memory usage, the first fuse condition is that the current CPU usage is higher than the first threshold or the current memory usage is higher than the third threshold.

[0094] It can be seen that when the current resource usage data includes the current CPU usage rate and the current memory usage rate, if the current CPU usage rate of the i-th server is higher than the first threshold, or the current memory usage rate of the i-th server is higher than the third threshold, it means that the current resource usage data of the i-th server reaches the first fuse condition.

[0095] The upper limit of concurrent transactions of the ith server refers to the maximum number of transactions that the ith server can process simultaneously.

[0096] The single-server concurrent number threshold refers to the pre-set minimum number of transactions allowed to be processed simultaneously by a server; moreover, the embodiment of the present application does not limit the single-server concurrent number threshold, for example, the single-server concurrent number threshold can be 0.

[0097] The first ratio can be preset according to the application scenario.

[0098] Based on the relevant content of S2 above, it can be known that for the current round of transaction concurrency control process of the i-th server in the distributed system, after obtaining the current resource usage data of the i-th server, it can be determined whether the current resource usage data of the i-th server reaches the first fuse condition. If so, it can be further determined whether the transaction concurrency upper limit of the i-th server is higher than the single-server concurrency threshold. If higher, the transaction concurrency upper limit of the i-th server can be reduced according to the first ratio, so that the transaction concurrency upper limit of the i-th server after reduction = the transaction concurrency upper limit of the i-th server before reduction × (1-first ratio).

[0099] It should be noted that, in some cases, if it is determined that the current resource usage data of the ith server reaches the first circuit breaker condition, but it is determined that the upper limit of the number of concurrent transactions of the ith server is not higher than the single-server concurrent number threshold, the upper limit of the number of concurrent transactions of the ith server can be kept unchanged, so that the upper limit of the number of concurrent transactions of the ith server will never be lower than the single-server concurrent number threshold.

[0100] S3: After determining that the current resource usage data of the i-th server meets the first recovery condition and determining that the upper limit of the number of concurrent transactions of the i-th server is lower than the single-server concurrent number target value, increase the upper limit of the number of concurrent transactions of the i-th server according to the first ratio. Wherein, i is a positive integer, i≤N, and N is a positive integer.

[0101] The first recovery condition refers to the condition that needs to be met to control the increase of the number of concurrent transactions on a single server; and the embodiment of the present application does not limit the first recovery condition. For ease of understanding, the following is an explanation with three examples.

[0102] Example 1: If the current resource usage data includes the current CPU usage rate, the first recovery condition may be that the current CPU usage rate is lower than the second threshold.

[0103] It can be seen that when the current resource usage data includes the current CPU usage rate, if the current CPU usage rate of the i-th server is lower than the second threshold, it means that the current resource usage data of the i-th server meets the first recovery condition.

[0104] Example 2: If the current resource usage data includes the current memory usage rate, the first recovery condition may be that the current memory usage rate is lower than the fourth threshold.

[0105] It can be seen that when the current resource usage data includes the current memory usage rate, if the current memory usage rate of the i-th server is lower than the fourth threshold, it means that the current resource usage data of the i-th server meets the first recovery condition.

[0106] Example 3: If the current resource usage data includes the current CPU usage and the current memory usage, the first recovery condition may be that the current CPU usage is lower than the second threshold or the current memory usage is lower than the fourth threshold.

[0107] It can be seen that when the current resource usage data includes the current CPU usage rate and the current memory usage rate, if the current CPU usage rate of the i-th server is lower than the second threshold, or the current memory usage rate of the i-th server is lower than the fourth threshold, it means that the current resource usage data of the i-th server meets the first recovery condition.

[0108] The single-server concurrent target value refers to the pre-set maximum number of transactions allowed to be processed simultaneously by a server; moreover, the embodiment of the present application does not limit the single-server concurrent target value.

[0109] Based on the relevant content of S2 above, it can be known that for the current round of transaction concurrency control process of the i-th server in the distributed system, after obtaining the current resource usage data of the i-th server, it can be determined whether the current resource usage data of the i-th server meets the first recovery condition. If so, it can be further determined whether the transaction concurrency upper limit of the i-th server is lower than the single-server concurrency target value. If so, the transaction concurrency upper limit of the i-th server can be increased according to the first ratio, so that the transaction concurrency upper limit of the i-th server after the increase = the transaction concurrency upper limit of the i-th server before the increase × (1 + first ratio).

[0110] It should be noted that, in some cases, if it is determined that the current resource usage data of the ith server reaches the first recovery condition, but it is determined that the upper limit of the number of concurrent transactions of the ith server is equal to the single-server concurrent number threshold, the upper limit of the number of concurrent transactions of the ith server can be kept unchanged, so that the upper limit of the number of concurrent transactions of the ith server will never exceed the single-server concurrent number target value.

[0111] Based on the above S1 to S3, it can be known that for the i-th server in the distributed system, the current resource usage data of the i-th server is obtained, and after determining that the current resource usage data of the i-th server reaches the first fuse condition and the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold, the upper limit of the number of concurrent transactions of the i-th server is reduced according to the first ratio; after determining that the current resource usage data of the i-th server reaches the first recovery condition and the upper limit of the number of concurrent transactions of the i-th server is lower than the single-server concurrent number target value, the upper limit of the number of concurrent transactions of the i-th server is increased according to the first ratio. Wherein, i is a positive integer, i≤N, and N is a positive integer.

[0112] It can be seen that the embodiments of the present application can control the number of concurrent transactions for each server according to the current resource usage data of each server in the distributed system, so that the maximum number of transactions that each server can undertake is more in line with the current resource level of each server. This can effectively reduce the impact of the server with slow processing speed on the distributed system, thereby effectively avoiding the processing speed of the distributed system from being slowed down.

[0113] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation of the method for controlling the number of concurrent transactions. In this implementation, in addition to the above S1-S3, the method for controlling the number of concurrent transactions may also include S4-S5:

[0114] S4: After determining that there are at least a first number of first target servers among the N servers, and determining that the upper limit of concurrent transactions of the distributed system is higher than the first system concurrent transaction threshold, reduce the upper limit of concurrent transactions of the distributed system according to a second ratio, and update the upper limit of concurrent transactions of each server according to the reduced upper limit of concurrent transactions of the distributed system, so that the reduced upper limit of concurrent transactions of the distributed system is equal to the sum of the upper limits of concurrent transactions of the N servers after the update.

[0115] Among them, the current resource usage data of the first target server reaches the second fuse condition.

[0116] The second circuit breaker condition refers to the condition that a single server needs to meet when controlling the number of concurrent transactions in a distributed system; and the second circuit breaker condition is not limited in the embodiment of the present application. For ease of understanding, the following is an explanation with three examples.

[0117] Example 1: If the current resource usage data includes the current CPU usage rate, the second fuse condition may be that the current CPU usage rate is higher than the fifth threshold.

[0118] It can be seen that when the current resource usage data includes the current CPU usage rate, if the current CPU usage rate of the qth server is higher than the fifth threshold, it means that the current resource usage data of the qth server reaches the second fuse condition. Wherein, q is a positive integer, q≤N, and N is a positive integer.

[0119] It should be noted that the embodiment of the present application does not limit the magnitude relationship between the fifth threshold and the first threshold mentioned above. For example, in a possible implementation manner, the fifth threshold is less than the first threshold mentioned above.

[0120] Example 2: If the current resource usage data includes the current memory usage rate, the second fuse condition is that the current memory usage rate is higher than the seventh threshold.

[0121] It can be seen that when the current resource usage data includes the current memory usage rate, if the current memory usage rate of the qth server is higher than the third threshold, it means that the current resource usage data of the qth server reaches the second fuse condition. Wherein, q is a positive integer, q≤N, and N is a positive integer.

[0122] It should be noted that the embodiment of the present application does not limit the magnitude relationship between the seventh threshold and the second threshold mentioned above. For example, in a possible implementation manner, the seventh threshold is less than the second threshold mentioned above.

[0123] Example three, if the current resource usage data includes the current CPU usage and the current memory usage, the second fuse condition is that the current CPU usage is higher than the fifth threshold or the current memory usage is higher than the seventh threshold.

[0124] It can be seen that when the current resource usage data includes the current CPU usage rate and the current memory usage rate, if the current CPU usage rate of the qth server is higher than the fifth threshold, or the current memory usage rate of the qth server is higher than the seventh threshold, it means that the current resource usage data of the qth server reaches the second fuse condition. Wherein, q is a positive integer, q≤N, and N is a positive integer.

[0125] The first number can be preset according to the application scenario.

[0126] The upper limit of concurrent transactions of a distributed system refers to the maximum number of transactions that the distributed system can process simultaneously; and the upper limit of concurrent transactions of a distributed system is equal to the sum of the upper limits of concurrent transactions of the first server to the Nth server in the distributed system.

[0127] The first system concurrency threshold refers to the pre-set minimum number of transactions that the distributed system is allowed to process simultaneously; moreover, the embodiment of the present application does not limit the first system concurrency threshold, for example, the first system concurrency threshold may be 0.

[0128] The second ratio can be preset according to the application scenario.

[0129] Based on the relevant content of S4 above, it can be known that for the current round of transaction concurrency control process of the distributed system, after obtaining the current resource usage data of each server in the distributed system, first determine whether the current resource usage data of the qth server reaches the second fuse condition, and if the second fuse condition is reached, determine the qth server as the first target server; where q is a positive integer, q≤N. Then, determine whether the number of the first target server reaches the first number, and if it reaches the first number, it can be further determined whether the upper limit of the transaction concurrency of the distributed system is higher than the first system concurrency threshold, and if it is higher than the first system concurrency threshold, first reduce the upper limit of the transaction concurrency of the distributed system according to the second ratio, so that the lowered upper limit of the transaction concurrency of the distributed system = the upper limit of the transaction concurrency of the distributed system before the reduction × (1-second ratio); then update the upper limit of the transaction concurrency of each server according to the lowered upper limit of the transaction concurrency of the distributed system, so that the lowered upper limit of the transaction concurrency of the distributed system is equal to the sum of the upper limits of the transaction concurrency of the N servers after the update.

[0130] It should be noted that, in some cases, if it is determined that there are at least a first number of first target servers among the N servers, but it is determined that the upper limit of the number of concurrent transactions of the distributed system is not higher than the first system concurrency threshold, then the upper limit of the number of concurrent transactions of the distributed system can be kept unchanged so that the upper limit of the number of concurrent transactions of the distributed system will never be lower than the first system concurrency threshold.

[0131] S5: After determining that there are at least a second number of second target servers among the N servers, and determining that the upper limit of transaction concurrency of the distributed system is lower than the target value of the first system concurrency, increase the upper limit of transaction concurrency of the distributed system according to the second ratio, and update the upper limit of transaction concurrency of each server according to the reduced upper limit of transaction concurrency of the distributed system, so that the increased upper limit of transaction concurrency of the distributed system is equal to the sum of the upper limits of transaction concurrency of the N servers after the update.

[0132] Among them, the current resource usage data of the second target server reaches the second recovery condition.

[0133] The second recovery condition refers to the condition that a single server needs to meet when controlling the increase of concurrent transactions in a distributed system; and the second recovery condition is not limited in the embodiment of the present application. For ease of understanding, the following is an explanation with three examples.

[0134] Example 1: if the current resource usage data includes the current CPU usage rate, the second recovery condition may be that the current CPU usage rate is lower than the sixth threshold.

[0135] It can be seen that when the current resource usage data includes the current CPU usage rate, if the current CPU usage rate of the qth server is lower than the second threshold, it means that the current resource usage data of the qth server meets the second recovery condition.

[0136] Example 2: If the current resource usage data includes the current memory usage rate, the second recovery condition may be that the current memory usage rate is lower than the eighth threshold.

[0137] It can be seen that when the current resource usage data includes the current memory usage rate, if the current memory usage rate of the qth server is lower than the fourth threshold, it means that the current resource usage data of the qth server meets the second recovery condition.

[0138] Example 3: If the current resource usage data includes the current CPU usage and the current memory usage, the second recovery condition may be that the current CPU usage is lower than the sixth threshold or the current memory usage is lower than the eighth threshold.

[0139] It can be seen that when the current resource usage data includes the current CPU usage rate and the current memory usage rate, if the current CPU usage rate of the qth server is lower than the second threshold, or the current memory usage rate of the qth server is lower than the fourth threshold, it means that the current resource usage data of the qth server meets the second recovery condition. Wherein, q is a positive integer, q≤N.

[0140] The second number can be preset according to the application scenario.

[0141] The first system concurrency target value refers to the pre-set maximum number of transactions that the distributed system is allowed to process simultaneously; moreover, the embodiment of the present application does not limit the first system concurrency target value.

[0142] Based on the relevant content of S4 above, it can be known that for the current round of transaction concurrency control process of the distributed system, after obtaining the current resource usage data of each server in the distributed system, first determine whether the current resource usage data of the qth server meets the second recovery condition. If the second recovery condition is met, the qth server is determined as the second target server; wherein q is a positive integer, q≤N. Then, determine whether the number of the second target servers reaches the second number. If the second number is reached, it can be determined whether the upper limit of the transaction concurrency of the distributed system is lower than the first system concurrency target value. If it is lower than the first system concurrency target value, first increase the upper limit of the transaction concurrency of the distributed system according to the second ratio, so that the upper limit of the transaction concurrency of the distributed system after the increase = the upper limit of the transaction concurrency of the distributed system before the increase × (1+second ratio); then update the upper limit of the transaction concurrency of each server according to the upper limit of the transaction concurrency of the distributed system after the increase, so that the upper limit of the transaction concurrency of the distributed system after the increase is equal to the sum of the upper limits of the transaction concurrency of the N servers after the update.

[0143] It should be noted that, in some cases, if it is determined that there are at least a second number of second target servers among the N servers, but it is determined that the upper limit of the number of concurrent transactions of the distributed system is equal to the target value of the number of concurrent transactions of the first system, then the upper limit of the number of concurrent transactions of the distributed system can be kept unchanged so that the upper limit of the number of concurrent transactions of the distributed system will never exceed the target value of the number of concurrent transactions of the first system.

[0144] Based on the relevant contents of S4 to S5 above, it can be known that the embodiment of the present application can control the number of concurrent transactions of the distributed system according to the current resource usage data of each server in the distributed system, so that the maximum number of transactions undertaken by the distributed system is more in line with the transaction processing capacity of the distributed system, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0145] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation of the transaction concurrency control method. In this implementation, if the distributed system processes M transactions, the transaction concurrency control method may further include S6-S8 in addition to all or part of the steps S1-S5 above:

[0146] S6: Obtain the internal success rate of the jth transaction code, where j is a positive integer, j≤M, and M is a positive integer.

[0147] The jth transaction code is used to uniquely identify the jth transaction; and the embodiment of the present application does not limit the jth transaction code.

[0148] The system internal success rate of the jth transaction code refers to the probability that the distributed system successfully completes the processing of the jth transaction. Moreover, the embodiment of the present application does not limit the method for obtaining the system internal success rate of the jth transaction code. For example, the system internal success rate of the jth transaction code can be determined based on the processing result of the distributed system on the jth transaction code within the first time period (for example, successful completion or failure).

[0149] In addition, the embodiment of the present application does not limit the time for obtaining the internal system success rate of the j-th transaction code. For example, it can be obtained at a preset time interval (such as L2).

[0150] Based on the relevant content of S6 above, it can be known that the concurrency control can be repeated for each transaction in the distributed system at a preset time interval; and for the current round of concurrency control process for each transaction, the system internal success rate of the transaction code corresponding to each transaction can be obtained first, so that the corresponding concurrency control can be performed on each transaction according to the system internal success rate of each transaction code.

[0151] S7: After determining that the internal success rate of the jth transaction code is lower than the first system success rate threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is higher than the upper limit of the number of concurrent transactions of the jth transaction code, reducing the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio, where j is a positive integer, j≤M, and M is a positive integer.

[0152] The first system success rate threshold may be pre-set according to an application scenario.

[0153] The upper limit of system concurrency for the jth transaction code refers to the maximum number of jth transactions that the distributed system can process simultaneously.

[0154] The system concurrency threshold of the j-th transaction code refers to the pre-set minimum number of transactions that the distributed system is allowed to process simultaneously. Moreover, the embodiment of the present application does not limit the system concurrency threshold of the j-th transaction code. For example, the system concurrency threshold of the j-th transaction code may be 0.

[0155] The third ratio can be set in advance according to the application scenario.

[0156] Based on the relevant content of S7 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the system internal success rate of the j-th transaction code, it can be determined whether the system internal success rate of the j-th transaction code is lower than the first system success rate threshold. If it is lower than the first system success rate threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is higher than the system concurrency threshold of the j-th transaction code. If it is higher than the system concurrency threshold of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be reduced according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the reduction = the transaction concurrency upper limit of the j-th transaction code before the reduction × (1-third ratio).

[0157] It should be noted that, in some cases, if it is determined that the system internal success rate of the j-th transaction code is lower than the first system success rate threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not higher than the system concurrency threshold of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never be lower than the system concurrency threshold of the j-th transaction code.

[0158] S8: After determining that the internal system success rate of the jth transaction code is higher than the second system success rate threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is lower than the target value of the number of concurrent transactions of the jth transaction code, increase the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio, where j is a positive integer, j≤M, and M is a positive integer.

[0159] The second system success rate threshold can be set in advance according to the application scenario. It should be noted that the embodiment of the present application does not limit the size relationship between the second system success rate threshold and the first system success rate threshold above. For example, the second system success rate threshold can be equal to the first system success rate threshold above, or can be higher than the first system success rate threshold above.

[0160] The system concurrency target value of the j-th transaction code refers to the pre-set maximum number of transactions that the distributed system is allowed to process simultaneously; and the embodiment of the present application does not limit the system concurrency target value of the j-th transaction code.

[0161] Based on the relevant content of S8 above, for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the system internal success rate of the j-th transaction code, it can be determined whether the system internal success rate of the j-th transaction code is higher than the second system success rate threshold. If it is higher than the second system success rate threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code. If it is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be increased according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the increase = the transaction concurrency upper limit of the j-th transaction code before the increase × (1 + the third ratio).

[0162] It should be noted that, in some cases, if it is determined that the system internal success rate of the j-th transaction code is higher than the second system success rate threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not lower than the system concurrency target value of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never exceed the system concurrency target value of the j-th transaction code.

[0163] Based on the relevant contents of S6 to S8 above, it can be known that the embodiment of the present application can control the system concurrency of each transaction in the distributed system according to the system internal success rate of each transaction in the distributed system, so that the number of transactions simultaneously undertaken by the distributed system is more in line with the processing capacity of the distributed system for each transaction, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0164] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation method of the transaction concurrency control method. In this implementation method, if the distributed system processes M transactions and the jth transaction is processed by G in the distributed system, j If the transaction is processed by multiple servers, the method for controlling the number of concurrent transactions may further include S9-S11 in addition to all or part of the steps S1-S8 above:

[0165] S9: Obtain the success rate of the gth server for the jth transaction code. Where j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j Is a positive integer.

[0166] Among them, the g-th server success rate of the j-th transaction code refers to the above G jThe probability that the gth server among the servers successfully processes the jth transaction; moreover, the embodiment of the present application does not limit the method for obtaining the success rate of the gth server of the jth transaction code. For example, the success rate of the gth server of the jth transaction code can be determined based on the processing result of the jth transaction code by the gth server in the first time period in the distributed system.

[0167] Based on the relevant content of S9 above, it can be known that the concurrency control can be repeated for each transaction in the distributed system at a preset time interval; and for the current round of concurrency control process for each transaction, the g-th server success rate of the j-th transaction code can be obtained first, so that the corresponding concurrency control can be performed on the j-th transaction based on the g-th server success rate of the j-th transaction code.

[0168] S10: After determining that the g-th server success rate of the j-th transaction code is lower than the first server success rate threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code, reduce the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j Is a positive integer.

[0169] Among them, the first server success rate threshold can be set in advance according to the application scenario.

[0170] The upper limit of concurrent transactions on the gth server for the jth transaction code is the G j The maximum number of transactions that the gth server can process simultaneously among the jth servers.

[0171] The g-th server concurrency threshold for the j-th transaction code refers to the pre-set threshold that allows the above G j The minimum number of transactions that the g-th server among the servers processes simultaneously for the j-th transaction; and the embodiment of the present application does not limit the concurrent number threshold of the g-th server for the j-th transaction code. For example, the concurrent number threshold of the g-th server for the j-th transaction code may be 0.

[0172] The fourth ratio may be set in advance according to the application scenario.

[0173] Based on the relevant content of S10 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the g-th server success rate of the j-th transaction code, it can be determined whether the g-th server success rate of the j-th transaction code is lower than the first server success rate threshold. If it is lower than the first server success rate threshold, it can be further determined whether the g-th server concurrency upper limit of the j-th transaction code is higher than the g-th server concurrency threshold of the j-th transaction code. If it is higher than the g-th server concurrency threshold of the j-th transaction code, the g-th server concurrency upper limit of the j-th transaction code can be reduced according to the fourth ratio, so that the g-th server concurrency upper limit of the j-th transaction code after the reduction = the g-th server concurrency upper limit of the j-th transaction code before the reduction × (1-fourth ratio).

[0174] It should be noted that, in some cases, if it is determined that the success rate of the g-th server of the j-th transaction code is lower than the first server success rate threshold, but it is determined that the g-th server concurrency upper limit of the j-th transaction code is not higher than the g-th server concurrency threshold of the j-th transaction code, then the g-th server concurrency upper limit of the j-th transaction code will remain unchanged, so that the g-th server concurrency upper limit of the j-th transaction code will never be lower than the g-th server concurrency threshold of the j-th transaction code.

[0175] S11: after determining that the g-th server success rate of the j-th transaction code is higher than the second server success rate threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is lower than the g-th server concurrent number target value of the j-th transaction code, increase the g-th server concurrent number upper limit of the j-th transaction code according to the fourth ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j Is a positive integer.

[0176] The second server success rate threshold can be set in advance according to the application scenario. It should be noted that the embodiment of the present application does not limit the size relationship between the second server success rate threshold and the first server success rate threshold above. For example, the second server success rate threshold can be equal to the first server success rate threshold above, or can be higher than the first server success rate threshold above.

[0177] The g-th server concurrent number target value for the j-th transaction code refers to the pre-set value that allows the above G j The maximum number of transactions that can be processed simultaneously by the g-th server among the servers; and the embodiment of the present application does not limit the concurrent number target value of the g-th server for the j-th transaction code.

[0178] Based on the relevant content of S11 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the g-th server success rate of the j-th transaction code, it can be determined whether the g-th server success rate of the j-th transaction code is higher than the second server success rate threshold. If it is higher than the second server success rate threshold, it can be further determined whether the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code. If it is lower than the g-th server concurrency target value of the j-th transaction code, the g-th server concurrency upper limit of the j-th transaction code can be increased according to the fourth ratio, so that the g-th server concurrency upper limit of the j-th transaction code after the increase = the g-th server concurrency upper limit of the j-th transaction code before the increase × (1+fourth ratio).

[0179] It should be noted that, in some cases, if it is determined that the g-th server success rate of the j-th transaction code is higher than the second server success rate threshold, but it is determined that the g-th server concurrency upper limit of the j-th transaction code is not lower than the g-th server concurrency target value of the j-th transaction code, then the g-th server concurrency upper limit of the j-th transaction code will remain unchanged, so that the g-th server concurrency upper limit of the j-th transaction code will never exceed the g-th server concurrency target value of the j-th transaction code.

[0180] Based on the relevant contents of S9 to S11 above, it can be known that the embodiment of the present application can control the server concurrency number of each transaction in the distributed system according to the server success rate of each transaction in the distributed system, so that the number of transactions simultaneously undertaken by the server in the distributed system is more in line with the processing capacity of the server for the transaction, thereby effectively avoiding a reduction in the transaction processing speed of the server, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0181] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation of the transaction concurrency control method. In this implementation, if the distributed system processes M transactions, the transaction concurrency control method may further include S12-S14 in addition to all or part of the steps S1-S11 above:

[0182] S12: Obtain the system internal processing time of the j-th transaction code; wherein j is a positive integer, j≤M, and M is a positive integer.

[0183] The system internal processing time of the j-th transaction code refers to the time required for the distributed system to process the j-th transaction. Moreover, the embodiment of the present application does not limit the method for obtaining the system internal processing time of the j-th transaction code. For example, the system internal processing time of the j-th transaction code can be determined by the processing time of the j-th transaction code by the distributed system within a first time period.

[0184] In addition, the embodiment of the present application does not limit the time for obtaining the system internal processing time of the j-th transaction code. For example, it can be obtained according to a preset time interval (such as L2).

[0185] Based on the relevant content of S6 above, it can be known that the concurrency control can be repeated for each transaction in the distributed system at a preset time interval; and for the current round of concurrency control process for each transaction, the system internal processing time of the transaction code corresponding to each transaction can be obtained first, so that the corresponding concurrency control can be performed on each transaction according to the system internal processing time of each transaction code.

[0186] S13: after determining that the system internal processing time of the j-th transaction code is higher than the first system processing time threshold, and determining that the system concurrency upper limit of the j-th transaction code is higher than the system concurrency threshold of the j-th transaction code, reducing the transaction concurrency upper limit of the j-th transaction code according to a third ratio.

[0187] The first system processing time threshold may be pre-set according to an application scenario.

[0188] Based on the relevant content of S13 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the system internal processing time of the j-th transaction code, it can be determined whether the system internal processing time of the j-th transaction code is higher than the first system processing time threshold. If it is higher than the first system processing time threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is higher than the system concurrency threshold of the j-th transaction code. If it is higher than the system concurrency threshold of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be reduced according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the reduction = the transaction concurrency upper limit of the j-th transaction code before the reduction × (1-third ratio).

[0189] It should be noted that, in some cases, if it is determined that the system internal processing time of the j-th transaction code is higher than the first system processing time threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not higher than the system concurrency threshold of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never be lower than the system concurrency threshold of the j-th transaction code.

[0190] S14: after determining that the system internal processing time of the j-th transaction code is lower than the second system processing time threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, increase the transaction concurrency upper limit of the j-th transaction code according to the third ratio.

[0191] The second system processing time threshold can be set in advance according to the application scenario. It should be noted that the embodiment of the present application does not limit the size relationship between the second system processing time threshold and the first system processing time threshold above. For example, the second system processing time threshold can be equal to the first system processing time threshold above, or can be lower than the first system processing time threshold above.

[0192] Based on the relevant content of S14 above, for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the system internal processing time of the j-th transaction code, it can be determined whether the system internal processing time of the j-th transaction code is lower than the second system processing time threshold. If it is lower than the second system processing time threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code. If it is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be increased according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the increase = the transaction concurrency upper limit of the j-th transaction code before the increase × (1 + the third ratio).

[0193] It should be noted that, in some cases, if it is determined that the system internal processing time of the j-th transaction code is lower than the second system processing time threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not lower than the system concurrency target value of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never exceed the system concurrency target value of the j-th transaction code.

[0194] Based on the relevant contents of S12 to S14 above, it can be known that the embodiment of the present application can control the system concurrency of each transaction in the distributed system according to the system internal processing time of each transaction in the distributed system, so that the number of transactions simultaneously undertaken by the distributed system is more in line with the processing capacity of the distributed system for each transaction, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0195] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation method of the transaction concurrency control method. In this implementation method, if the distributed system processes M transactions and the jth transaction is processed by G in the distributed system, jIf the transaction is processed by a server, the method for controlling the number of concurrent transactions may further include S15-S17 in addition to all or part of the steps S1-S14 above:

[0196] S15: Obtain the gth server processing time of the jth transaction code. Wherein, j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j Is a positive integer.

[0197] The g-th server processing time of the j-th transaction code refers to the G j The time required for the g-th server among the servers to process the j-th transaction; moreover, the embodiment of the present application does not limit the method for obtaining the processing time of the g-th server for the j-th transaction code. For example, the processing time of the g-th server for the j-th transaction code within the first time period in the distributed system can be used to determine the processing time of the g-th server for the j-th transaction code.

[0198] Based on the relevant content of S15 above, it can be known that the concurrency control can be repeated for each transaction in the distributed system at a preset time interval; and for the current round of concurrency control process for each transaction, the g-th server processing time of the j-th transaction code can be obtained first, so that the corresponding concurrency control can be performed on the j-th transaction according to the g-th server processing time of the j-th transaction code.

[0199] S16: after determining that the g-th server processing time of the j-th transaction code is higher than the first server processing time threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code, reducing the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j Is a positive integer.

[0200] The first server processing time threshold may be pre-set according to the application scenario.

[0201] Based on the relevant content of S16 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the g-th server processing time of the j-th transaction code, it can be determined whether the g-th server processing time of the j-th transaction code is higher than the first server processing time threshold. If it is higher than the first server processing time threshold, it can be further determined whether the g-th server concurrency upper limit of the j-th transaction code is higher than the g-th server concurrency threshold of the j-th transaction code. If it is higher than the g-th server concurrency threshold of the j-th transaction code, the g-th server concurrency upper limit of the j-th transaction code can be reduced according to the fourth ratio, so that the g-th server concurrency upper limit of the j-th transaction code after the reduction = the g-th server concurrency upper limit of the j-th transaction code before the reduction × (1-fourth ratio).

[0202] It should be noted that, in some cases, if it is determined that the g-th server processing time of the j-th transaction code is higher than the first server processing time threshold, but it is determined that the g-th server concurrency upper limit of the j-th transaction code is not higher than the g-th server concurrency threshold of the j-th transaction code, then the g-th server concurrency upper limit of the j-th transaction code will remain unchanged, so that the g-th server concurrency upper limit of the j-th transaction code will never be lower than the g-th server concurrency threshold of the j-th transaction code.

[0203] S17: after determining that the g-th server processing time of the j-th transaction code is lower than the second server processing time threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is lower than the g-th server concurrent number target value of the j-th transaction code, increase the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j Is a positive integer.

[0204] The second server processing time threshold can be set in advance according to the application scenario. It should be noted that the embodiment of the present application does not limit the size relationship between the second server processing time threshold and the first server processing time threshold above. For example, the second server processing time threshold can be equal to the first server processing time threshold above, or can be lower than the first server processing time threshold above.

[0205] Based on the relevant content of S17 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the g-th server processing time of the j-th transaction code, it can be determined whether the g-th server processing time of the j-th transaction code is lower than the second server processing time threshold. If it is lower than the second server processing time threshold, it can be further determined whether the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code. If it is lower than the g-th server concurrency target value of the j-th transaction code, the g-th server concurrency upper limit of the j-th transaction code can be increased according to the fourth ratio, so that the g-th server concurrency upper limit of the j-th transaction code after the increase = the g-th server concurrency upper limit of the j-th transaction code before the increase × (1+fourth ratio).

[0206] It should be noted that, in some cases, if it is determined that the g-th server processing time of the j-th transaction code is lower than the second server processing time threshold, but it is determined that the g-th server concurrency upper limit of the j-th transaction code is not lower than the g-th server concurrency target value of the j-th transaction code, then the g-th server concurrency upper limit of the j-th transaction code will remain unchanged, so that the g-th server concurrency upper limit of the j-th transaction code will never exceed the g-th server concurrency target value of the j-th transaction code.

[0207] Based on the relevant contents of S15 to S17 above, it can be known that the embodiment of the present application can control the server concurrency of each transaction in the distributed system according to the server processing time of each transaction in the distributed system, so that the number of transactions simultaneously undertaken by the server in the distributed system is more in line with the processing capacity of the server for the transaction, thereby effectively avoiding a reduction in the transaction processing speed of the server, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0208] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation method of the transaction concurrency control method. In this implementation method, if the distributed system processes M transactions and the distributed system uses the hth transaction, j The associated system provides j If a related transaction processes the jth transaction, the method for controlling the number of concurrent transactions may further include S18-S20 in addition to all or part of the steps S1-S17 above:

[0209] S18: Obtain the response time of the fth associated transaction corresponding to the jth transaction code. Where j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0210] The response time of the fth associated transaction corresponding to the jth transaction code refers to the time when the distributed system processes the jth transaction by the hth transaction code associated with the distributed system. j The time required for the associated system to respond to the distributed system for the fth associated transaction.

[0211] It should be noted that the above F j All related transactions are initiated by j The associated system processes the associated transaction request triggered when the distributed system processes the jth transaction, and the above F can be used when the distributed system processes the jth transaction in the future. j The processing results of related-party transactions.

[0212] Based on the relevant content of S18 above, it can be known that the concurrency control can be repeated for each transaction in the distributed system at a preset time interval; and for the current round of concurrency control process for each transaction, the f-th associated transaction response time corresponding to the j-th transaction code can be obtained first, so that the concurrency control of the j-th transaction can be performed accordingly based on the f-th associated transaction response time corresponding to the j-th transaction code.

[0213] S19: After determining that the response time of the fth associated transaction corresponding to the jth transaction code exceeds the first associated transaction response time threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is higher than the threshold of the number of concurrent transactions of the jth transaction code, reduce the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0214] The first associated transaction response time threshold may be pre-set according to an application scenario.

[0215] Based on the relevant content of S19 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the f-th associated transaction response time corresponding to the j-th transaction code, it can be determined whether the f-th associated transaction response time corresponding to the j-th transaction code exceeds the first associated transaction response time threshold. If it exceeds the first associated transaction response time threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is higher than the system concurrency threshold of the j-th transaction code. If it is higher than the system concurrency threshold of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be reduced according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the reduction = the transaction concurrency upper limit of the j-th transaction code before the reduction × (1-third ratio).

[0216] It should be noted that, in some cases, if it is determined that the response time of the f-th associated transaction corresponding to the j-th transaction code exceeds the first associated transaction response time threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not higher than the system concurrency threshold of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never be lower than the system concurrency threshold of the j-th transaction code.

[0217] S20: After determining that the response time of the fth associated transaction corresponding to the jth transaction code is lower than the second associated transaction response time threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is lower than the target value of the number of concurrent transactions of the jth transaction code, increase the upper limit of the number of concurrent transactions of the jth transaction code according to the third ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0218] The second associated transaction response time threshold can be set in advance according to the application scenario. It should be noted that the embodiment of the present application does not limit the size relationship between the second associated transaction response time threshold and the first associated transaction response time threshold above. For example, the second associated transaction response time threshold can be equal to the first associated transaction response time threshold above, or can be lower than the first associated transaction response time threshold above.

[0219] Based on the relevant content of S20 above, for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the f-th associated transaction response time corresponding to the j-th transaction code, it can be determined whether the f-th associated transaction response time corresponding to the j-th transaction code is lower than the second associated transaction response time threshold. If it is lower than the second associated transaction response time threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code. If it is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be increased according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the increase = the transaction concurrency upper limit of the j-th transaction code before the increase × (1 + the third ratio).

[0220] It should be noted that, in some cases, if it is determined that the response time of the f-th associated transaction corresponding to the j-th transaction code is lower than the second associated transaction response time threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not lower than the system concurrency target value of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never exceed the system concurrency target value of the j-th transaction code.

[0221] Based on the relevant contents of S18 to S20 above, it can be known that the embodiment of the present application can control the system concurrency of each transaction in the distributed system according to the associated transaction response time of each transaction in the distributed system, so that the number of transactions simultaneously undertaken by the distributed system is more in line with the processing capacity of the distributed system for each transaction, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0222] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation method of the transaction concurrency control method. In this implementation method, if the distributed system processes M transactions and the distributed system uses the hth transaction, j The associated system provides j If a related transaction processes the jth transaction, the method for controlling the number of concurrent transactions may further include S21-S23 in addition to all or part of the steps S1-S20 above:

[0223] S21: Obtain the response time of the fth associated transaction corresponding to the jth transaction code; wherein j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0224] It should be noted that for the relevant content of S21, please refer to the relevant content of S18 above.

[0225] S22: After determining F j There are at least a third number of first target related transactions among the h related transactions, and it is determined that j When the transaction concurrency limit of the first associated system exceeds the concurrency threshold of the second system, the transaction concurrency of the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system. Where j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0226] The response time of the first target associated transaction exceeds a first associated transaction response time threshold.

[0227] The third number can be preset according to the application scenario.

[0228] No.h j The upper limit of the number of concurrent transactions of the associated system is the hth j The maximum number of transactions that can be processed simultaneously by the h-th associated system; j The upper limit of the number of concurrent transactions of the associated system is equal to the hth j The sum of the upper limits of concurrent transactions for all servers in the associated system.

[0229] The second system concurrent number threshold refers to the pre-set number of concurrent connections allowed for the hth j The minimum number of transactions that are processed simultaneously by the associated systems; moreover, the embodiment of the present application does not limit the second system concurrency threshold, for example, the second system concurrency threshold may be 0.

[0230] The fifth ratio can be preset according to the application scenario.

[0231] Based on the above S22 related content, it can be known that for the hth j For the current round of transaction concurrency control process of the associated system, after obtaining the hth j After the associated systems respond to the distributed system for each associated transaction, the above F corresponding to the jth transaction code is first determined. j Whether the response time of the yth related transaction among the related transactions exceeds the first related transaction response time threshold. If it exceeds the first related transaction response time threshold, the above F j The yth related-party transaction among the related-party transactions is determined as the first target related-party transaction; where y is a positive integer, y≤F j Then, it is determined whether the number of the first target related transactions reaches the third number. If it reaches the third number, it is further determined whether the hth target related transactions reach the third number. j Is the transaction concurrency upper limit of the first associated system higher than the concurrency threshold of the second system? If so, the transaction concurrency upper limit of the first associated system can be reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system is reduced so that the h j The upper limit of the number of concurrent transactions of the associated system = the hth before reduction j The upper limit of the number of concurrent transactions of the associated system × (1-fifth ratio), so that the subsequent j The upper limit of the number of concurrent transactions of the associated system is updated. j The upper limit of the number of concurrent transactions of each server in the associated system is reduced to j The upper limit of the number of concurrent transactions of the associated system is equal to the updated hth j The sum of the upper limits of concurrent transactions for all servers in the associated system.

[0232] It should be noted that in some cases, if F j There are at least a third number of first target related transactions among the h related transactions, but it is determined that j If the upper limit of the number of concurrent transactions of the first associated system is not higher than the second system concurrent threshold, the hth j The upper limit of concurrent transactions of the associated system remains unchanged, so that the h jThe upper limit of the number of concurrent transactions of the associated system will never be lower than the second system's concurrent transaction threshold.

[0233] S23: After determining F j There are at least a fourth number of second target related transactions among the related transactions, and determine F j The number of the first target related transactions in the h related transactions is less than the third number, and the hth target related transactions are determined. j After the transaction concurrency limit of the first associated system is lower than the second system concurrency target value, increase the hth system concurrency according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system. Where j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0234] The response time of the second target associated transaction is lower than the second associated transaction response time threshold.

[0235] The fourth number can be preset according to the application scenario.

[0236] The second system concurrent number target value refers to the pre-set allowed h j The maximum number of transactions that can be processed simultaneously by an associated system; moreover, the embodiment of the present application does not limit the target value of the concurrency of the second system.

[0237] Based on the above S23 related content, it can be known that for the hth j For the current round of transaction concurrency control process of the associated system, after obtaining the hth j After the response time of each related transaction of the associated system to the distributed system, first determine the above F corresponding to the jth transaction code j Whether the response time of the yth related transaction in the related transactions exceeds the first related transaction response time threshold. If it exceeds the first related transaction response time threshold, the above F j The yth related transaction among the related transactions is determined as the first target related transaction; at the same time, the above F corresponding to the jth transaction code can also be determined. j Whether the response time of the yth related transaction in the related transactions is lower than the second related transaction response time threshold, if it is lower than the second related transaction response time threshold, then the above F j The yth related-party transaction among the related-party transactions is determined as the second target related-party transaction; where y is a positive integer, y≤F j Then, it is determined whether the number of the second target related transactions reaches the fourth number and whether the number of the first target related transactions is lower than the third number. If the number of the second target related transactions reaches the fourth number and the number of the first target related transactions is lower than the third number, it is further determined whether the hth target related transactions are jIs the upper limit of the number of concurrent transactions of the first associated system lower than the target number of concurrent transactions of the second system? If so, the upper limit of the number of concurrent transactions of the first associated system can be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system is set to increase the hth j The upper limit of the number of concurrent transactions of the associated system = the hth before the increase j The upper limit of the number of concurrent transactions of the associated system × (1 + the fifth ratio), so that the subsequent increase can be based on the hth j The upper limit of the number of concurrent transactions of the associated system is updated. j The upper limit of the number of concurrent transactions of each server in the associated system is increased so that the hth j The upper limit of the number of concurrent transactions of the associated system is equal to the updated hth j The sum of the upper limits of concurrent transactions for all servers in the associated system.

[0238] It should be noted that in some cases, if it is determined that F j There are at least a fourth number of second target related transactions among the related transactions, and determine F j The number of the first target related transactions among the h related transactions is less than the third number, but the hth target related transactions are determined j If the upper limit of the number of concurrent transactions of the first associated system is not lower than the target value of the number of concurrent transactions of the second system, the hth j The upper limit of concurrent transactions of the associated system remains unchanged, so that the h j The upper limit of the number of concurrent transactions of the first associated system will never be higher than the target value of the number of concurrent transactions of the second system.

[0239] Based on the relevant contents of S21 to S23 above, it can be known that the embodiment of the present application can control the system concurrency of each associated system of the distributed system according to the response time of the associated transactions in each associated system of the distributed system, so that the number of associated transactions that can be undertaken by each associated system of the distributed system is more in line with the transaction processing capabilities of each associated system of the distributed system, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0240] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation method of the transaction concurrency control method. In this implementation method, if the distributed system processes M transactions and the distributed system uses the hth transaction, j The associated system provides j If a related transaction processes the jth transaction, the method for controlling the number of concurrent transactions may further include S24-S26 in addition to all or part of the steps S1-S23 above:

[0241] S24: Obtain the success rate of the fth associated transaction system corresponding to the jth transaction code. Where j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0242] The success rate of the fth associated transaction system corresponding to the jth transaction code refers to the success rate of the hth associated transaction system associated with the distributed system when the distributed system processes the jth transaction. j The probability that the associated system successfully completes the f-th associated transaction; and the embodiment of the present application does not limit the method for obtaining the success rate of the f-th associated transaction system corresponding to the j-th transaction code. For example, the success rate of the f-th associated transaction system corresponding to the j-th transaction code can be obtained according to the h-th j The success rate of the f-th associated transaction system corresponding to the j-th transaction code is determined based on the processing result of the f-th associated transaction by the f-th associated system within the first time period.

[0243] Based on the relevant content of S24 above, it can be known that the concurrency control can be repeated for each transaction in the distributed system at a preset time interval; and for the current round of concurrency control process for each transaction, the success rate of the f-th associated transaction system corresponding to the j-th transaction code can be obtained first, so that the concurrency control of the j-th transaction can be performed accordingly based on the success rate of the f-th associated transaction system corresponding to the j-th transaction code.

[0244] S25: After determining that the success rate of the fth associated transaction system corresponding to the jth transaction code is lower than the first associated transaction system success rate threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is higher than the threshold of the number of concurrent transactions of the jth transaction code, reduce the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0245] The success rate threshold of the first associated transaction system may be pre-set according to the application scenario.

[0246] Based on the relevant content of S25 above, it can be known that for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the f-th associated transaction system success rate corresponding to the j-th transaction code, it can be determined whether the f-th associated transaction system success rate corresponding to the j-th transaction code is lower than the first associated transaction system success rate threshold. If it is lower than the first associated transaction system success rate threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is higher than the system concurrency threshold of the j-th transaction code. If it is higher than the system concurrency threshold of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be reduced according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the reduction = the transaction concurrency upper limit of the j-th transaction code before the reduction × (1-third ratio).

[0247] It should be noted that, in some cases, if it is determined that the success rate of the f-th associated transaction system corresponding to the j-th transaction code is lower than the first associated transaction system success rate threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not higher than the system concurrency threshold of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never be lower than the system concurrency threshold of the j-th transaction code.

[0248] S26: After determining that the success rate of the fth associated transaction system corresponding to the jth transaction code is higher than the second associated transaction system success rate threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is lower than the target value of the number of concurrent transactions of the jth transaction code, increase the upper limit of the number of concurrent transactions of the jth transaction code according to the third ratio. Wherein, j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0249] The second associated transaction system success rate threshold can be set in advance according to the application scenario. It should be noted that the embodiment of the present application does not limit the size relationship between the second associated transaction system success rate threshold and the first associated transaction system success rate threshold. For example, the second associated transaction system success rate threshold can be equal to the first associated transaction system success rate threshold, or can be higher than the first associated transaction system success rate threshold.

[0250] Based on the relevant content of S26 above, for the current round of concurrency control process of the j-th transaction in the distributed system, after obtaining the success rate of the f-th associated transaction system corresponding to the j-th transaction code, it can be determined whether the success rate of the f-th associated transaction system corresponding to the j-th transaction code is higher than the second associated transaction system success rate threshold. If it is higher than the second associated transaction system success rate threshold, it can be further determined whether the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code. If it is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code can be increased according to the third ratio, so that the transaction concurrency upper limit of the j-th transaction code after the increase = the transaction concurrency upper limit of the j-th transaction code before the increase × (1 + the third ratio).

[0251] It should be noted that, in some cases, if it is determined that the success rate of the f-th associated transaction system corresponding to the j-th transaction code is higher than the second associated transaction system success rate threshold, but it is determined that the system concurrency upper limit of the j-th transaction code is not lower than the system concurrency target value of the j-th transaction code, then the system concurrency upper limit of the j-th transaction code will remain unchanged, so that the system concurrency upper limit of the j-th transaction code will never exceed the system concurrency target value of the j-th transaction code.

[0252] Based on the relevant contents of S24 to S26 above, it can be known that the embodiment of the present application can control the system concurrency of each transaction in the distributed system according to the success rate of the associated transaction system of each transaction in the distributed system, so that the number of transactions simultaneously undertaken by the distributed system for each transaction is more in line with the processing capacity of the distributed system for each transaction, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0253] In addition, in order to better prevent the transaction processing speed of the distributed system from being slowed down, the embodiment of the present application also provides another possible implementation method of the transaction concurrency control method. In this implementation method, if the distributed system processes M transactions and the distributed system uses the hth transaction, j The associated system provides j If a related transaction processes the jth transaction, the method for controlling the number of concurrent transactions may further include S27-S29 in addition to all or part of the steps S1-S26 above:

[0254] S27: Obtain the success rate of the fth associated transaction system corresponding to the jth transaction code; wherein j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0255] It should be noted that for the relevant content of S27, please refer to the relevant content of S24 above.

[0256] S28: After determining F j There are at least the fifth number of third target related transactions among the h related transactions, and it is determined that the hth j When the transaction concurrency limit of the first associated system exceeds the concurrency threshold of the second system, the transaction concurrency of the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system. Where j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0257] The system success rate of the third target related transaction is lower than the system success rate threshold of the first related transaction.

[0258] The fifth number can be preset according to the application scenario.

[0259] Based on the above S28, it can be seen that for the hth j For the current round of transaction concurrency control process of the associated system, after obtaining the hth j After the associated systems respond to the distributed system about the system success rate of each associated transaction, the above F corresponding to the jth transaction code is first determined. j Whether the system success rate of the yth related transaction in the related transactions is lower than the first related transaction system success rate threshold. If it is lower than the first related transaction system success rate threshold, then the above F j The yth related-party transaction among the related-party transactions is determined as the third target related-party transaction; where y is a positive integer, y≤F j Then, it is determined whether the number of the third target related transactions reaches the fifth number. If it reaches the fifth number, it is further determined whether the hth target related transactions reach the fifth number. j Is the transaction concurrency upper limit of the first associated system higher than the concurrency threshold of the second system? If so, the transaction concurrency upper limit of the first associated system can be reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system is reduced so that the h j The upper limit of the number of concurrent transactions of the associated system = the hth before reduction j The upper limit of the number of concurrent transactions of the associated system × (1-fifth ratio), so that the subsequent j The upper limit of the number of concurrent transactions of the associated system is updated. j The upper limit of the number of concurrent transactions of each server in the associated system is reduced to j The upper limit of the number of concurrent transactions of the associated system is equal to the updated hth j The sum of the upper limits of concurrent transactions for all servers in the associated system.

[0260] It should be noted that in some cases, if Fj There are at least the fifth number of third target related transactions among the h related transactions, but it is determined that the h j If the upper limit of the number of concurrent transactions of the first associated system is not higher than the second system concurrent threshold, the hth j The upper limit of concurrent transactions of the associated system remains unchanged, so that the h j The upper limit of the number of concurrent transactions of the associated system will never be lower than the second system's concurrent transaction threshold.

[0261] S29: After determining F j There are at least the sixth number of the fourth target related transactions among the related transactions, and determine F j The number of the third target related transactions in the h related transactions is less than the fifth number, and the hth target related transactions are determined. j After the transaction concurrency limit of the first associated system is lower than the second system concurrency target value, increase the hth system concurrency according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system. Where j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j Is a positive integer.

[0262] The system success rate of the fourth target related transaction is higher than the system success rate threshold of the second related transaction.

[0263] The sixth number can be preset according to the application scenario.

[0264] Based on the above S29 related content, it can be known that for the hth j For the current round of transaction concurrency control process of the associated system, after obtaining the hth j After the system success rate of each related transaction responded to the distributed system by the related system, the above F corresponding to the jth transaction code is first determined. j Whether the success rate of the yth related transaction system in the related transactions is lower than the success rate threshold of the first related transaction system. If it is lower than the success rate threshold of the first related transaction system, then the above F j The yth related transaction among the related transactions is determined as the third target related transaction; at the same time, the above F corresponding to the jth transaction code can also be determined. j Whether the success rate of the yth related transaction system in the related transactions is higher than the success rate threshold of the second related transaction system. If it is higher than the success rate threshold of the second related transaction system, then the above F j The yth related-party transaction among the related-party transactions is determined as the fourth target related-party transaction; wherein y is a positive integer, y≤F jThen, it is determined whether the number of the fourth target related transactions reaches the sixth number and whether the number of the third target related transactions is lower than the fifth number. If the number of the fourth target related transactions reaches the sixth number and the number of the third target related transactions is lower than the fifth number, it is further determined whether the h j Is the upper limit of the number of concurrent transactions of the first associated system lower than the target number of concurrent transactions of the second system? If so, the upper limit of the number of concurrent transactions of the first associated system can be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system is set to increase the hth j The upper limit of the number of concurrent transactions of the associated system = the hth before the increase j The upper limit of the number of concurrent transactions of the associated system × (1 + the fifth ratio), so that the subsequent increase can be based on the hth j The upper limit of the number of concurrent transactions of the associated system is updated. j The upper limit of the number of concurrent transactions of each server in the associated system is increased so that the hth j The upper limit of the number of concurrent transactions of the associated system is equal to the updated hth j The sum of the upper limits of concurrent transactions for all servers in the associated system.

[0265] It should be noted that in some cases, if it is determined that F j There are at least the sixth number of the fourth target related transactions among the related transactions, and determine F j The number of third target related transactions among the related transactions is less than the fifth number, but the hth target related transactions are determined j If the upper limit of the number of concurrent transactions of the first associated system is not lower than the target value of the number of concurrent transactions of the second system, the hth j The upper limit of concurrent transactions of the associated system remains unchanged, so that the h j The upper limit of the number of concurrent transactions of the first associated system will never be higher than the target value of the number of concurrent transactions of the second system.

[0266] Based on the relevant contents of S27 to S29 above, it can be known that the embodiment of the present application can control the system concurrency of each associated system of the distributed system according to the system success rate of related transactions in each associated system of the distributed system, so that the number of related transactions that can be undertaken by each associated system of the distributed system is more in line with the transaction processing capabilities of each associated system of the distributed system, thereby effectively avoiding the transaction processing speed of the distributed system from being slowed down.

[0267] In addition, in order to facilitate technical personnel to promptly understand the transaction processing information of the distributed system, an alarm message can be output after executing all or part of the above steps S1-S29, so that the alarm message carries the control type for the concurrency number (for example, increasing and / or decreasing the concurrency number for XXX).

[0268] Based on the method for controlling the number of concurrent transactions provided in the above method embodiment, the embodiment of the present application also provides a device for controlling the number of concurrent transactions, which will be explained and illustrated below in conjunction with the accompanying drawings.

[0269] Device Embodiment

[0270] For technical details of the device for controlling the number of concurrent transactions provided by the device embodiment, please refer to the above method embodiment.

[0271] See also Figure 2 , which is a structural schematic diagram of a transaction concurrent number control device provided in an embodiment of the present application.

[0272] The concurrent transaction number control device 200 provided in the embodiment of the present application is applied to a distributed system, and the distributed system includes N servers;

[0273] The transaction concurrent number control device 200 comprises:

[0274] The first acquisition unit 201 is used to acquire the current resource usage data of the i-th server; wherein i is a positive integer, i≤N, and N is a positive integer;

[0275] A first reducing unit 202 is configured to reduce the upper limit of the number of concurrent transactions of the i-th server according to a first ratio after determining that the current resource usage data of the i-th server reaches the first fuse condition and determining that the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold;

[0276] The first increasing unit 203 is used to increase the upper limit of the number of concurrent transactions of the i-th server according to a first ratio after determining that the current resource usage data of the i-th server reaches the first recovery condition and determining that the upper limit of the number of concurrent transactions of the i-th server is lower than the target value of the number of concurrent transactions of a single server.

[0277] In a possible implementation, if the current resource usage data includes a current CPU usage rate, the first fuse condition is that the current CPU usage rate is higher than a first threshold, and the first recovery condition is that the current CPU usage rate is lower than a second threshold;

[0278] or,

[0279] If the current resource usage data includes a current memory usage rate, the first fuse condition is that the current memory usage rate is higher than a third threshold, and the first recovery condition is that the current memory usage rate is lower than a fourth threshold;

[0280] or,

[0281] If the current resource usage data includes the current CPU usage and the current memory usage, the first fuse condition is that the current CPU usage is higher than the first threshold or the current memory usage is higher than the third threshold, and the first recovery condition is that the current CPU usage is lower than the second threshold or the current memory usage is lower than the fourth threshold.

[0282] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0283] A second reducing unit is used to reduce the upper limit of the number of concurrent transactions of the distributed system according to a second ratio after determining that there are at least a first number of first target servers among the N servers and determining that the upper limit of the number of concurrent transactions of the distributed system is higher than the first system concurrency threshold, and update the upper limit of the number of concurrent transactions of each server according to the reduced upper limit of the number of concurrent transactions of the distributed system, so that the reduced upper limit of the number of concurrent transactions of the distributed system is equal to the sum of the upper limits of the number of concurrent transactions of the N servers after the update; wherein the current resource usage data of the first target server reaches the second fuse condition;

[0284] The second increasing unit is used to increase the upper limit of transaction concurrency of the distributed system according to a second ratio after determining that there are at least a second number of second target servers among the N servers and determining that the upper limit of transaction concurrency of the distributed system is lower than the target value of the first system concurrency, and update the upper limit of transaction concurrency of each server according to the reduced upper limit of transaction concurrency of the distributed system, so that the increased upper limit of transaction concurrency of the distributed system is equal to the sum of the upper limits of transaction concurrency of the N servers after the update; wherein the current resource usage data of the second target server meets the second recovery condition.

[0285] In a possible implementation, if the current resource usage data includes a current CPU usage rate, the second fuse condition is that the current CPU usage rate is higher than a fifth threshold, and the second recovery condition is that the current CPU usage rate is lower than a sixth threshold;

[0286] or,

[0287] If the current resource usage data includes a current memory usage rate, the second fuse condition is that the current memory usage rate is higher than a seventh threshold, and the second recovery condition is that the current memory usage rate is lower than an eighth threshold;

[0288] or,

[0289] If the current resource usage data includes the current CPU usage and the current memory usage, the second fuse condition is that the current CPU usage is higher than the fifth threshold or the current memory usage is higher than the seventh threshold, and the second recovery condition is that the current CPU usage is lower than the sixth threshold or the current memory usage is lower than the eighth threshold.

[0290] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0291] A second acquisition unit is configured to acquire a system internal success rate of a j-th transaction code if the distributed system processes M transactions; wherein the j-th transaction code is used to uniquely identify the j-th transaction; j is a positive integer, j≤M, and M is a positive integer;

[0292] a third reducing unit, configured to reduce the upper limit of concurrent transactions of the jth transaction code according to a third ratio after determining that the internal system success rate of the jth transaction code is lower than the first system success rate threshold and determining that the upper limit of concurrent transactions of the jth transaction code is higher than the threshold of concurrent transactions of the jth transaction code;

[0293] The third increasing unit is used to increase the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio after determining that the system internal success rate of the jth transaction code is higher than the second system success rate threshold and determining that the upper limit of the number of concurrent transactions of the jth transaction code is lower than the target value of the number of concurrent transactions of the jth transaction code.

[0294] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0295] The third acquisition unit is used for, if the distributed system processes M transactions and the jth transaction is processed by G in the distributed system j The success rate of the gth server of the jth transaction code is obtained if the jth transaction code is processed by the gth server; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j is a positive integer;

[0296] a fourth reducing unit, configured to reduce the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio after determining that the g-th server success rate of the j-th transaction code is lower than the first server success rate threshold and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code;

[0297] The fourth increasing unit is used to increase the g-th server concurrency upper limit of the j-th transaction code according to a fourth ratio after determining that the g-th server success rate of the j-th transaction code is higher than the second server success rate threshold and determining that the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code.

[0298] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0299] a fourth acquisition unit, configured to acquire the system internal processing time of the jth transaction code if the distributed system processes M transactions; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, and M is a positive integer;

[0300] a fifth reducing unit, configured to reduce the upper limit of concurrent transactions of the jth transaction code according to a third ratio after determining that the system internal processing time of the jth transaction code is higher than the first system processing time threshold and determining that the upper limit of concurrent transactions of the jth transaction code is higher than the system concurrent transaction threshold of the jth transaction code;

[0301] The fifth increasing unit is used to increase the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio after determining that the system internal processing time of the jth transaction code is lower than the second system processing time threshold and determining that the upper limit of the number of concurrent transactions of the jth transaction code is lower than the target value of the number of concurrent transactions of the jth transaction code.

[0302] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0303] A fifth acquisition unit is used for, if the distributed system processes M transactions and the jth transaction is processed by G in the distributed system j If the jth transaction code is processed by a server, the processing time of the gth server of the jth transaction code is obtained; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j is a positive integer;

[0304] a sixth reducing unit, configured to reduce the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio after determining that the g-th server processing time of the j-th transaction code is higher than the first server processing time threshold and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code;

[0305] a sixth increasing unit, configured to increase the g-th server concurrency upper limit of the j-th transaction code according to a fourth ratio after determining that the g-th server processing time of the j-th transaction code is lower than the second server processing time threshold and determining that the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code.

[0306] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0307] The sixth acquisition unit is configured to: if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If a related transaction processes the jth transaction, the response time of the fth related transaction corresponding to the jth transaction code is obtained; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer;

[0308] a seventh reducing unit, configured to reduce the upper limit of concurrent transactions of the jth transaction code according to a third ratio after determining that the response time of the fth associated transaction corresponding to the jth transaction code exceeds the first associated transaction response time threshold and determining that the upper limit of concurrent transactions of the jth transaction code is higher than the threshold of concurrent transactions of the jth transaction code;

[0309] a seventh increasing unit, configured to increase the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio after determining that the response time of the fth associated transaction corresponding to the jth transaction code is lower than the second associated transaction response time threshold and determining that the upper limit of the number of concurrent transactions of the jth transaction code is lower than the target value of the number of concurrent transactions of the jth transaction code.

[0310] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0311] A seventh acquisition unit is used for: if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If a related transaction processes the jth transaction, the response time of the fth related transaction corresponding to the jth transaction code is obtained; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer;

[0312] The eighth reducing unit is used to determine the F jThere are at least a third number of first target related transactions among the h related transactions, and it is determined that the hth related transactions j After the transaction concurrency upper limit of the first associated system exceeds the second system concurrency threshold, the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system; wherein the response time of the first target associated transaction exceeds the first associated transaction response time threshold;

[0313] The eighth adding unit is used to determine the F j There are at least a fourth number of second target related transactions among the related transactions, determining the F j The number of first target related transactions in the h related transactions is less than the third number, and it is determined that the hth related transaction j After the upper limit of the number of concurrent transactions of the first associated system is lower than the target value of the number of concurrent transactions of the second system, the hth associated system shall be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system is set; wherein the response time of the second target associated transaction is lower than the second associated transaction response time threshold.

[0314] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0315] An eighth acquisition unit is used for if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If a related transaction processes the jth transaction, the success rate of the fth related transaction system corresponding to the jth transaction code is obtained; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer;

[0316] a ninth reducing unit, configured to reduce the upper limit of concurrent transactions of the jth transaction code according to a third ratio after determining that the success rate of the fth associated transaction system corresponding to the jth transaction code is lower than the first associated transaction system success rate threshold and determining that the upper limit of concurrent transactions of the jth transaction code is higher than the threshold of concurrent transactions of the jth transaction code;

[0317] The ninth increasing unit is used to increase the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio after determining that the success rate of the fth associated transaction system corresponding to the jth transaction code is higher than the second associated transaction system success rate threshold and determining that the upper limit of the number of concurrent transactions of the jth transaction code is lower than the target value of the number of concurrent transactions of the jth transaction code.

[0318] In a possible implementation manner, the concurrent transaction number control device 200 further includes:

[0319] A ninth acquisition unit is configured to: if the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If a related transaction processes the jth transaction, the success rate of the fth related transaction system corresponding to the jth transaction code is obtained; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer;

[0320] The tenth reduction unit is used to determine the F j There are at least a fifth number of third target related transactions among the h related transactions, and it is determined that the hth j After the transaction concurrency upper limit of the first associated system exceeds the second system concurrency threshold, the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system; wherein the system success rate of the third target associated transaction is lower than the system success rate threshold of the first associated transaction;

[0321] The tenth adding unit is used to determine the F j There are at least a sixth number of fourth target related transactions among the related transactions, determining the F j The number of the third target related transactions in the h related transactions is less than the fifth number, and it is determined that the hth j After the upper limit of the number of concurrent transactions of the first associated system is lower than the target value of the number of concurrent transactions of the second system, the hth associated system shall be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated systems; wherein the system success rate of the fourth target associated transaction is higher than the system success rate threshold of the second associated transaction.

[0322] Based on the relevant contents of the above-mentioned transaction concurrency control device 200, it can be known that for the i-th server in the distributed system, the current resource usage data of the i-th server is obtained, and after determining that the current resource usage data of the i-th server reaches the first fuse condition and the upper limit of the transaction concurrency of the i-th server is higher than the single-server concurrency threshold, the upper limit of the transaction concurrency of the i-th server is reduced according to the first ratio; after determining that the current resource usage data of the i-th server reaches the first recovery condition and the upper limit of the transaction concurrency of the i-th server is lower than the single-server concurrency target value, the upper limit of the transaction concurrency of the i-th server is increased according to the first ratio. Wherein, i is a positive integer, i≤N, and N is a positive integer.

[0323] It can be seen that the embodiments of the present application can control the number of concurrent transactions for each server according to the current resource usage data of each server in the distributed system, so that the maximum number of transactions that each server can undertake can be more in line with the current resource level of each server. This can effectively reduce the impact of servers with slow processing speeds on the distributed system, thereby effectively avoiding the processing speed of the distributed system from being slowed down.

[0324] Furthermore, an embodiment of the present application also provides a device, the device comprising a processor and a memory:

[0325] The memory is used to store computer programs;

[0326] The processor is used to execute any implementation of the transaction concurrent number control method provided in the embodiments of the present application according to the computer program.

[0327] Furthermore, an embodiment of the present application also provides a computer-readable storage medium, which is used to store a computer program, and the computer program is used to execute any implementation of the transaction concurrency control method provided in the embodiment of the present application.

[0328] Furthermore, an embodiment of the present application also provides a computer program product, which, when running on a terminal device, enables the terminal device to execute any implementation of the method for controlling the number of concurrent transactions provided in the embodiment of the present application.

[0329] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0330] The above is only a preferred embodiment of the present invention and does not limit the present invention in any form. Although the present invention has been disclosed as above in the preferred embodiment, it is not used to limit the present invention. Any technician familiar with the art can make many possible changes and modifications to the technical solution of the present invention by using the methods and technical contents disclosed above without departing from the scope of the technical solution of the present invention, or modify it into an equivalent embodiment of equivalent changes. Therefore, any simple modification, equivalent change and modification made to the above embodiments according to the technical essence of the present invention without departing from the content of the technical solution of the present invention still falls within the scope of protection of the technical solution of the present invention.

Claims

1. A method for controlling the number of concurrent transactions, characterized in that: The transaction concurrency control method is applied to a distributed system, wherein the distributed system includes N servers; The method comprises: Get the current resource usage data of the i-th server; where i is a positive integer, i≤N, and N is a positive integer; After determining that the current resource usage data of the i-th server reaches the first fuse condition and determining that the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold, reducing the upper limit of the number of concurrent transactions of the i-th server according to the first ratio; After determining that the current resource usage data of the i-th server meets the first recovery condition and determining that the upper limit of the number of concurrent transactions of the i-th server is lower than the single-server concurrent number target value, increasing the upper limit of the number of concurrent transactions of the i-th server according to the first ratio; After determining that there are at least a first number of first target servers among the N servers, and determining that the upper limit of the number of concurrent transactions of the distributed system is higher than the first system concurrency threshold, the upper limit of the number of concurrent transactions of the distributed system is reduced according to the second ratio, and the upper limit of the number of concurrent transactions of each server is updated according to the reduced upper limit of the number of concurrent transactions of the distributed system, so that the reduced upper limit of the number of concurrent transactions of the distributed system is equal to the sum of the upper limits of the number of concurrent transactions of the updated N servers; wherein the current resource usage data of the first target server reaches the second fuse condition; the second fuse condition refers to the condition that a single server needs to meet when controlling the reduction of the number of concurrent transactions of the distributed system; the upper limit of the number of concurrent transactions of the distributed system refers to the maximum number of transactions that the distributed system can process simultaneously; the first system concurrency threshold refers to the pre-set minimum number of transactions that the distributed system is allowed to process simultaneously; After determining that there are at least a second number of second target servers among the N servers, and determining that the upper limit of transaction concurrency of the distributed system is lower than the first system concurrency target value, the upper limit of transaction concurrency of the distributed system is increased according to a second ratio, and based on the reduced upper limit of transaction concurrency of the distributed system, the upper limit of transaction concurrency of each server is updated so that the increased upper limit of transaction concurrency of the distributed system is equal to the sum of the upper limits of transaction concurrency of the N servers after the update; wherein the current resource usage data of the second target server meets the second recovery condition; the second recovery condition refers to the condition that a single server needs to meet when controlling the increase of transaction concurrency of the distributed system; the first system concurrency target value refers to the pre-set maximum number of transactions allowed to be processed simultaneously by the distributed system.

2. The method according to claim 1, characterized in that If the current resource usage data includes a current CPU usage rate, the first fuse condition is that the current CPU usage rate is higher than a first threshold, and the first recovery condition is that the current CPU usage rate is lower than a second threshold; or, If the current resource usage data includes a current memory usage rate, the first fuse condition is that the current memory usage rate is higher than a third threshold, and the first recovery condition is that the current memory usage rate is lower than a fourth threshold; or, If the current resource usage data includes the current CPU usage and the current memory usage, the first fuse condition is that the current CPU usage is higher than the first threshold or the current memory usage is higher than the third threshold, and the first recovery condition is that the current CPU usage is lower than the second threshold or the current memory usage is lower than the fourth threshold.

3. The method according to claim 1, characterized in that If the current resource usage data includes the current CPU usage rate, the second fuse condition is that the current CPU usage rate is higher than the fifth threshold, and the second recovery condition is that the current CPU usage rate is lower than the sixth threshold; or, If the current resource usage data includes a current memory usage rate, the second fuse condition is that the current memory usage rate is higher than a seventh threshold, and the second recovery condition is that the current memory usage rate is lower than an eighth threshold; or, If the current resource usage data includes the current CPU usage and the current memory usage, the second fuse condition is that the current CPU usage is higher than the fifth threshold or the current memory usage is higher than the seventh threshold, and the second recovery condition is that the current CPU usage is lower than the sixth threshold or the current memory usage is lower than the eighth threshold.

4. The method according to claim 1, characterized in that: If the distributed system processes M transactions, the method further includes: Obtaining the internal success rate of the system for the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, and M is a positive integer; After determining that the system internal success rate of the j-th transaction code is lower than the first system success rate threshold, and determining that the system concurrent number upper limit of the j-th transaction code is higher than the system concurrent number threshold of the j-th transaction code, reducing the transaction concurrent number upper limit of the j-th transaction code according to a third ratio; After determining that the system internal success rate of the j-th transaction code is higher than the second system success rate threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

5. The method according to claim 1, characterized in that If the distributed system processes M transactions and the jth transaction is processed by G in the distributed system j If the processing is performed by a server, the method further includes: Get the g-th server success rate of the j-th transaction code; wherein the j-th transaction code is used to uniquely identify the j-th transaction; j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j is a positive integer; After determining that the g-th server success rate of the j-th transaction code is lower than the first server success rate threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code, reducing the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio; After determining that the g-th server success rate of the j-th transaction code is higher than the second server success rate threshold, and determining that the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code, the g-th server concurrency upper limit of the j-th transaction code is increased according to a fourth ratio.

6. The method according to claim 1, characterized in that If the distributed system processes M transactions, the method further includes: Obtaining the system internal processing time of the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, and M is a positive integer; After determining that the system internal processing time of the j-th transaction code is higher than the first system processing time threshold, and determining that the system concurrent number upper limit of the j-th transaction code is higher than the system concurrent number threshold of the j-th transaction code, reducing the transaction concurrent number upper limit of the j-th transaction code according to a third ratio; After determining that the system internal processing time of the j-th transaction code is lower than the second system processing time threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

7. The method according to claim 1, characterized in that If the distributed system processes M transactions and the jth transaction is processed by G in the distributed system j If the processing is performed by a server, the method further includes: Get the gth server processing time of the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; g is a positive integer, g≤G j , and G j is a positive integer; After determining that the g-th server processing time of the j-th transaction code is higher than the first server processing time threshold, and determining that the g-th server concurrent number upper limit of the j-th transaction code is higher than the g-th server concurrent number threshold of the j-th transaction code, reducing the g-th server concurrent number upper limit of the j-th transaction code according to a fourth ratio; After determining that the g-th server processing time of the j-th transaction code is lower than the second server processing time threshold, and determining that the g-th server concurrency upper limit of the j-th transaction code is lower than the g-th server concurrency target value of the j-th transaction code, increase the g-th server concurrency upper limit of the j-th transaction code according to a fourth ratio.

8. The method according to claim 1, characterized in that If the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes: Get the response time of the fth associated transaction corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer; After determining that the response time of the fth associated transaction corresponding to the jth transaction code exceeds the first associated transaction response time threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is higher than the upper limit of the number of concurrent transactions of the jth transaction code, reducing the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio; After determining that the f-th associated transaction response time corresponding to the j-th transaction code is lower than the second associated transaction response time threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

9. The method according to claim 1, characterized in that: If the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes: Get the response time of the fth associated transaction corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer; In determining the F j There are at least a third number of first target related transactions among the h related transactions, and it is determined that the hth related transactions j After the transaction concurrency upper limit of the first associated system exceeds the second system concurrency threshold, the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system; wherein the response time of the first target associated transaction exceeds the first associated transaction response time threshold; In determining the F j There are at least a fourth number of second target related transactions among the related transactions, determining the F j The number of first target related transactions in the h related transactions is less than the third number, and it is determined that the hth related transaction j After the upper limit of the number of concurrent transactions of the first associated system is lower than the target value of the number of concurrent transactions of the second system, the hth associated system shall be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system is set; wherein the response time of the second target associated transaction is lower than the second associated transaction response time threshold.

10. The method according to claim 1, characterized in that If the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes: Obtain the success rate of the fth associated transaction system corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer; After determining that the success rate of the fth associated transaction system corresponding to the jth transaction code is lower than the first associated transaction system success rate threshold, and determining that the upper limit of the number of concurrent transactions of the jth transaction code is higher than the upper limit of the number of concurrent transactions of the jth transaction code, reducing the upper limit of the number of concurrent transactions of the jth transaction code according to a third ratio; After determining that the success rate of the f-th associated transaction system corresponding to the j-th transaction code is higher than the second associated transaction system success rate threshold, and determining that the system concurrency upper limit of the j-th transaction code is lower than the system concurrency target value of the j-th transaction code, the transaction concurrency upper limit of the j-th transaction code is increased according to a third ratio.

11. The method according to claim 1, characterized in that: If the distributed system processes M transactions and the distributed system uses the hth j The associated system provides j If the jth transaction is processed by a related transaction, the method further includes: Obtain the success rate of the fth associated transaction system corresponding to the jth transaction code; wherein the jth transaction code is used to uniquely identify the jth transaction; j is a positive integer, j≤M, M is a positive integer; f is a positive integer, f≤F j , F j is a positive integer; In determining the F j There are at least a fifth number of third target related transactions among the h related transactions, and it is determined that the hth j After the transaction concurrency upper limit of the first associated system exceeds the second system concurrency threshold, the hth associated system is reduced according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated system; wherein the system success rate of the third target associated transaction is lower than the system success rate threshold of the first associated transaction; In determining the F j There are at least a sixth number of fourth target related transactions among the related transactions, determining the F j The number of the third target related transactions in the h related transactions is less than the fifth number, and it is determined that the hth j After the upper limit of the number of concurrent transactions of the first associated system is lower than the target value of the number of concurrent transactions of the second system, the hth associated system shall be increased according to the fifth ratio. j The upper limit of the number of concurrent transactions of the associated systems; wherein the system success rate of the fourth target associated transaction is higher than the system success rate threshold of the second associated transaction.

12. A device for controlling the number of concurrent transactions, characterized in that: The transaction concurrent number control device is applied to a distributed system, and the distributed system includes N servers; The transaction concurrent number control device comprises: A first acquisition unit is used to acquire current resource usage data of the i-th server; wherein i is a positive integer, i≤N, and N is a positive integer; a first reducing unit, configured to reduce the upper limit of the number of concurrent transactions of the i-th server according to a first ratio after determining that the current resource usage data of the i-th server reaches the first fuse condition and determining that the upper limit of the number of concurrent transactions of the i-th server is higher than the single-server concurrent number threshold; A first increasing unit is configured to increase the upper limit of the number of concurrent transactions of the i-th server according to a first ratio after determining that the current resource usage data of the i-th server reaches a first recovery condition and determining that the upper limit of the number of concurrent transactions of the i-th server is lower than the target value of the number of concurrent transactions of a single server; The transaction concurrent number control device also includes: A second reduction unit is used to reduce the upper limit of the number of concurrent transactions of the distributed system according to a second ratio after determining that there are at least a first number of first target servers among the N servers and determining that the upper limit of the number of concurrent transactions of the distributed system is higher than the first system concurrency threshold, and update the upper limit of the number of concurrent transactions of each server according to the reduced upper limit of the number of concurrent transactions of the distributed system, so that the reduced upper limit of the number of concurrent transactions of the distributed system is equal to the sum of the upper limits of the number of concurrent transactions of the N servers after the update; wherein the current resource usage data of the first target server reaches the second fuse condition; the second fuse condition refers to the condition that a single server needs to meet when the distributed system is controlled to reduce the number of concurrent transactions; the upper limit of the number of concurrent transactions of the distributed system refers to the maximum number of transactions that the distributed system can process simultaneously; the first system concurrency threshold refers to the pre-set minimum number of transactions that the distributed system is allowed to process simultaneously; The second increasing unit is used to increase the upper limit of transaction concurrency of the distributed system according to a second ratio after determining that there are at least a second number of second target servers among the N servers and determining that the upper limit of transaction concurrency of the distributed system is lower than the target value of the first system concurrency, and update the upper limit of transaction concurrency of each server according to the reduced upper limit of transaction concurrency of the distributed system, so that the increased upper limit of transaction concurrency of the distributed system is equal to the sum of the upper limits of transaction concurrency of the N servers after the update; wherein the current resource usage data of the second target server meets the second recovery condition; the second recovery condition refers to the condition that a single server needs to meet when controlling the increase of transaction concurrency of the distributed system; the target value of the first system concurrency refers to the pre-set maximum number of transactions allowed to be processed simultaneously by the distributed system.

13. A device, characterized in that The device comprises a processor and a memory: The memory is used to store computer programs; The processor is configured to execute the method of any one of claims 1 to 11 according to the computer program.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store a computer program, and the computer program is used to execute the method according to any one of claims 1 to 11.

15. A computer program product, characterized in that When the computer program product is executed on a terminal device, the terminal device executes the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Service control method and device under micro-service, computer equipment and storage medium

    CN111475373A

  • Flow control method applied to server and related device

    CN112422440A