A serial-parallel hybrid processing method, device, equipment and medium
By dividing the main task into parallel and serial shards and performing corresponding processing, the problem of low task processing efficiency in the existing technology is solved, and more efficient task processing is achieved.
Patent Information
- Application Number
- CN202210957421.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-10
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2042-08-10
AI Technical Summary
In the prior art, subtasks under a main task can only be processed in serial or in parallel, resulting in poor efficiency when processing a large number of tasks and cannot complete task processing efficiently and quickly.
By dividing the main task into a subtask based on the business scenario type and assigning it to parallel shards or serial shards according to the processing strategy of the subtasks, the combination of parallel processing and serial processing is realized, and parallel shards are used for parallel processing. Serial processing is performed with serial shards.
It improves the processing efficiency of batch sub-tasks, improves the processing capability of batch tasks, and saves processing time.
Smart Images

Figure CN115237576B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of task scheduling, and specifically to a serial-parallel hybrid processing method, device, equipment and medium. Background Art
[0002] The computer processes tasks in two types: parallel processing and sequential processing. Usually, parallel processing is managed through thread pool management, that is, all tasks to be executed are thrown into the thread pool to achieve concurrency, so that tasks can be processed quickly; sequential processing is managed through thread management, that is, only one thread is opened to process tasks, and only when one task is completed can the next task be carried out, thus achieving sequential execution.
[0003] Currently, there are only two processing modes for each subtask under a main task: all serial processing or all parallel processing. Summary of the invention
[0004] The embodiments of the present application provide a serial-parallel hybrid processing method, apparatus, device and medium for solving the problem that the processing of each subtask under a main task can only be all serially processed or all parallel processed.
[0005] In a first aspect, a serial-parallel hybrid processing method includes:
[0006] Based on the business scenario type, the main task to be processed is divided into multiple subtasks, among which the type of the main task to be processed is the batch pending payment type;
[0007] Based on the correspondence between the preset business scenario type and the processing strategy, determine the target processing strategy corresponding to each subtask;
[0008] Put each subtask of the target processing strategy that belongs to the parallel processing strategy into different parallel slices;
[0009] Put each subtask of the target processing strategy that belongs to the serial processing strategy into different serial slices;
[0010] Parallel processing is performed between each parallel slice and each serial slice. Each subtask in each parallel slice is processed in parallel, and each subtask in the same serial slice is processed serially.
[0011] In an embodiment of the present application, the main task to be processed is divided into multiple subtasks according to the business scenario type, and the target processing strategy corresponding to each subtask is further determined. On this basis, each subtask belonging to the parallel processing strategy is placed in a different parallel slice, and each subtask belonging to the serial processing strategy is placed in a different serial slice. In this way, all parallel slices and all serial slices are processed in parallel, and each subtask in each parallel slice is processed in parallel, and each subtask in the same serial slice is processed serially. This realizes the mixed serial and parallel processing of each subtask under the same main task, thereby saving the processing time of batch subtasks and improving the processing efficiency of batch subtasks.
[0012] In a possible embodiment, whether the type of the main task to be processed is a batch payment type is determined in the following manner:
[0013] Extracting corresponding account information from each pending item included in the pending main task, wherein the total number of each pending item exceeds a first preset threshold;
[0014] If the payment types corresponding to the account information are inconsistent, the type of the main task to be processed is determined to be a batch payment type, where the payment type includes expenditure and collection.
[0015] In a possible embodiment, based on the business scenario type, the main task to be processed is divided into multiple subtasks, including:
[0016] Based on the account information and payment type corresponding to each pending item in the pending main task, determine the business scenario type corresponding to each pending item;
[0017] The pending items belonging to the same business scenario type are divided into the same subtask, where there are multiple business scenario types.
[0018] In a possible embodiment, each subtask of which the target processing strategy belongs to the parallel processing strategy is placed in different parallel slices, including:
[0019] Based on the execution order of each subtask, the subtasks of which the target processing strategy belongs to the parallel processing strategy are summarized to obtain the total number of subtasks that need to be processed in parallel;
[0020] Based on the capacity and total number of parallel shards, the aggregated subtasks are placed in different parallel shards.
[0021] In a possible embodiment, each subtask of which the target processing strategy belongs to the serial processing strategy is placed in different serial slices, including:
[0022] Aggregate each subtask of the target processing strategy that belongs to the serial processing strategy according to different account information to obtain multiple aggregated serial groups;
[0023] Determine the serial slices corresponding to each serial group, and put the subtasks in different serial groups into the corresponding serial slices.
[0024] In a possible embodiment, subtasks in different serial groups are respectively placed into corresponding serial slices, including:
[0025] If it is monitored that the total number of subtasks that need to be processed serially exceeds the target serial grouping capacity of the corresponding serial slice, at least two serial slices with a total number of subtasks of zero are merged into a summary serial slice, and the subtasks in the target serial grouping are placed in the summary serial slice.
[0026] In a second aspect, the present application provides a serial-parallel hybrid processing device, the device comprising:
[0027] A division module is used to divide the main task to be processed into multiple subtasks based on the business scenario type, wherein the type of the main task to be processed is a batch payment type;
[0028] A determination module, used to determine the target processing strategy corresponding to each subtask based on the correspondence between the preset business scenario type and the processing strategy;
[0029] The first placing module is used to place each subtask of the target processing strategy belonging to the parallel processing strategy into different parallel slices;
[0030] The second placing module is used to place each subtask of the target processing strategy belonging to the serial processing strategy into different serial slices;
[0031] The processing module is used to perform parallel processing between each parallel slice and each serial slice, to process each subtask in each parallel slice in parallel, and to process each subtask in the same serial slice in series.
[0032] In a possible embodiment, whether the type of the main task to be processed is a batch payment type is determined in the following manner:
[0033] Extracting corresponding account information from each pending item included in the pending main task, wherein the total number of each pending item exceeds a first preset threshold;
[0034] If the payment types corresponding to the account information are inconsistent, the type of the main task to be processed is determined to be a batch payment type, where the payment type includes expenditure and collection.
[0035] In a possible embodiment, based on the business scenario type, the main task to be processed is divided into multiple subtasks, and the division module is used to:
[0036] Based on the account information and payment type corresponding to each pending item in the pending main task, determine the business scenario type corresponding to each pending item;
[0037] The pending items belonging to the same business scenario type are divided into the same subtask, where there are multiple business scenario types.
[0038] In a possible embodiment, each subtask whose target processing strategy belongs to the parallel processing strategy is placed in different parallel slices respectively, and the first placing module is used for:
[0039] Based on the execution order of each subtask, the subtasks of which the target processing strategy belongs to the parallel processing strategy are summarized to obtain the total number of subtasks that need to be processed in parallel;
[0040] Based on the capacity and total number of parallel shards, the aggregated subtasks are placed in different parallel shards.
[0041] In a possible embodiment, each subtask whose target processing strategy belongs to the serial processing strategy is placed in different serial slices respectively, and the second placing module is used for:
[0042] Aggregate each subtask of the target processing strategy that belongs to the serial processing strategy according to different account information to obtain multiple aggregated serial groups;
[0043] Determine the serial slices corresponding to each serial group, and put the subtasks in different serial groups into the corresponding serial slices.
[0044] In a possible embodiment, subtasks in different serial groups are respectively placed into corresponding serial slices, and the second placing module is used to:
[0045] If it is monitored that the total number of subtasks that need to be processed serially exceeds the target serial grouping capacity of the corresponding serial slice, at least two serial slices with a total number of subtasks of zero are merged into a summary serial slice, and the subtasks in the target serial grouping are placed in the summary serial slice.
[0046] In a third aspect, the present application provides an electronic device, including:
[0047] A memory for storing program instructions;
[0048] The processor is used to call the program instructions stored in the memory, and execute the steps included in any one of the methods in the first aspect according to the obtained program instructions.
[0049] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes any one of the methods described in the first aspect.
[0050] In a fifth aspect, the present application provides a computer program product, comprising: a computer program code, when the computer program code is run on a computer, the computer executes any one of the methods described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] Figure 1 A schematic diagram of a serial-parallel hybrid processing provided in an embodiment of the present application;
[0052] Figure 2 A flowchart of a serial-parallel hybrid processing method provided in an embodiment of the present application;
[0053] Figure 3 A flowchart of dividing a main task to be processed into multiple subtasks provided in an embodiment of the present application;
[0054] Figure 4 A flowchart of placing each subtask belonging to a parallel processing strategy into parallel slices provided in an embodiment of the present application;
[0055] Figure 5 A flowchart of placing each subtask belonging to the serial processing strategy into serial slices provided in an embodiment of the present application;
[0056] Figure 6 A structural diagram of a serial-parallel hybrid processing device provided in an embodiment of the present application;
[0057] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical scheme and advantages of the present application clearer, the technical scheme in the embodiment of the present application will be clearly and completely described below in conjunction with the drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In the absence of conflict, the embodiments in the present application and the features in the embodiments can be arbitrarily combined with each other. In addition, although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here.
[0059] The terms "first" and "second" in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the term "comprising" and any of their variations are intended to cover non-exclusive protection. For example, a process, method, system, product or device comprising a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. "Multiple" in the present application can mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.
[0060] In the technical solution of this application, the collection, dissemination, and use of data are in compliance with the requirements of relevant national laws and regulations.
[0061] Before introducing a serial-parallel hybrid processing method provided by an embodiment of the present application, in order to facilitate understanding, the technical background of the embodiment of the present application is first introduced in detail below.
[0062] When computers process tasks, they divide them into two processing methods: parallel processing and sequential processing. Usually, parallel processing is managed through thread pools, that is, all tasks to be executed are thrown into the thread pool to achieve concurrency, so that tasks can be processed quickly; sequential processing is managed through threads, that is, only one thread is opened to process tasks, and only when one task is completed can the next task be processed, thus achieving sequential execution. However, when the number of businesses is large, that is, when there are many tasks to be processed, the above-mentioned methods of only serial processing or only parallel processing have poor processing efficiency and cannot efficiently and quickly complete the processing of all tasks.
[0063] In order to solve the above-mentioned problem of poor efficiency in batch task processing, preferred implementations of the present disclosure are described in detail below with reference to the accompanying drawings.
[0064] See also Figure 1 As shown, in the embodiment of the present disclosure, the system includes at least one computer. Figure 1 In the example, there may be multiple main tasks that the computer needs to process. For the main tasks of the batch payment type, the computer puts the multiple subtasks included in the main task into different parallel slices and serial slices respectively, so as to process the parallel slices and serial slices at the same time. The following is a detailed introduction.
[0065] See also Figure 2 As shown, in the embodiment of the present disclosure, the specific process of the serial-parallel hybrid processing method is as follows:
[0066] Step 201: Based on the business scenario type, the main task to be processed is divided into multiple subtasks, wherein the type of the main task to be processed is a batch payment type.
[0067] It should be noted that, since there are various types of main tasks to be processed, if the number of items to be processed included in the main tasks to be processed is small, the above items to be processed can be directly processed by serial processing or parallel processing; if the number of items to be processed included in the main tasks to be processed is large, the efficiency of processing the above items to be processed by serial processing or parallel processing will be poor, so it is necessary to first identify the type of the main tasks to be processed. Specifically, determine whether the type of the main tasks to be processed is a batch payment type by the following method:
[0068] (1) extracting corresponding account information from each pending item included in the pending main task, wherein the total number of each pending item exceeds a first preset threshold.
[0069] During the implementation process, it is first necessary to determine whether the total number of each pending item included in the pending main task exceeds a first preset threshold. The specific value of the first preset threshold here can be flexibly set according to the actual usage scenario.
[0070] When it is determined that the total number of each pending item exceeds the first preset threshold, that is, the above-mentioned main task to be processed is determined to be a batch processing task, the corresponding account information is further extracted from the above-mentioned each pending item. For example, the format of the account information can be pre-defined, and during the implementation process, the account information corresponding to the above-mentioned format is extracted from each of the above-mentioned pending items.
[0071] (2) If the payment types corresponding to the account information are inconsistent, the type of the main task to be processed is determined to be a batch payment type, where the payment type includes expenditure and collection.
[0072] After determining the account information corresponding to each pending item, further determine the payment type corresponding to the account information included in the corresponding pending item, that is, whether the account information is expenditure or collection. During implementation, if the payment type corresponding to the same (or different) account information includes both expenditure and collection, then determine the type of the pending main task to be processed as a batch pending collection and payment type.
[0073] For example, the payment type corresponding to the account information Li includes continuous expenditures. At the same time, the payment type corresponding to Li also includes fees collected from the account information Wang. In this case, the type of the main task to be processed is determined to be a batch payment and collection type.
[0074] For another example, the payment type corresponding to the account information Zhang includes continuous expenditure, the payment type corresponding to the account information Yu includes continuous expenditure, and the payment type corresponding to the account information Wang includes collection. In this case, the type of the main task to be processed is determined to be a batch payment and collection type.
[0075] After determining that the type of the main task to be processed is a batch pending payment type, divide the main task to be processed into multiple subtasks based on the business scenario type. Figure 3 As shown, including:
[0076] Step 2011: Based on the account information and payment type corresponding to each pending item in the pending main task, determine the business scenario type corresponding to each pending item.
[0077] Considering that the number of pending items included in the pending main task is large, and the execution process of some of the pending items is similar, based on this, it is necessary to summarize the above-mentioned pending items. In the specific implementation process, the business scenario type corresponding to each pending item is determined according to the account information and payment type corresponding to each pending item, and there are multiple business scenario types. It should be noted that the above-mentioned business scenario types are usually pre-set. For example, the business scenario types can be pre-set to type A, type B, type C and type D.
[0078] For example, determine that the account information corresponding to the pending item a is a1 and the payment type is a2, and determine that the business scenario type corresponding to the above pending item a is a1+a2. Assuming that a1+a2 is equivalent to type A, then set the business scenario type corresponding to the pending item a to A.
[0079] For another example, it is determined that the account information corresponding to the pending item m is m1 and the payment type is m2, and it is determined that the business scenario type corresponding to the pending item m is m1+m2. Assuming that m1+m2 is equivalent to type A, then the business scenario type corresponding to the pending item m is set to A.
[0080] For another example, it is determined that the account information corresponding to the pending item b is b1 and the payment type is b2, and it is determined that the business scenario type corresponding to the pending item b is b1+b2. Assuming that b1+b2 is equivalent to type B, then the business scenario type corresponding to the pending item b is set to B.
[0081] Step 2012: Divide the pending items belonging to the same business scenario type into the same subtask.
[0082] During the implementation process, after determining the business scenario type corresponding to each pending item, the pending items belonging to the same business scenario type are divided into the same subtask. In this way, each pending item in the pending main task will be divided into multiple subtasks according to the business scenario type.
[0083] Still using the examples in step 2011 above to illustrate, the pending items a and m are divided into subtask A, and the pending item b is divided into subtask B.
[0084] Step 202: Based on the preset correspondence between the business scenario type and the processing strategy, determine the target processing strategy corresponding to each subtask.
[0085] During the implementation process, after obtaining the divided subtasks, it is further determined whether the subtask is a subtask that needs to be processed serially or in parallel. Specifically, according to the business scenario type corresponding to the subtask, the corresponding processing strategy is searched in the correspondence between the preset business scenario type and the processing strategy, and the found processing strategy is determined as the target processing strategy corresponding to the above subtask.
[0086] It should be noted that the above processing strategies include serial processing strategies and parallel processing strategies. The processing strategy corresponding to a certain business scenario type is either a serial processing strategy or a parallel processing strategy.
[0087] After determining the target processing strategy corresponding to each subtask, the above subtasks are respectively placed in different slices for different processing according to whether the subtask is a serial processing strategy or a parallel processing strategy.
[0088] Step 203: Put each subtask of the target processing strategy belonging to the parallel processing strategy into different parallel slices.
[0089] Since there are multiple shards in the database corresponding to each subtask, in order to improve the processing efficiency of the above subtasks, the above multiple shards are divided into parallel shards and serial shards, wherein the parallel shards are used to store the subtasks belonging to the parallel processing strategy, and the serial shards are used to store the subtasks belonging to the serial processing strategy.
[0090] The following is a description of the steps to put subtasks into different parallel shards. Figure 4 As shown, including:
[0091] Step 2031: Based on the execution order of each subtask, the subtasks whose target processing strategy belongs to the parallel processing strategy are aggregated to obtain the total number of subtasks that need to be processed in parallel.
[0092] Taking into account that different subtasks belonging to the parallel processing strategy may be related, the execution order of each subtask is determined, and the subtasks belonging to the parallel processing strategy of the target processing strategy are summarized in the order of the above execution order. For example, the subtasks belonging to the parallel processing strategy are summarized into a list.
[0093] Furthermore, the total number of subtasks that need to be processed in parallel is obtained, for example, the total number is determined by obtaining the length of the linked list, etc., that is, after aggregation, not only multiple subtasks arranged in order of execution are obtained, but also the total number of the multiple subtasks is determined.
[0094] Step 2032: Based on the capacity and total number of parallel shards, the aggregated subtasks are placed into different parallel shards.
[0095] Usually, the capacity of a shard is determined by the type of computer on which it is located. Therefore, during implementation, it is necessary to determine the capacity of the parallel shards. In this way, the number of parallel shards required can be determined by the capacity and the above total number, and then the above-mentioned summarized subtasks can be placed in different parallel shards, that is, the summarized subtasks are segmented according to the capacity of the parallel shards. In this way, each segment of the summarized subtasks can be placed in and fill a parallel shard.
[0096] For example, the total number of the aggregated subtasks is 1000, and the capacity of the parallel shard is 100. Thus, the aggregated subtasks are divided into 10 segments, and each segment is placed in a parallel shard, thereby obtaining 10 parallel shards.
[0097] Step 204: Put each subtask of the target processing strategy belonging to the serial processing strategy into different serial slices.
[0098] The following is a description of the steps to put subtasks into different serial slices. Figure 5 As shown, including:
[0099] Step 2041: The subtasks of the target processing strategy belonging to the serial processing strategy are aggregated according to different account information to obtain a plurality of aggregated serial groups.
[0100] Considering that each subtask belonging to the serial processing strategy needs to be executed in sequence, specifically, each subtask belonging to the same account information must be executed in sequence. Therefore, during the implementation process, it is necessary to summarize each subtask belonging to the serial processing strategy of the target processing strategy according to the different account information, so as to obtain multiple summarized serial groups. That is, each subtask belonging to the serial processing strategy is split into different serial groups, so that each subtask in each serial group is executed in sequence, and different serial groups can be executed in parallel.
[0101] Step 2042: Determine the serial slices corresponding to each serial group, and put the subtasks in different serial groups into the corresponding serial slices.
[0102] During the implementation process, the serial shards corresponding to each serial group are first determined, and the determination principle here can be flexibly set according to the usage scenario. Further, the subtasks in different serial groups are placed in the corresponding serial shards, that is, multiple subtasks in the serial group corresponding to the same account information are placed in one serial shard.
[0103] In addition, it should be noted that since the capacity of the serial shards is also limited, if it is monitored that the total number of subtasks that need to be processed serially exceeds the target serial grouping of the capacity of the corresponding serial shards, at least two serial shards with a total number of zero subtasks will be merged into an aggregated serial shard, and the subtasks in the target serial grouping will be placed in the aggregated serial shard.
[0104] Assume that the total number of subtasks that need to be processed serially in the target serial group 1 is 200, and the capacity of the serial shard is 100. In this case, at least two serial shards that have not yet stored subtasks are merged to obtain an aggregated serial shard. The new capacity of this aggregated serial shard is 200. Then, all the subtasks that need to be processed serially in the target serial group 1 are placed in the aggregated serial shard.
[0105] Step 205: perform parallel processing on each parallel slice and each serial slice, perform parallel processing on each subtask in each parallel slice, and perform serial processing on each subtask in the same serial slice.
[0106] During the implementation, after placing each subtask into each parallel slice and each serial slice, each parallel slice and each serial slice are processed in parallel. For example, multiple processes are established, each process corresponds to a parallel slice or a serial slice, and the multiple processes are started at the same time to start processing each slice. Specifically, each subtask in each parallel slice is processed in parallel, and each subtask in the same serial slice is processed serially. For example, multiple threads are established, each thread corresponds to each subtask in a parallel slice or the first subtask in a serial slice, and the multiple threads are started at the same time to start processing each subtask.
[0107] Based on the same inventive concept, the present application embodiment provides a serial-parallel hybrid processing device, see Figure 6 As shown, the device comprises:
[0108] A division module 601 is used to divide the main task to be processed into multiple subtasks based on the business scenario type, wherein the type of the main task to be processed is a batch payment type;
[0109] Determination module 602, used to determine the target processing strategy corresponding to each subtask based on the correspondence between the preset business scenario type and the processing strategy;
[0110] The first placing module 603 is used to place each subtask of the target processing strategy belonging to the parallel processing strategy into different parallel slices;
[0111] The second placing module 604 is used to place each subtask whose target processing strategy belongs to the serial processing strategy into different serial slices;
[0112] The processing module 605 is used to perform parallel processing between each parallel slice and each serial slice, to perform parallel processing on each subtask in each parallel slice, and to perform serial processing on each subtask in the same serial slice.
[0113] In a possible embodiment, whether the type of the main task to be processed is a batch payment type is determined in the following manner:
[0114] Extracting corresponding account information from each pending item included in the pending main task, wherein the total number of each pending item exceeds a first preset threshold;
[0115] If the payment types corresponding to the account information are inconsistent, the type of the main task to be processed is determined to be a batch payment type, where the payment type includes expenditure and collection.
[0116] In a possible embodiment, based on the business scenario type, the main task to be processed is divided into multiple subtasks, and the division module 601 is used to:
[0117] Based on the account information and payment type corresponding to each pending item in the pending main task, determine the business scenario type corresponding to each pending item;
[0118] The pending items belonging to the same business scenario type are divided into the same subtask, where there are multiple business scenario types.
[0119] In a possible embodiment, each subtask whose target processing strategy belongs to the parallel processing strategy is placed in different parallel slices respectively, and the first placing module 603 is used to:
[0120] Based on the execution order of each subtask, the subtasks of which the target processing strategy belongs to the parallel processing strategy are summarized to obtain the total number of subtasks that need to be processed in parallel;
[0121] Based on the capacity and total number of parallel shards, the aggregated subtasks are placed in different parallel shards.
[0122] In a possible embodiment, each subtask whose target processing strategy belongs to the serial processing strategy is placed in different serial slices respectively, and the second placing module 604 is used to:
[0123] Aggregate each subtask of the target processing strategy that belongs to the serial processing strategy according to different account information to obtain multiple aggregated serial groups;
[0124] Determine the serial slices corresponding to each serial group, and put the subtasks in different serial groups into the corresponding serial slices.
[0125] In a possible embodiment, subtasks in different serial groups are respectively placed into corresponding serial slices, and the second placing module 604 is used to:
[0126] If it is monitored that the total number of subtasks that need to be processed serially exceeds the target serial grouping capacity of the corresponding serial slice, at least two serial slices with a total number of subtasks of zero are merged into a summary serial slice, and the subtasks in the target serial grouping are placed in the summary serial slice.
[0127] Based on the same inventive concept, an embodiment of the present application provides an electronic device, which can implement the functions of the page switching device discussed above, see Figure 7 As shown, the device includes a processor 701 and a memory 702, wherein the memory 702 stores program code, and when the program code is executed by the processor, the processor 701 executes the steps of the serial-parallel hybrid processing method according to various exemplary embodiments of the present application described above in this specification.
[0128] Based on the same inventive concept, the embodiment of the present application provides a computer-readable storage medium, and the computer program product includes: computer program code, when the computer program code is run on a computer, the computer executes any of the serial-parallel hybrid processing methods discussed above. Since the principle of solving the problem by the above-mentioned computer-readable storage medium is similar to that of the serial-parallel hybrid processing method, the implementation of the above-mentioned computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0129] Based on the same inventive concept, the embodiment of the present application further provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes any of the serial-parallel hybrid processing methods discussed above. Since the principle of solving the problem by the above-mentioned computer program product is similar to that of the serial-parallel hybrid processing method, the implementation of the above-mentioned computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.
[0130] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0131] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0132] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0133] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of user-operated steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0134] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A serial-parallel hybrid processing method, characterized in that: The method comprises: Based on the business scenario type, the main task to be processed is divided into multiple subtasks, wherein the type of the main task to be processed is a batch pending payment type, and whether the type of the main task to be processed is a batch pending payment type is determined in the following manner: extracting corresponding account information from each pending item included in the main task to be processed, and the total number of each pending item exceeds a first preset threshold value. If the payment types corresponding to each of the account information are inconsistent, then determining that the type of the main task to be processed is a batch pending payment type, and the payment type includes expenditure and collection; Determine the target processing strategy corresponding to each of the subtasks based on the correspondence between the preset business scenario type and the processing strategy; Putting each of the subtasks of the target processing strategy belonging to the parallel processing strategy into different parallel slices respectively; Summarize the subtasks of the target processing strategy that belong to the serial processing strategy according to different account information to obtain a plurality of serial groups after summarization, and determine the serial slices corresponding to each serial group, and put the subtasks in different serial groups into the corresponding serial slices, wherein each subtask in each serial group is executed in sequence, and different serial groups are executed in parallel; Parallel processing is performed between each of the parallel slices and each of the serial slices, each subtask in each parallel slice is processed in parallel, and each subtask in the same serial slice is processed serially, wherein each subtask in the parallel slice corresponds to a thread, and each subtask in the serial slice corresponds to a thread.
2. The method according to claim 1, characterized in that Based on the business scenario type, the main task to be processed is divided into multiple subtasks, including: Based on the account information and the payment type corresponding to each of the pending items in the pending main task, determine the business scenario type corresponding to each of the pending items; The pending matters belonging to the same business scenario type are divided into the same subtask, wherein there are multiple business scenario types.
3. The method according to claim 1, characterized in that The step of placing each of the subtasks of the target processing strategy belonging to the parallel processing strategy into different parallel slices includes: Based on the execution order of each of the subtasks, the subtasks of which the target processing strategy belongs to the parallel processing strategy are aggregated to obtain the total number of subtasks that need to be processed in parallel; Based on the capacity of the parallel slices and the total number, the aggregated subtasks are respectively placed in different parallel slices.
4. The method according to claim 3, characterized in that The step of placing the subtasks in different serial groups into corresponding serial slices respectively includes: If it is monitored that the total number of subtasks that need to be processed serially exceeds the target serial grouping of the capacity of the corresponding serial slice, at least two of the serial slices whose total number of subtasks is zero are merged into an aggregated serial slice, and the subtasks in the target serial group are placed in the aggregated serial slice.
5. A serial-parallel hybrid processing device, characterized in that: include: A division module is used to divide the main task to be processed into multiple subtasks based on the business scenario type, wherein the type of the main task to be processed is a batch pending payment type, and whether the type of the main task to be processed is a batch pending payment type is determined in the following manner: extracting corresponding account information from each pending item included in the main task to be processed, and the total number of each pending item exceeds a first preset threshold value. If the payment types corresponding to each of the account information are inconsistent, then determining that the type of the main task to be processed is a batch pending payment type, and the payment type includes expenditure and collection; A determination module, used to determine the target processing strategy corresponding to each of the subtasks based on the correspondence between the preset business scenario type and the processing strategy; A first placing module is used to place each of the subtasks of the target processing strategy belonging to the parallel processing strategy into different parallel slices; The second placing module is used to summarize the subtasks of the target processing strategy belonging to the serial processing strategy according to different account information to obtain a plurality of summarized serial groups, and respectively determine the serial slices corresponding to each serial group, and respectively place the subtasks in different serial groups into the corresponding serial slices, wherein each subtask in each serial group is executed in sequence, and different serial groups are executed in parallel; A processing module is used to perform parallel processing between each of the parallel slices and each of the serial slices, to process each subtask in each of the parallel slices in parallel, and to process each subtask in the same serial slice in serial, wherein each subtask in the parallel slice corresponds to a thread, and each subtask in the serial slice corresponds to a thread.
6. An electronic device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the steps included in any one of claims 1-4 according to the obtained program instructions.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method according to any one of claims 1 to 4.
8. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is caused to execute the method according to any one of claims 1 to 4.
