A task concurrency control method and device

By receiving the downstream system's abnormal messages and querying historical error records, dynamically adjusting the concurrency value of the high-frequency scheduling device, the problem of lack of dynamic adjustment of concurrency capabilities in the prior art is solved, and business stability under high concurrency conditions is achieved and downstream system protection.

CN114217964BActive Publication Date: 2025-02-14CHINA CONSTRUCTION BANK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111539633.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-15
Publication Date
2025-02-14
Estimated Expiration
2041-12-15

AI Technical Summary

Technical Problem

The high-frequency scheduling device lacks the ability to dynamically adjust the current concurrency and cannot obtain reasonable concurrency values, resulting in excessive load on the downstream system or business errors.

Method used

By receiving abnormal packets transmitted by the downstream system, obtaining error parameters, and querying historical error records to determine the latest error number, obtaining the corresponding adjustment ratio, and dynamically adjusting the concurrency value.

Benefits of technology

It realizes adaptive adjustment of concurrency values ​​under high concurrency conditions, reduces the number of business errors, protects downstream systems, and restores concurrency values ​​at appropriate times, so that transactions can adaptively find reasonable concurrency values.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114217964B_ABST
    Figure CN114217964B_ABST
Patent Text Reader

Abstract

The present invention discloses a task concurrency control method and device, which relate to the field of data processing. A specific implementation of the method includes: receiving a processing exception message transmitted by a downstream system, obtaining error parameters in the processing exception message; determining the latest number of error occurrences by querying the historical error records corresponding to the error parameters, and then obtaining an adjustment ratio corresponding to the latest number of error occurrences; multiplying the adjustment ratio by the current concurrency value as the adjusted concurrency value to perform concurrency adjustment control on the amount of subtasks sent to the downstream system. This implementation method adaptively adjusts the concurrency value according to the latest number of error occurrences, without the need for manual intervention, and greatly reduces the number of business processing failures, thereby achieving the purpose of dynamically adjusting the subtask concurrency value of the high-frequency scheduling device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a task concurrency control method and device. Background Art

[0002] The IT market is currently undergoing tremendous changes, with new technologies such as cloud computing, big data, the Internet of Things, and artificial intelligence also being gradually updated. Hosts have always been favored by enterprises for their high availability and high throughput, but the host equipment relies on a single device, which is not conducive to independent control. With the rapid growth of core businesses, hosts are facing increasingly severe challenges. With the rise of distributed architecture, enterprises are actively exploring solutions for moving hosts down.

[0003] As part of the core system of the distributed architecture, the high-frequency scheduling device has a mechanism for high-concurrency processing of subtasks, and can set different concurrency capabilities according to the transaction code. However, due to the instability and limited processing capacity of the downstream system, there will inevitably be excessive concurrency in some scenarios or some time periods, causing excessive load on the downstream system. In extreme cases, there may be a risk of complete paralysis of the downstream system. Currently, the fuse downgrade method is used to solve this problem. In the process of implementing the present invention, the inventor found that the prior art has at least the following problems:

[0004] 1. The high-frequency scheduling device currently only has one concurrency control mechanism, namely a fixed concurrency value. If it is set improperly, it will cause business failure or even paralysis of the downstream system.

[0005] 2. The circuit breaker degradation method can only protect the system itself. Once the concurrency is too high, it will cause large-scale business errors. As the upstream initiator of business calls, the high-frequency scheduling device will cause a large number of business errors if it does not dynamically control concurrency, thereby affecting the company's existing business.

[0006] 3. When the transaction volume is large, the current business processing of batch splitting orders is carried out through a high-frequency framework, and it is impossible to analyze the reasonable concurrency value of each transaction one by one through business or technical means. Summary of the invention

[0007] In view of this, an embodiment of the present invention provides a task concurrency control method and device, which can at least solve the problem in the prior art that the high-frequency scheduling device does not have the ability to dynamically adjust the current concurrency and cannot obtain a reasonable concurrency value.

[0008] To achieve the above object, according to one aspect of an embodiment of the present invention, a task concurrency control method is provided, comprising:

[0009] Receive a processing exception message transmitted by a downstream system, and obtain error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task;

[0010] By querying the historical error report records corresponding to the error parameters, determining the latest error occurrence number, and then obtaining the adjustment ratio corresponding to the latest error occurrence number;

[0011] The product of the adjustment ratio and the current concurrency value is used as the adjusted concurrency value to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0012] Optionally, the error parameter includes an error code, and before querying the historical error record corresponding to the error parameter, the following further includes:

[0013] If the error code exists in the error list, it is determined whether the task concurrency control function is currently in the on state. If not, an on instruction is issued to switch the task concurrency control function from the off state to the on state.

[0014] Optionally, the error parameter also includes a transaction code, and the query of the historical error record corresponding to the error parameter includes:

[0015] Query the historical error records corresponding to the transaction code; or

[0016] In the historical error records corresponding to the transaction code, query the historical error records corresponding to the error code.

[0017] Optionally, the latest error occurrence number is the historical error occurrence number + 1, and the error parameter also includes the time when the current error occurred. Before obtaining the adjustment ratio corresponding to the latest error occurrence number, the following is also included:

[0018] When the number of the latest error occurrences is greater than 1, the time of the last error occurrence is obtained to calculate the time difference between the time of the last error occurrence and the time of the current error occurrence;

[0019] It is determined whether the time difference is greater than a first preset time difference threshold. If the determination result is yes, an adjustment ratio corresponding to the latest number of error occurrences is obtained; otherwise, the process is terminated.

[0020] Optionally, the time when the last error occurred is stored in a task concurrency control cache parameter, and the method further includes:

[0021] After determining the adjusted concurrency value, the error parameter, the latest error occurrence number and the adjusted concurrency value are recorded in the task concurrency control cache parameter.

[0022] Optionally, the concurrent adjustment and control of the amount of subtasks sent to the downstream system includes:

[0023] If the transaction code is detected in the task concurrency control cache parameter, the adjusted concurrency value in the task concurrency control cache parameter is used to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0024] Optionally, after the concurrent adjustment and control of the amount of subtasks sent to the downstream system, the method further includes:

[0025] Get the latest error occurrence time and adjusted concurrency value in the task concurrency control cache parameters;

[0026] Calculate the time difference between the current time and the time when the latest error occurred, and when the time difference reaches a second preset time difference threshold, determine the latest concurrent recovery number corresponding to the transaction code to obtain a recovery ratio corresponding to the latest concurrent recovery number;

[0027] The product of the previous concurrency value and the recovery ratio is used as the adjusted concurrency value to perform concurrency recovery control on the amount of subtasks sent to the downstream system.

[0028] Optionally, before obtaining the adjustment ratio corresponding to the latest error occurrence number, the method further includes: if the latest error occurrence number is greater than a preset error occurrence number threshold, stopping the task concurrency adjustment operation;

[0029] Before obtaining the recovery ratio corresponding to the latest concurrent recovery number, the method further includes: if the latest concurrent recovery number is greater than a preset recovery number threshold, stopping the task concurrent recovery operation.

[0030] Optionally, obtaining the adjustment ratio corresponding to the latest number of error occurrences includes: obtaining the adjustment ratio of the latest number of error occurrences in an adjustment ratio table; wherein the adjustment ratios in the adjustment ratio table are arranged in ascending order;

[0031] The obtaining of the recovery ratio corresponding to the latest concurrent recovery number includes: obtaining a recovery ratio in a recovery ratio table, the recovery ratio being arranged at the latest concurrent recovery number; wherein the recovery ratios in the recovery ratio table are arranged in descending order.

[0032] Optionally, after taking the product of the previous concurrency value and the recovery ratio as the adjusted concurrency value, the method further includes: after determining the adjusted concurrency value, recording the latest concurrency recovery times, the transaction code and the adjusted concurrency value in the task concurrency control cache parameters.

[0033] To achieve the above object, according to another aspect of an embodiment of the present invention, a task concurrency control device is provided, comprising:

[0034] A receiving module, used to receive a processing exception message transmitted by a downstream system, and obtain error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task;

[0035] An acquisition module, configured to determine the latest number of error occurrences by querying the historical error report records corresponding to the error parameters, and then acquire an adjustment ratio corresponding to the latest number of error occurrences;

[0036] The adjustment module is used to take the product of the adjustment ratio and the current concurrency value as the adjusted concurrency value to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0037] Optionally, the error parameter includes an error code, and the device further includes an enabling module, configured to:

[0038] If the error code exists in the error list, it is determined whether the task concurrency control function is currently in the on state. If not, an on instruction is issued to switch the task concurrency control function from the off state to the on state.

[0039] Optionally, the error parameter also includes a transaction code, and the acquisition module is used to:

[0040] Query the historical error records corresponding to the transaction code; or

[0041] In the historical error records corresponding to the transaction code, query the historical error records corresponding to the error code.

[0042] Optionally, the latest error occurrence number is the historical error occurrence number + 1, the error parameter also includes the time when the current error occurred, and the device further includes a first judgment module, which is used to:

[0043] When the number of the latest error occurrences is greater than 1, the time of the last error occurrence is obtained to calculate the time difference between the time of the last error occurrence and the time of the current error occurrence;

[0044] It is determined whether the time difference is greater than a first preset time difference threshold. If the determination result is yes, an adjustment ratio corresponding to the latest number of error occurrences is obtained; otherwise, the process is terminated.

[0045] Optionally, the time when the last error occurred is stored in a task concurrency control cache parameter, and the device further includes a recording module, which is used to:

[0046] After determining the adjusted concurrency value, the error parameter, the latest error occurrence number and the adjusted concurrency value are recorded in the task concurrency control cache parameter.

[0047] Optionally, the adjustment module is used to:

[0048] If the transaction code is detected in the task concurrency control cache parameter, the adjusted concurrency value in the task concurrency control cache parameter is used to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0049] Optionally, a recovery module is also included to:

[0050] Get the latest error occurrence time and adjusted concurrency value in the task concurrency control cache parameters;

[0051] Calculate the time difference between the current time and the time when the latest error occurred, and when the time difference reaches a second preset time difference threshold, determine the latest concurrent recovery number corresponding to the transaction code to obtain a recovery ratio corresponding to the latest concurrent recovery number;

[0052] The product of the previous concurrency value and the recovery ratio is used as the adjusted concurrency value to perform concurrency recovery control on the amount of subtasks sent to the downstream system.

[0053] Optionally, the method further includes a second judgment module, configured to:

[0054] If the latest error occurrence count is greater than a preset error occurrence count threshold, then stopping the task concurrency adjustment operation; and

[0055] If the latest concurrent recovery times is greater than the preset recovery times threshold, the task concurrent recovery operation is stopped.

[0056] Optionally, the acquisition module is used to: acquire the adjustment ratio of the latest error occurrence number in the adjustment ratio table; wherein the adjustment ratios in the adjustment ratio table are arranged in ascending order;

[0057] The recovery module is used to: obtain the recovery ratio of the latest concurrent recovery times in the recovery ratio table; wherein the recovery ratios in the recovery ratio table are arranged in descending order.

[0058] Optionally, the recording module is further used to: after determining the adjusted concurrency value, record the latest concurrency recovery times, transaction code and adjusted concurrency value in the task concurrency control cache parameters.

[0059] To achieve the above objective, according to another aspect of an embodiment of the present invention, a task concurrency control electronic device is provided.

[0060] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the task concurrency control methods described above.

[0061] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, any of the above-mentioned task concurrency control methods is implemented.

[0062] To achieve the above object, according to another aspect of an embodiment of the present invention, a computing program product is provided. A computing program product of an embodiment of the present invention includes a computer program, and when the program is executed by a processor, the task concurrency control method provided by the embodiment of the present invention is implemented.

[0063] According to the scheme provided by the present invention, one embodiment of the above invention has the following advantages or beneficial effects: in the case of high concurrency, it is possible to adaptively reduce the number of task requests, thereby reducing the number of business errors, reducing the risk of customer complaints and protecting downstream systems. After a period of reduction, the concurrency value can be increased through a recovery mechanism, so that transactions currently running on high-frequency adjustment devices can adaptively find a reasonable concurrency value. And with business adjustments and version iterations, the control of the concurrency value can be adjusted automatically without manual intervention, so that enterprises can take the initiative in future development.

[0064] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0066] Figure 1 This is a main flow chart of a task concurrency control method according to an embodiment of the present invention;

[0067] Figure 2 is a flowchart of a specific task concurrency control method according to an embodiment of the present invention;

[0068] Figure 3 is a flowchart of an optional task concurrency control method according to an embodiment of the present invention;

[0069] Figure 4(a) is a schematic diagram of the adjustment result when the concurrency setting is obviously too high and unreasonable;

[0070] FIG4( b ) is a schematic diagram of the adjustment results of the occasional downstream performance fluctuation;

[0071] Figure 5 is a schematic diagram of main modules of a task concurrency control device according to an embodiment of the present invention;

[0072] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0073] Figure 7 It is a schematic diagram of the structure of a computer system of a mobile device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0074] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0075] The following is an introduction to the overall processing flow of the high-frequency dispatching device:

[0076] The high-frequency scheduling device divides batch splitting into single tasks into three stages: main task preprocessing stage, subtask execution processing stage, and main task postprocessing stage. The main task preprocessing stage is responsible for splitting the main task into single subtasks, the subtask execution processing stage is responsible for executing a single online transaction, and the main task postprocessing stage is responsible for summarizing the subtask execution status to form a report or perform other necessary processing.

[0077] The high-frequency dispatching device inspects the status of each main task and subtask through a timed inspector, and is responsible for the distribution and scheduling of batch tasks. The timed inspector includes a main task pre-processing inspector: it screens out the main tasks that meet the conditions and distributes them into the pre-processing stage; a subtask execution completion inspector: it counts the execution status of each subtask under a main task, and distributes the completed main tasks into the post-processing stage; and a main task post-processing inspector: it screens out the main tasks that meet the conditions and distributes them into the post-processing stage.

[0078] In the high-frequency scheduling device, there are two modes of subtask execution processing, namely parallel processing and sequential processing. Parallel processing is managed by thread pools, and all subtasks to be executed are thrown into the thread pool to achieve concurrency, so as to quickly complete subtask processing. Sequential processing is managed by threads, and only one thread is opened to process subtasks. Only when the previous subtask is completed can the next subtask be carried out, so as to achieve sequential execution.

[0079] It can be seen that the current management of the concurrency of parallel processing is relatively simple, and only controls a fixed number of concurrency. As a distributed open system, local failures are inevitable and often occur. In order to protect the system, the industry generally adopts the circuit breaker degradation method. Circuit breaker degradation means that when the current system determines that the downstream system or database or other middleware has no response or the response has significantly deteriorated in a short period of time, when there is a request to access, the request is directly rejected to protect the system itself, so that the system will not be overwhelmed by a large number of requests and the service will not be unavailable. This strategy is very necessary because in a distributed system, a single point failure will spread to the entire system and cause an avalanche effect.

[0080] Based on the above problems, the high-frequency scheduling device needs to have the ability to dynamically adjust the current concurrency. This ability includes two levels:

[0081] 1. In the case of occasional performance jitter in the downstream system, the concurrency is reduced for a period of time, and the concurrency value remains the same after the downstream system performance recovers.

[0082] 2. When the downstream system obviously cannot bear the current concurrency size, calculate the concurrency value that the downstream system can bear, and this value cannot be too small to cause slow processing of high-frequency scheduling tasks.

[0083] Therefore, it is urgent to design a batch processing framework suitable for distributed architecture to support the batch processing function of the original host. The high-frequency scheduling device in the parallel computing of the batch processing framework is responsible for the decomposition, distribution, execution, and aggregation of the core batch splitting business. It is necessary to support the processing capabilities of core enterprises such as batch collection and payment, customer information splitting and merging, and accounting. There are many large-scale batch splitting tasks, and often a main task has multiple subtasks to be processed. Therefore, it is necessary to design a high-concurrency processing mechanism for subtasks to quickly execute batch processing tasks.

[0084] See also Figure 1 , which shows a main flow chart of a task concurrency control method provided by an embodiment of the present invention, comprising the following steps:

[0085] S101: receiving a processing exception message transmitted by a downstream system, and obtaining error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task;

[0086] S102: determining the latest number of error occurrences by querying the historical error report records corresponding to the error parameter, and then obtaining an adjustment ratio corresponding to the latest number of error occurrences;

[0087] S103: taking the product of the adjustment ratio and the current concurrency value as the adjusted concurrency value, so as to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0088] In the above implementation, for step S101, this solution is designed to add a function of dynamic concurrency value based on the existing mechanism of the high-frequency scheduling device, so as to quickly execute batch processing tasks.

[0089] Subtask outbound call: The high-frequency dispatching device splits a batch of main tasks into multiple subtasks. The main task represents a batch, and the subtask represents a single record within a batch. Take salary payment as an example. When an enterprise initiates a batch to pay the company's employees' salaries for this month, this is a main task. After receiving the main task, the high-frequency dispatching device splits the salary information of each employee into individual subtasks. The subtask outbound call is to call these individual subtasks to the downstream system so that the salary payment account can be processed through the downstream system.

[0090] The downstream system receives and processes the subtasks sent by the subtask outbound call, but errors may occur during the processing, and thus returns the processing results. After the subtask outbound call to the downstream system is completed, the returned results are analyzed to determine whether the dynamic task concurrency control function needs to be triggered.

[0091] 1. Pre-set the ErrCodeList list to maintain the error code list. It should be noted that since the downstream systems called by the high-frequency scheduling device all comply with the unified regulations of the enterprise, some system abnormal error codes can be screened out and maintained in the list, such as "XFCF30100AA", and the error description is "The number of concurrent resources exceeds the limit, the flow control check fails, and the current transaction request is rejected." This error code means that the downstream system has turned on the fuse. At this time, the concurrency value should be reduced to reduce business errors and protect the downstream system.

[0092] 2. The subtask outbound call receives the processing exception message returned by the downstream system. The processing exception message includes the error code and transaction code. First, determine whether the error code exists in the error code list. Among them, the error code is the current limiting error code agreed in advance by the enterprise and the downstream system. Other system exceptions will not report this error code, and there is no need to adjust the high-frequency concurrency.

[0093] 3. When this error code exists in the error code list, it means that the current high-frequency scheduling device has too high concurrency or the downstream system has an abnormality. Determine whether the dynamic task concurrency control function is currently in the on state (a switch function is designed to turn on / off this function at any time). If it is off, send an on command to switch the function to the on state.

[0094] 4. After the dynamic task concurrency control function is enabled, trigger the dynamic task concurrency control function to check whether there is an error record corresponding to the transaction code, or check whether there is an error record corresponding to the error code in the error record corresponding to the transaction code (different error codes may correspond to different error records):

[0095] 1) If it does not exist, it indicates that the error occurs for the first time in the downstream system, and the latest error occurrence count is recorded as 1. At this time, there is no time when the last error occurred, and this field is assigned a value of empty.

[0096] Get the first adjustment ratio, and perform dynamic task concurrency control based on the first adjustment ratio * current concurrency value. For example, if the concurrency value is adjusted to 50% of the adjustment ratio table, that is, when the current concurrency is 10, it will be adjusted to 5 after dynamic task concurrency control occurs.

[0097] 2) If it exists, it means that this is not the first time that the downstream system has experienced this error. Taking the second occurrence as an example, the latest error occurrence count is the historical error occurrence count + 1 = 2. Query the second adjustment ratio in the adjustment ratio table, assuming it is 60%, and calculate the current concurrency value * current adjustment ratio = 5 * 60% = 3, that is, the adjusted concurrency value is 3. It should be noted that the concurrency value adjustment here is based on the previous adjusted concurrency value, not the original concurrency value.

[0098] Table 1

[0099] Number of errors Adjustment ratio 1 0.5 2 0.6 3 0.7 4 0.8 5 0.9 6 0.95

[0100] In addition, the number of times each transaction code can be adjusted concurrently is limited. For example, there are only 6 adjustment ratios in the adjustment ratio table, so the concurrency value can be adjusted up to 6 times, and a more reasonable concurrency value can be determined in the end. If it is greater than 6 times, no adjustment will be made. In some cases, the calculation result may include half a task or other situations that are not a task. In this case, it will be rounded up and the minimum concurrency value is 1.

[0101] Furthermore, for situations where the error does not occur for the first time, the time of the last concurrency adjustment or the time of the last error can be obtained from the task concurrency control cache parameters to calculate the time difference between the current error time and the current error time, and determine whether it exceeds the preset time difference threshold, such as 10s. If it exceeds, it indicates that the transaction code does not frequently cause errors, and the subsequent process continues. Otherwise, the process ends. For details, see Figure 2 shown.

[0102] 5. Then, important information such as the latest error occurrence count, transaction code, error code, time of this error, and adjusted concurrency value are recorded in the task concurrency control cache parameters (such as HftConfigCache.setMemoryCache in the program).

[0103] 6. The user uses the logic module of concurrent thread control, that is, the checkUseableThead method. If it is found that the current transaction code with an error (or the transaction code that needs to control concurrency) exists in the task concurrency control cache parameter, the concurrency value calculated in the cache will be used instead of the original default concurrency value to achieve task concurrency adjustment control. Since the cache is read, when the concurrency is reduced, this method will sense the need to reduce concurrency almost without delay.

[0104] The method provided in the above embodiment aims to realize the dynamic adjustment of the subtask concurrency value of the high-frequency scheduling device, timely perceive the downstream fault or load situation, and adaptively adjust the concurrency value according to the latest number of errors, without manual intervention, greatly reducing the number of business processing failures. And the whole is carried out on the scheduling process of the original high-frequency scheduling device, realizing decoupling from the business and the scheduling process of the high-frequency scheduling device.

[0105] See also Figure 2 FIG. 1 shows a flow chart of a specific task concurrency control method according to an embodiment of the present invention, which includes the following steps:

[0106] S201: receiving a processing exception message transmitted by a downstream system, and obtaining error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task; the error parameters include the transaction code, error code, and the time when the error occurred;

[0107] S202: If the error code exists in the error list, determine whether the task concurrency control function is currently in an on state; if not, issue an on instruction to switch the task concurrency control function from an off state to an on state;

[0108] S203: Determine the latest error occurrence number by querying the historical error report record corresponding to the transaction code, or the transaction code and the error code; wherein the latest error occurrence number is the historical error occurrence number + 1;

[0109] S204: When the latest error occurrence number is greater than 1, if the latest error occurrence number is greater than a preset error occurrence number threshold, stop the task concurrency adjustment operation;

[0110] S205: If not, obtain the time when the last error occurred to calculate the time difference between the time when the last error occurred and the time when the current error occurred;

[0111] S206: Determine whether the time difference is greater than a first preset time difference threshold, if the determination result is yes, obtain an adjustment ratio corresponding to the latest number of error occurrences, otherwise terminate the process;

[0112] S207: multiplying the adjustment ratio by the current concurrency value as the adjusted concurrency value;

[0113] S208: After determining the adjusted concurrency value, the error parameter, the latest error occurrence number and the adjusted concurrency value are recorded in the task concurrency control cache parameter;

[0114] S209: If the transaction code is detected in the task concurrency control cache parameter, the adjusted concurrency value in the task concurrency control cache parameter is used to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0115] The method provided in the above embodiment sets up a process for dynamically controlling the concurrency value of tasks. The fluctuation mode and fluctuation amplitude of the concurrency value are continuously optimized, and a reasonable concurrency value can be adaptively found. Moreover, with business adjustments and version iterations, the control of the concurrency value can be adjusted automatically without manual intervention.

[0116] See also Figure 3 , shows a schematic flow chart of an optional task concurrency control method according to an embodiment of the present invention, comprising the following steps:

[0117] S301: Obtain the latest error occurrence time and the adjusted concurrency value in the task concurrency control cache parameters;

[0118] S302: Calculate the time difference between the current time and the time when the latest error occurred, and when the time difference reaches a preset time threshold, determine the latest concurrent recovery number corresponding to the transaction code;

[0119] S303: If the latest concurrent recovery number is greater than a preset recovery number threshold, stop the task concurrent recovery operation, otherwise obtain a recovery ratio corresponding to the latest concurrent recovery number;

[0120] S304: The product of the previous concurrency value and the recovery ratio is used as the adjusted concurrency value to perform concurrency recovery control on the amount of subtasks sent to the downstream system.

[0121] In the above implementation, for steps S301 to S304, a timer is preset to traverse the transaction code concurrency control status in the task concurrency control cache parameter at a fixed time (e.g., 5 seconds) to determine whether the recovery concurrency value logic can be executed. Specifically, the latest error occurrence time in the task concurrency control cache parameter is obtained, the time difference between the current time and the latest error occurrence time is calculated, and it is determined whether the time difference reaches a second preset time difference threshold, such as 30 seconds. When the task concurrency control occurs for 30 seconds, the recovery concurrency value logic is triggered.

[0122] Determine the latest concurrent recovery times according to the transaction code, and then obtain the recovery ratio corresponding to the latest concurrent recovery times from the concurrent recovery ratio table, see Table 2:

[0123] Table 2

[0124]

[0125]

[0126] If it is the first concurrent recovery, the restored concurrency value is 1.5 times the value after control. If concurrent control occurs multiple times, the recovery ratio of the corresponding number of times is multiplied by the same order, and the maximum number is no more than 6 times (only an example, it is actually adjustable). This realizes the automatic recovery of the concurrency value. Figure 1 The concurrency reduction shown forms a set of control mechanisms. Similarly, the concurrency adjustment at this time is based on the last adjusted concurrency value, not the original concurrency value.

[0127] After obtaining the recovered concurrency value, important information such as the latest concurrency recovery times, adjusted concurrency value, recovery time, transaction code, etc. can also be stored in the task concurrency control cache parameters.

[0128] The method provided in the above embodiment periodically checks the transaction code in the task concurrency control cache parameter through a timer, so as to appropriately restore the concurrency value after a certain period of time from the concurrency adjustment control, thereby achieving a concurrency fluctuation effect, and finally adaptively finding a reasonable concurrency value.

[0129] The method provided in the embodiment of the present invention is mainly applicable to two scenarios (the concurrency value actually changes in a wave-like manner):

[0130] 1. As shown in Figure 4(a), the unreasonable setting of the concurrency value leads to the inability of downstream processing capacity to handle it. Through this solution, the equilibrium point of the concurrency value will eventually be reached in the form of fluctuations;

[0131] 2. As shown in Figure 4(b), when the concurrency setting is reasonable but the downstream performance occasionally degrades, the concurrency value will be greatly reduced, and then recovered through the recovery mechanism of this solution.

[0132] In both scenarios, the task concurrency control value can be dynamically controlled adaptively without manual intervention. In high concurrency situations, the number of task requests can be adaptively reduced, thereby reducing the number of business errors, reducing the risk of customer complaints and protecting downstream systems. After a period of reduction, the concurrency value can be increased through a recovery mechanism, so that transactions currently running on high-frequency adjustment devices can adaptively find reasonable concurrency values.

[0133] See also Figure 5, which shows a schematic diagram of main modules of a task concurrency control device 500 provided by an embodiment of the present invention, including:

[0134] The receiving module 501 is used to receive the processing exception message transmitted by the downstream system and obtain the error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task;

[0135] The acquisition module 502 is used to determine the latest number of error occurrences by querying the historical error report records corresponding to the error parameters, and then obtain the adjustment ratio corresponding to the latest number of error occurrences;

[0136] The adjustment module 503 is used to take the product of the adjustment ratio and the current concurrency value as the adjusted concurrency value to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0137] In the implementation device of the present invention, the error parameter includes an error code, and the device also includes an opening module, which is used to:

[0138] If the error code exists in the error list, it is determined whether the task concurrency control function is currently in the on state. If not, an on instruction is issued to switch the task concurrency control function from the off state to the on state.

[0139] In the implementation device of the present invention, the error parameter also includes a transaction code, and the acquisition module 502 is used to:

[0140] Query the historical error records corresponding to the transaction code; or

[0141] In the historical error records corresponding to the transaction code, query the historical error records corresponding to the error code.

[0142] In the implementation device of the present invention, the latest error occurrence number is the historical error occurrence number + 1, and the error parameter also includes the time when the current error occurred. The device also includes a first judgment module, which is used to:

[0143] When the number of the latest error occurrences is greater than 1, the time of the last error occurrence is obtained to calculate the time difference between the time of the last error occurrence and the time of the current error occurrence;

[0144] It is determined whether the time difference is greater than a first preset time difference threshold. If the determination result is yes, an adjustment ratio corresponding to the latest number of error occurrences is obtained; otherwise, the process is terminated.

[0145] In the implementation device of the present invention, the time when the last error occurred is stored in the task concurrency control cache parameter, and the device also includes a recording module for:

[0146] After determining the adjusted concurrency value, the error parameter, the latest error occurrence number and the adjusted concurrency value are recorded in the task concurrency control cache parameter.

[0147] In the implementation device of the present invention, the adjustment module 503 is used to:

[0148] If the transaction code is detected in the task concurrency control cache parameter, the adjusted concurrency value in the task concurrency control cache parameter is used to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0149] The implementation device of the present invention also includes a recovery module, which is used to:

[0150] Get the latest error occurrence time and adjusted concurrency value in the task concurrency control cache parameters;

[0151] Calculate the time difference between the current time and the time when the latest error occurred, and when the time difference reaches a second preset time difference threshold, determine the latest concurrent recovery number corresponding to the transaction code to obtain a recovery ratio corresponding to the latest concurrent recovery number;

[0152] The product of the previous concurrency value and the recovery ratio is used as the adjusted concurrency value to perform concurrency recovery control on the amount of subtasks sent to the downstream system.

[0153] The implementation device of the present invention also includes a second judgment module, which is used to:

[0154] If the latest error occurrence count is greater than a preset error occurrence count threshold, then stopping the task concurrency adjustment operation; and

[0155] If the latest concurrent recovery times is greater than the preset recovery times threshold, the task concurrent recovery operation is stopped.

[0156] In the implementation device of the present invention, the acquisition module 502 is used to: acquire the adjustment ratio of the latest error occurrence number in the adjustment ratio table; wherein the adjustment ratios in the adjustment ratio table are arranged in ascending order;

[0157] The recovery module is used to: obtain the recovery ratio of the latest concurrent recovery times in the recovery ratio table; wherein the recovery ratios in the recovery ratio table are arranged in descending order.

[0158] In the implementation device of the present invention, the recording module is also used to: after determining the adjusted concurrency value, record the latest concurrency recovery times, transaction code and adjusted concurrency value in the task concurrency control cache parameters.

[0159] In addition, the specific implementation content of the device described in the embodiment of the present invention has been described in detail in the method described above, so the repeated content will not be described again here.

[0160] Figure 6 An exemplary system architecture 600 to which embodiments of the present invention may be applied is shown, including terminal devices 601 , 602 , 603 , a network 604 and a server 605 (only an example).

[0161] Terminal devices 601, 602, 603 can be various electronic devices with display screens and supporting web browsing, and various communication client applications are installed. Users can use terminal devices 601, 602, 603 to interact with server 605 through network 604 to receive or send messages, etc.

[0162] The network 604 is used to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables.

[0163] The server 605 may be a server that provides various services. It should be noted that the method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the device is generally set in the server 605 .

[0164] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0165] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0166] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0167] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0168] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0169] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0170] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0171] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a receiving module, an acquisition module, and an adjustment module. The names of these modules do not, in some cases, constitute limitations on the modules themselves. For example, the adjustment module may also be described as an "adjustment control module."

[0172] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:

[0173] Receive a processing exception message transmitted by a downstream system, and obtain error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task;

[0174] By querying the historical error report records corresponding to the error parameters, determining the latest error occurrence number, and then obtaining the adjustment ratio corresponding to the latest error occurrence number;

[0175] The product of the adjustment ratio and the current concurrency value is used as the adjusted concurrency value to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

[0176] The computer program product of the present invention comprises a computer program, and when the computer program is executed by a processor, the task concurrency control method in the embodiment of the present invention is implemented.

[0177] According to the technical solution of the embodiment of the present invention, in the case of high concurrency, the number of task requests can be adaptively reduced, thereby reducing the number of business errors, reducing the risk of customer complaints and protecting downstream systems. After a period of reduction, the concurrency value can be increased through the recovery mechanism, so that the transactions currently running on the high-frequency adjustment device can adaptively find a reasonable concurrency value. And with business adjustments and version iterations, the control of the concurrency value can be adjusted automatically without manual intervention, so that enterprises can take the initiative in future development.

[0178] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A task concurrency control method, characterized in that: include: Receive a processing exception message transmitted by a downstream system, and obtain error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task; By querying the historical error report records corresponding to the error parameters, the latest error occurrence number is determined, and then the adjustment ratio corresponding to the latest error occurrence number is obtained; wherein the latest error occurrence number is the historical error occurrence number + 1, and the error parameters also include the time when the current error occurred. Before obtaining the adjustment ratio corresponding to the latest error occurrence number, it also includes: when the latest error occurrence number is greater than 1, obtaining the time when the last error occurred to calculate the time difference between the time when the last error occurred and the time when the current error occurred; judging whether the time difference is greater than a first preset time difference threshold, if the judgment result is yes, obtaining the adjustment ratio corresponding to the latest error occurrence number, otherwise terminating the process; The product of the adjustment ratio and the current concurrency value is used as the adjusted concurrency value to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

2. The method according to claim 1, characterized in that: The error parameter includes an error code, and before querying the historical error record corresponding to the error parameter, it also includes: If the error code exists in the error list, it is determined whether the task concurrency control function is currently in the on state. If not, an on instruction is issued to switch the task concurrency control function from the off state to the on state.

3. The method according to claim 2, characterized in that The error parameter also includes a transaction code, and the query of the historical error record corresponding to the error parameter includes: Query the historical error records corresponding to the transaction code; or In the historical error records corresponding to the transaction code, query the historical error records corresponding to the error code.

4. The method according to claim 3, characterized in that The time when the last error occurred is stored in the task concurrency control cache parameter, and the method further includes: After the adjusted concurrency value is determined, the error parameter, the latest error occurrence number and the adjusted concurrency value are recorded in the task concurrency control cache parameter.

5. The method according to claim 4, characterized in that The concurrent adjustment and control of the amount of subtasks sent to the downstream system includes: If the transaction code is detected in the task concurrency control cache parameter, the adjusted concurrency value in the task concurrency control cache parameter is used to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

6. The method according to claim 4 or 5, characterized in that: After the concurrent adjustment and control of the amount of subtasks sent to the downstream system, the method further includes: Get the latest error occurrence time and adjusted concurrency value in the task concurrency control cache parameters; Calculate the time difference between the current time and the time when the latest error occurred, and when the time difference reaches a second preset time difference threshold, determine the latest concurrent recovery number corresponding to the transaction code to obtain a recovery ratio corresponding to the latest concurrent recovery number; The product of the previous concurrency value and the recovery ratio is used as the adjusted concurrency value to perform concurrency recovery control on the amount of subtasks sent to the downstream system.

7. The method according to claim 6, characterized in that Before obtaining the adjustment ratio corresponding to the latest error occurrence number, the method further includes: if the latest error occurrence number is greater than a preset error occurrence number threshold, stopping the task concurrency adjustment operation; Before obtaining the recovery ratio corresponding to the latest concurrent recovery number, the method further includes: if the latest concurrent recovery number is greater than a preset recovery number threshold, stopping the task concurrent recovery operation.

8. The method according to claim 6, characterized in that The obtaining of the adjustment ratio corresponding to the latest number of error occurrences includes: obtaining the adjustment ratio of the latest number of error occurrences in the adjustment ratio table; wherein the adjustment ratios in the adjustment ratio table are arranged in ascending order; The obtaining of the recovery ratio corresponding to the latest concurrent recovery number includes: obtaining a recovery ratio in a recovery ratio table, the recovery ratio being arranged at the latest concurrent recovery number; wherein the recovery ratios in the recovery ratio table are arranged in descending order.

9. The method according to claim 6, characterized in that After multiplying the previous concurrency value by the recovery ratio as the adjusted concurrency value, the method further includes: After determining the adjusted concurrency value, the latest concurrency recovery times, the transaction code and the adjusted concurrency value are recorded in the task concurrency control cache parameters.

10. A task concurrency control device, characterized in that: include: A receiving module, used to receive a processing exception message transmitted by a downstream system, and obtain error parameters in the processing exception message; wherein the downstream system is used to receive and process the issued subtasks, and the subtasks are obtained by splitting the main task; An acquisition module, used to determine the latest error occurrence number by querying the historical error report record corresponding to the error parameter, and then obtain the adjustment ratio corresponding to the latest error occurrence number; the latest error occurrence number is the historical error occurrence number + 1, and the error parameter also includes the time when the current error occurred; An adjustment module, used to take the product of the adjustment ratio and the current concurrency value as the adjusted concurrency value, so as to perform concurrency adjustment control on the amount of subtasks sent to the downstream system; The device also includes a first judgment module, which is used to obtain the time of the last error occurrence when the latest error occurrence number is greater than 1, so as to calculate the time difference between the last error occurrence time and the current error occurrence time; judge whether the time difference is greater than a first preset time difference threshold, if the judgment result is yes, obtain the adjustment ratio corresponding to the latest error occurrence number, otherwise end the process.

11. The device according to claim 10, characterized in that The error parameter includes an error code, and the device also includes an opening module, which is used to: If the error code exists in the error list, it is determined whether the task concurrency control function is currently in the on state. If not, an on instruction is issued to switch the task concurrency control function from the off state to the on state.

12. The device according to claim 11, characterized in that The error parameter also includes a transaction code, and the acquisition module is used to: Query the historical error records corresponding to the transaction code; or In the historical error records corresponding to the transaction code, query the historical error records corresponding to the error code.

13. The device according to claim 12, characterized in that The time when the last error occurred is stored in the task concurrency control cache parameter, and the device also includes a recording module for: After the adjusted concurrency value is determined, the error parameter, the latest error occurrence number and the adjusted concurrency value are recorded in the task concurrency control cache parameter.

14. The device according to claim 13, characterized in that The adjustment module is used for: If the transaction code is detected in the task concurrency control cache parameter, the adjusted concurrency value in the task concurrency control cache parameter is used to perform concurrency adjustment control on the amount of subtasks sent to the downstream system.

15. The device according to claim 13 or 14, characterized in that Also includes recovery modules for: Get the latest error occurrence time and adjusted concurrency value in the task concurrency control cache parameters; Calculate the time difference between the current time and the time when the latest error occurred, and when the time difference reaches a second preset time difference threshold, determine the latest concurrent recovery number corresponding to the transaction code to obtain a recovery ratio corresponding to the latest concurrent recovery number; The product of the previous concurrency value and the recovery ratio is used as the adjusted concurrency value to perform concurrency recovery control on the amount of subtasks sent to the downstream system.

16. The device according to claim 15, characterized in that It also includes a second judgment module, which is used for: If the latest error occurrence count is greater than a preset error occurrence count threshold, then stopping the task concurrency adjustment operation; and If the latest concurrent recovery times is greater than the preset recovery times threshold, the task concurrent recovery operation is stopped.

17. The device according to claim 15, characterized in that The acquisition module is used to: acquire the adjustment ratio of the adjustment ratio table, the arrangement position of which is the number of the latest error occurrences; wherein the adjustment ratios in the adjustment ratio table are arranged in ascending order; The recovery module is used to: obtain the recovery ratio of the latest concurrent recovery times in the recovery ratio table; wherein the recovery ratios in the recovery ratio table are arranged in descending order.

18. The device according to claim 15, characterized in that The recording module is further used to: after determining the adjusted concurrency value, record the latest concurrency recovery times, the transaction code and the adjusted concurrency value in the task concurrency control cache parameters.

19. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 9.

20. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

21. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Multi-dimensional access flow control system

    CN113765821A