WO2022105531A1 - Distributed multi-task management method and apparatus, and computer device and storage medium - Google Patents

Distributed multi-task management method and apparatus, and computer device and storage medium Download PDF

Info

Publication number
WO2022105531A1
WO2022105531A1 PCT/CN2021/125570 CN2021125570W WO2022105531A1 WO 2022105531 A1 WO2022105531 A1 WO 2022105531A1 CN 2021125570 W CN2021125570 W CN 2021125570W WO 2022105531 A1 WO2022105531 A1 WO 2022105531A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
execution
processed
tasks
target
Prior art date
Application number
PCT/CN2021/125570
Other languages
French (fr)
Chinese (zh)
Inventor
张位勇
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2022105531A1 publication Critical patent/WO2022105531A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5083Techniques for rebalancing the load in a distributed system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5018Thread allocation

Definitions

  • the present application relates to the field of computer technologies, and in particular, to a distributed multitasking management method, apparatus, computer equipment, and storage medium.
  • a task is usually automatically allocated to one or more execution nodes for processing through a lock mechanism.
  • this method has centralized processing on some nodes.
  • CPU resources and even downtime For example, currently there are 6 tasks to be executed, each task to be executed corresponds to a lock, if the node A To grab five locks, you need to execute five tasks to be executed.
  • the load of this node is much larger than that of other nodes, resulting in the problem of node load imbalance.
  • the invention also realizes that there are two tasks (forward task and backward task) with execution dependencies in the prior art, and the backward task may be executed first. Backward tasks are repeatedly executed, wasting resources.
  • Embodiments of the present application provide a distributed multitasking management method, apparatus, computer equipment, and storage medium, so as to solve the problems of unbalanced node load and waste of resources.
  • a distributed multitasking management method comprising:
  • a thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
  • a distributed multitasking management device comprising:
  • a task set traversal module configured to obtain a task execution request, and traverse the task set created on the distributed middleware based on the task execution request;
  • a target array acquisition module used to obtain at least two target arrays in the task set, each of the target arrays including the task ID and the task sequence number of the task to be processed;
  • a target execution node determination module configured to obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the to-be-processed tasks according to the task sequence number and the number of execution nodes;
  • the execution result obtaining module is configured to call threads corresponding to the number of execution nodes, execute at least two tasks to be processed, and obtain execution results corresponding to at least two tasks to be processed.
  • a computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer-readable instructions:
  • a thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
  • One or more readable storage media having computer-readable instructions stored thereon, the computer-readable storage media having computer-readable instructions stored thereon, wherein the computer-readable instructions, when executed by one or more processors, cause all The one or more processors perform the following steps:
  • a thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
  • the above-mentioned distributed multi-task management method, device, computer equipment and storage medium obtains a task execution request, traverses the task set created on the distributed middleware based on the task execution request, and provides technical support for the subsequent realization of the equal distribution of pending tasks .
  • the server reads the target array, it can intelligently assign the task to be processed to In the execution node, an even distribution is achieved.
  • Obtain the number of execution nodes corresponding to the idle execution nodes determine the target execution node corresponding to each of the pending tasks according to the task sequence number and the number of execution nodes, and evenly distribute the pending tasks to the idle execution nodes.
  • the processing logic is simple and efficient. Efficient, speeding up the execution of pending tasks. Solve the problem of uneven distribution in the lock mechanism, resulting in excessive load on some execution nodes and small load on some execution nodes.
  • the threads corresponding to the number of execution nodes are called to execute at least two of the to-be-processed tasks, and execution results corresponding to at least two of the to-be-processed tasks are acquired, so as to process the to-be-processed tasks.
  • FIG. 1 is a schematic diagram of an application environment of a distributed multitasking management method in an embodiment of the present application
  • FIG. 2 is a flowchart of a distributed multitasking management method in an embodiment of the present application
  • FIG. 3 is another flowchart of a distributed multitasking management method in an embodiment of the present application.
  • FIG. 5 is another flowchart of a distributed multitasking management method in an embodiment of the present application.
  • FIG. 6 is another flowchart of a distributed multitasking management method in an embodiment of the present application.
  • FIG. 7 is another flowchart of a distributed multitasking management method in an embodiment of the present application.
  • FIG. 8 is a schematic diagram of a distributed multitasking management device in an embodiment of the present application.
  • FIG. 9 is a schematic diagram of a computer device in an embodiment of the present application.
  • the distributed multi-task management method provided by the embodiment of the present application can be applied in the application environment shown in FIG. 1 .
  • the distributed multitasking management method is applied in a distributed multitasking management system, and the distributed multitasking management system includes N clients and servers as shown in FIG.
  • Communication is used to evenly distribute tasks to be processed to idle execution nodes, the processing logic is simple and efficient, and the execution speed of tasks to be processed is accelerated.
  • the client is also called the client, which refers to the program corresponding to the server and providing local services for the client.
  • Clients can be installed on, but not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices.
  • the server can be implemented as an independent server or a server cluster composed of multiple servers.
  • a distributed multi-task management method is provided, and the method is applied to the server in FIG. 1 as an example for description, including the following steps:
  • S201 Obtain a task execution request, and traverse the task set created on the distributed middleware based on the task execution request.
  • the task execution request is a request for a task to be processed.
  • Distributed middleware can extend the communication between processes while reducing the degree of coupling between multiple systems. Understandably, creating a task set on a distributed intermediate can ensure that tasks to be processed by multiple systems are processed at the same time.
  • the task collection is the set collection of redis.
  • the set collection is an unordered collection of String type.
  • the collection members of the set collection are unique, which means that duplicate data cannot appear in the collection.
  • a task set is generated according to the to-be-processed task, so that the to-be-processed task can be quickly allocated to the task set, and when a task execution request is acquired, a return result command is used to read the task set , to provide technical support for the subsequent realization of the equal distribution of pending tasks, so as to solve the problem of relying on the lock mechanism to process pending tasks in the prior art, resulting in a large number of pending tasks on some execution nodes and a small number of pending tasks, resulting in Execution node load imbalance problem.
  • S202 Acquire at least two target arrays in the task set, where each target array includes a task ID and a task sequence number of a task to be processed.
  • the task ID is an ID that uniquely identifies the task to be processed.
  • the task ID may be T0, T1, T2, and so on.
  • the task sequence number indicates the order of the tasks to be processed in the task set, and the task sequence number corresponds to the task ID one-to-one, for example, (T0 1) (T1 2) Distributed multitasking management
  • the target array indicates the array of the corresponding relationship between the task number and the task ID, for example, ⁇ (T0 1)(T1 ) 2) Distributed multi-task management ⁇ , when the server reads the target array, it can intelligently allocate the tasks to be processed to the execution nodes to achieve even distribution.
  • S203 Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each task to be processed according to the task sequence number and the number of execution nodes.
  • the number of execution nodes refers to the number of idle execution nodes, so that the idle execution nodes are subsequently used to process the task to be processed, and node resources are allocated reasonably.
  • the server monitors all execution nodes to obtain the number of execution nodes corresponding to the idle execution nodes.
  • Each idle execution node carries a node sequence number. According to the remainder of dividing the task sequence number by the number of execution nodes, the corresponding number of execution nodes is searched according to the remainder.
  • the node sequence number, and the idle execution node corresponding to the node sequence number is used as the target execution node of the pending task corresponding to the task sequence number, and the pending tasks are evenly distributed among the idle execution nodes.
  • the processing logic is simple and efficient, and the execution speed of the pending tasks is accelerated. . Solve the problem of uneven distribution in the lock mechanism, resulting in excessive load on some execution nodes and small load on some execution nodes.
  • the pending tasks are T0, T1, T2, T3, T4 and T5, and the target array is ⁇ (T0 1)(T1 2)(T2 3) (T3 4) (T4 5) (T5 6) ⁇ , the number of execution nodes is 2, including execution node 0 and execution node 1, then the remainder of the task sequence number 1 divided by the execution node number 2 is 1. Therefore, the pending task corresponding to the task sequence number 1 is assigned to Execute node 1 to process; the remainder of task number 2 divided by the number of execution nodes 2 is 0. Therefore, the task to be processed corresponding to task number 2 is allocated to execution node 0 for processing, and distributed multitasking management. In order to evenly distribute the tasks to be processed among idle execution nodes, the processing logic is simple and efficient.
  • S204 Invoke threads corresponding to the number of execution nodes, execute at least two tasks to be processed, and obtain execution results corresponding to the at least two tasks to be processed.
  • the execution result refers to the result obtained after processing the task to be processed.
  • the tasks to be processed on each target execution node are sorted according to the task priority, the task priority order of all the tasks to be processed on each target execution node is obtained, the threads corresponding to the number of execution nodes are called, and the tasks are prioritized according to the task priority. All tasks to be processed are executed sequentially to realize parallel processing of tasks to be processed, so as to improve the execution efficiency of tasks to be processed.
  • the task priority order indicates the execution order of the tasks to be processed. If the priority is high, it will be processed first; if the priority is low, it will be processed slowly to ensure that the tasks to be processed are processed in a timely manner.
  • the distributed multi-task management method obtains a task execution request, traverses the task set created on the distributed middleware based on the task execution request, and provides technical support for the subsequent realization of the equal distribution of tasks to be processed.
  • the server reads the target array, it can intelligently assign the to-be-processed task to the execution node. achieve an even distribution.
  • the processing logic is simple and efficient, speeding up the waiting period.
  • the execution speed of the processing task Solve the problem of uneven distribution in the lock mechanism, resulting in excessive load on some execution nodes and small load on some execution nodes.
  • a thread corresponding to the number of execution nodes is called, at least two tasks to be processed are executed, and execution results corresponding to the at least two tasks to be processed are obtained, so as to realize the processing of the tasks to be processed.
  • the distributed multitasking management method includes:
  • S301 Acquire at least two task requests to be assigned, and each task request to be assigned includes a task ID and a task sequence number of the task to be processed.
  • a request for a task to be assigned refers to a request for assigning a task to be processed to a task set. It can be understood that when there are multiple tasks to be processed, multiple requests for tasks to be allocated are obtained, so as to realize the processing of the multiple tasks to be processed, and to ensure that the pending tasks are processed in time.
  • S302 Obtain a target array based on the task ID and task sequence number corresponding to each task to be processed.
  • a target array corresponding to a to-be-processed task is acquired according to the task ID and the task sequence number of the to-be-processed task.
  • the original collection refers to the set collection of redis, and the original collection is an empty collection.
  • the type identifier of the task to be processed is obtained to determine the task type of the task to be processed, and the same The task numbers of the pending tasks of the task type are linked together. It should be noted that the pending tasks of the same task type refer to the tasks with the same execution logic. Therefore, the execution times of the pending tasks of the same task type are similar. The remainder of dividing the task number of the task to be processed by the number of execution nodes allocates the task to be processed to the execution node corresponding to the node number corresponding to the remainder for processing.
  • the task numbers of the tasks to be processed of the same task type are linked together to ensure that Each subsequent execution node can be assigned to a similar number of pending tasks of the same task type to ensure that each target execution node processes the pending tasks for a similar length of time, making full use of the node resources of the distributed environment to ensure that the target execution node can be processed in time.
  • Complete pending tasks For example, for task type 1, there are 3 tasks to be processed, the task numbers of the tasks to be processed are 1, 2, and 3, the number of tasks to be processed for task type 2 is 5, and the task numbers of the tasks to be processed are 4, 5, and 6. , 7 and 8, there are 2 execution nodes.
  • the pending tasks of execution node 1 are 1, 3, 5 and 7, and the pending tasks of execution node 0 are The tasks are 2, 4, 6, and 8. It can be seen that the execution nodes process the pending tasks for a similar length of time, making full use of the node resources of the distributed environment.
  • the distributed multi-task management method acquires at least two task requests to be allocated, and each task request to be allocated includes a task ID and a task sequence number of the tasks to be processed, so as to realize the processing of multiple tasks to be processed, And it can be guaranteed to be processed in a timely manner.
  • the target array is obtained; the target array is inserted into the original collection created on the distributed middleware to form a task collection, and the target array formed by the task ID and task sequence number is inserted into the original collection to form A collection of tasks to provide technical support for subsequent equal distribution of pending tasks.
  • step S301 namely acquiring at least two task requests to be assigned, includes:
  • the current system time is the current time of the system.
  • the preset time is a preset time. When the current time of the system reaches the preset time, it will automatically traverse the pending queue, so that the pending tasks can be processed subsequently, and the pending tasks can be automatically processed.
  • the pending queue refers to a queue that stores pending tasks so that the server can determine the number of pending tasks that need to be processed at a preset time.
  • the traversal order is the order in which the tasks in the queue to be processed are traversed.
  • the traversal order can be from the beginning of the queue to the end of the queue, or from the end of the queue to the beginning of the queue, which is not limited here.
  • a timing trigger mechanism is adopted, and when the current time of the system reaches the preset time, the traversal of the pending queue is triggered to determine the number of pending tasks to be processed and the task ID corresponding to the pending tasks.
  • S402 Acquire a task sequence number corresponding to the to-be-processed task according to the traversal sequence corresponding to the to-be-processed task.
  • the server when the server traverses a task to be processed, it marks the task to be processed to form a task sequence number of the task to be processed, so that the tasks to be processed can be equally distributed to idle execution nodes according to the task sequence number.
  • S403 Generate a task request to be allocated according to the task ID and task sequence number corresponding to the task to be processed.
  • the to-be-allocated task request is automatically generated according to the to-be-processed task and the task ID corresponding to the to-be-processed task, so as to realize the automatic processing of the to-be-processed task and improve the intelligent processing efficiency.
  • the queue to be processed is traversed, and the task IDs and the traversal order corresponding to at least two tasks to be processed are obtained; Traverse the sequence to obtain the task sequence number corresponding to the task to be processed, so that the tasks to be processed can be equally distributed to the idle execution nodes according to the task sequence number subsequently.
  • a to-be-allocated task request is generated, so as to realize the automatic processing of the to-be-processed task and improve the intelligent processing efficiency.
  • the target execution node includes a node sequence number.
  • Step S203 namely determining the target execution node corresponding to each task to be processed according to the task sequence number and the number of execution nodes, including:
  • S501 The remainder is obtained by dividing the task sequence number of the task to be processed by the number of execution nodes.
  • S502 Determine the idle execution node corresponding to the node sequence number with the same remainder as the target execution node of the to-be-processed task corresponding to the task sequence number.
  • the idle execution node corresponding to the node sequence number with the same remainder is determined as the target execution node corresponding to the task sequence number corresponding to the pending task, so that the pending tasks are evenly distributed to the target execution nodes for execution, and the redis lock mechanism is eliminated. , to improve the efficiency of program operation.
  • the number of execution nodes is 2, including execution node 0 and execution node 1, and the task sequence number is 1-6
  • the remainder of the task sequence number 1 divided by the execution node number 2 is 1. Therefore, the task to be processed corresponding to the task sequence number 1 is allocated.
  • Process the execution node 1; the remainder of the task sequence number 2 divided by the execution node number 2 is 0. Therefore, the to-be-processed task corresponding to the task sequence number 2 is allocated to the execution node 0 for processing.
  • the remainder is obtained by dividing the task sequence number of the task to be processed by the number of executing nodes. Determine the idle execution node corresponding to the node sequence number equal to the remainder as the target execution node of the pending task corresponding to the task sequence number, so as to realize the even distribution of the pending tasks to the target execution node, eliminate the redis lock mechanism, and improve the program operation. efficiency.
  • the task to be processed further includes a task order number.
  • Step S204 that is, executing at least two tasks to be processed, and obtaining execution results corresponding to the at least two tasks to be processed, including:
  • S601 According to the task order number, determine whether there is an execution dependency relationship between at least two tasks to be processed.
  • the task order number is a pre-defined order number by the user, and the task order number indicates whether different tasks to be processed have execution dependencies, the number of pending tasks with execution dependencies, and the pending tasks with execution dependencies.
  • the task order number is analyzed according to a preset rule to obtain the meaning of the order number corresponding to the task order number, so as to determine whether there is an execution dependency relationship between at least two tasks to be processed according to the meaning of the order number. Automation processes pending tasks for which there are execution dependencies.
  • the preset rule is the rule of the meaning of the order corresponding to the preset task order number.
  • the first digit of the task order number of the task to be processed indicates whether the to-be-processed task has an execution dependency, and 1 indicates that there is an execution dependency.
  • Dependency 0 indicates that there is no execution dependency;
  • the second digit indicates the pending tasks under the same execution dependency that need to be processed at the same time;
  • the third digit indicates the execution order of the pending tasks with execution dependencies.
  • the task order numbers are 011, 111, 112, 122, and 123. At this time, 011 does not have an execution dependency, and the pending tasks corresponding to the four task order numbers 111, 112, 122, and 123 all have execution dependencies.
  • the pending task with the task order number of 111 is executed first (that is, the forward task)
  • the pending task with the task order number of 112 is executed (ie, the backward task).
  • the second digits of 122 and 123 are the same, 122 and 123 have the same execution dependency, and 122 in 122 and 123 is smaller than 123. Therefore, the pending task with the task order number 122 is executed first, and the task order number is 123 Executed after the pending task.
  • one pending task is an interview order task
  • the other pending task is an interview record task
  • the interview order task is an order task created when a user applies for a loan
  • the interview record task is used to record an interview The task of the execution result of the order task.
  • Execution dependencies are relationships that indicate the order in which tasks to be processed are executed.
  • the forward task refers to the pending task that must be executed first;
  • the backward task is the task that is completed after the execution of the forward task and is processed according to the execution result of the forward task.
  • the number of backward tasks can be One, or multiple, when the execution of the forward task is completed, the backward task that depends on the forward task is updated to the forward task. For example, for the pending tasks A, B and C with execution dependencies, when A When not executed, B and C are backward tasks; when A is executed, B is forward task, and C is backward task.
  • the server when the server obtains the task order number of the task to be processed, it analyzes the task order number of the task to be processed according to the preset rule, so as to determine the execution sequence of the to-be-processed tasks with execution dependencies.
  • the pending tasks of execution dependencies are determined as forward tasks and backward tasks to ensure that pending tasks are executed in sequence, improve the processing efficiency of pending tasks, and avoid repeated execution of pending tasks due to unclear sequence of pending tasks. .
  • S603 Execute the forward task and the backward task in sequence, and obtain the execution result.
  • the sequential execution of the forward task and the backward task can ensure accurate execution of the to-be-processed task and speed up the completion of the to-be-processed task.
  • the distributed multi-task management method determines whether any two tasks to be processed have an execution dependency according to the task order number, so as to realize automatic processing of the pending tasks with execution dependencies. If there is an execution dependency between the two pending tasks, the two pending tasks are determined as a forward task and a backward task according to the execution dependency, so as to ensure that the pending tasks are executed in sequence, improve the processing efficiency of the pending tasks, and avoid Due to the unclear sequence of the pending tasks, the pending tasks are repeatedly executed. Executing the forward task and the backward task in sequence and obtaining the execution result can ensure the accurate execution of the pending tasks and speed up the completion of the pending tasks.
  • step S603 that is, executing the forward task and the backward task in sequence, and obtaining the execution result, includes:
  • S701 Determine whether the forward task and the backward task are on the same target execution node.
  • a forward task and a backward task with execution dependencies when a forward task and a backward task with execution dependencies are obtained, check the task sequence numbers of the forward task and the backward task, so as to quickly determine the target execution node corresponding to the forward task and the backward task, so as to Determine whether the target execution nodes corresponding to the forward task and the backward task are the same target execution node, and perform corresponding processing according to different situations to ensure that the pending tasks with execution dependencies are processed in sequence.
  • the forward task and the backward task are executed in sequence, and the execution result is obtained to ensure that the pending task is executed according to the execution dependency.
  • the current task and the backward task are executed at the same target node. At this time, the forward task is executed first, and then the backward task is executed.
  • the blocking queue is a queue used to store the execution result of the forward task, realizes the communication between the forward task and the backward task, and ensures that the forward task and the backward task that are not in the same target execution node can be executed according to the forward direction first. Tasks are executed in the order of the backward tasks.
  • a blocking queue is created between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task. , to ensure the communication between the forward task and the backward task, and provide support for the subsequent execution of the forward task and the backward task in sequence.
  • S704 Execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to a blocking queue, where the blocking queue is used to send the execution result to the target execution node corresponding to the backward task
  • the execution instruction including the execution result corresponding to the forward task.
  • the execution instruction is an instruction for triggering the execution of the backward task.
  • the forward task is executed first, the execution result corresponding to the forward task is obtained, and the execution result of the forward task is sent to the blocking queue, so as to execute the backward task according to the execution result, thereby ensuring the processing efficiency of the pending task. Understandably, if the current task is not completed and there is no execution result, the execution instruction is not triggered, but an exception reminder message is generated, which ensures the processing efficiency of the pending task and avoids the failure of the backward task execution process and waste of resources.
  • S705 Execute the backward task according to the execution instruction, and obtain an execution result corresponding to the backward task.
  • the distributed multi-task management method determines whether the forward task and the backward task are on the same target execution node, so as to perform corresponding processing according to different situations, so as to ensure that the pending tasks with execution dependencies are processed in sequence. . If the forward task and the backward task are on the same target execution node, execute the forward task and the backward task in sequence, obtain the execution result, and ensure that the pending task is executed according to the execution dependency. If the forward task and the backward task are not on the same target execution node, a blocking queue is established between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task to ensure the communication between the forward task and the backward task Contact to provide support for subsequent sequential execution of forward and backward tasks.
  • Execute the forward task obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to the blocking queue, wherein the blocking queue is used to send the target execution node corresponding to the backward task, including all
  • the execution instruction of the execution result corresponding to the forward task ensures the processing efficiency of the to-be-processed task.
  • the backward task is executed according to the execution instruction, and the execution result corresponding to the backward task is obtained.
  • a distributed multitasking management apparatus corresponds one-to-one with the distributed multitasking management method in the above embodiment.
  • the distributed multi-task management apparatus includes a task set traversal module 801 , a target array acquisition module 802 , a target execution node determination module 803 and an execution result acquisition module 804 .
  • the detailed description of each functional module is as follows:
  • the task set traversing module 801 is configured to obtain a task execution request, and traverse the task set created on the distributed middleware based on the task execution request.
  • a target array obtaining module 802 configured to obtain at least two target arrays in the task set, each of the target arrays includes a task ID and a task sequence number of a task to be processed.
  • the target execution node determination module 803 is configured to acquire the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes.
  • the execution result obtaining module 804 is configured to call threads corresponding to the number of execution nodes, execute at least two tasks to be processed, and obtain execution results corresponding to at least two tasks to be processed.
  • the distributed multi-task management apparatus before the task set traversing module 801, the distributed multi-task management apparatus further includes: a to-be-assigned task request acquisition unit, a target array acquisition unit, and a task set formation unit.
  • the to-be-allocated task request acquisition unit is configured to acquire at least two to-be-allocated task requests, each of the to-be-allocated task requests includes a task ID and a task sequence number of the to-be-processed task.
  • a target array obtaining unit configured to obtain a target array based on the task ID and the task sequence number corresponding to each task to be processed.
  • the task set forming unit is used for inserting the target array into the original set created on the distributed middleware to form a task set.
  • the to-be-assigned task request acquisition unit includes: a to-be-processed queue traversal subunit, a task sequence number acquisition subunit, and a to-be-allocated task request generation subunit.
  • the to-be-processed queue traversal subunit is used to traverse the to-be-processed queue when the current time of the system reaches a preset time, and obtain the task IDs and the traversal order corresponding to at least two of the to-be-processed tasks.
  • the task sequence number obtaining subunit is configured to obtain the task sequence number corresponding to the to-be-processed task according to the traversal sequence corresponding to the to-be-processed task.
  • the to-be-allocated task request generating subunit is configured to generate a to-be-allocated task request according to the task ID corresponding to the to-be-processed task and the task sequence number.
  • the target execution node includes a node sequence number; the target execution node determination module 803 includes: a remainder obtaining unit and a target execution node determination unit.
  • a remainder obtaining unit configured to divide the task sequence number of the to-be-processed task by the number of execution nodes to obtain a remainder.
  • the target execution node determination unit determines the idle execution node corresponding to the node sequence number with the same remainder as the target execution node of the to-be-processed task corresponding to the task sequence number.
  • the task to be processed further includes a task order number; that is, the execution result obtaining module 804 includes: a judgment unit, an execution dependency relationship determination unit, and an execution result obtaining unit.
  • a judging unit configured to judge whether there is an execution dependency relationship between at least two of the to-be-processed tasks according to the task order number.
  • An execution dependency determination unit configured to determine at least two of the to-be-processed tasks as a forward task and a backward task according to the execution dependency if there is an execution dependency of the at least two to-be-processed tasks.
  • the execution result obtaining unit is configured to execute the forward task and the backward task in sequence, and obtain the execution result.
  • the execution result obtaining unit includes: a judgment subunit, a first execution subunit, a blocking queue establishment subunit, a forward task execution subunit, and a second execution subunit.
  • a judging subunit configured to judge whether the forward task and the backward task are on the same target execution node.
  • the first execution subunit is configured to execute the sequential execution of the forward task and the backward task if the forward task and the backward task are on the same target execution node, and obtain an execution result.
  • Blocking queue establishment subunit for if the forward task and the backward task are not on the same target execution node, then the target execution node corresponding to the forward task and the target execution node corresponding to the backward task A blocking queue is established between.
  • the forward task execution subunit is used to execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to the blocking queue, wherein the blocking queue uses and sending an execution instruction including the execution result corresponding to the forward task to the target execution node corresponding to the backward task.
  • the second execution subunit is configured to execute the backward task according to the execution instruction, and obtain an execution result corresponding to the backward task.
  • Each module in the above-mentioned distributed multitasking management apparatus may be implemented in whole or in part by software, hardware and combinations thereof.
  • the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided, and the computer device may be a server, and its internal structure diagram may be as shown in FIG. 9 .
  • the computer device includes a processor, memory, a network interface, and a database connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium, an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions and a database.
  • the internal memory provides an environment for the execution of the operating system and computer-readable instructions in the non-volatile storage medium.
  • the database of the computer device is used to store pending tasks.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection.
  • the computer-readable instructions when executed by a processor, implement a distributed multitasking management method.
  • a computer device including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor implements the distribution in the above embodiment when the processor executes the computer-readable instructions
  • the steps of the multitasking management method such as steps S201-S204 shown in FIG. 2 , or steps shown in FIG. 3 to FIG. 7 , are not repeated here to avoid repetition.
  • the processor executes the computer-readable instructions
  • the functions of each module/unit in this embodiment of the distributed multitasking management apparatus are implemented, for example, the task set traversal module 801, the target array acquisition module 802, the target execution module shown in FIG. 8
  • the functions of the node determination module 803 and the execution result acquisition module 804 are not repeated here to avoid repetition.
  • one or more readable storage media storing computer readable instructions are provided, the computer readable storage media having computer readable instructions stored thereon, the computer readable instructions being stored by one or more processors.
  • the one or more processors implement the steps of the distributed multitasking management method in the foregoing embodiment, such as steps S201-S204 shown in FIG. 2 , or steps shown in FIG. 3 to FIG. 7 . , in order to avoid repetition, it will not be repeated here.
  • the processor executes the computer-readable instructions, the functions of each module/unit in this embodiment of the distributed multitasking management apparatus are implemented, for example, the task set traversal module 801, the target array acquisition module 802, the target execution module shown in FIG. 8
  • the functions of the node determination module 803 and the execution result acquisition module 804 are not repeated here to avoid repetition.
  • the readable storage medium in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
  • Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM) or external cache memory.
  • RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM) and so on.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous chain Road (Synchlink) DRAM
  • SLDRAM synchronous chain Road (Synchlink) DRAM
  • Rambus direct RAM
  • DRAM direct memory bus dynamic RAM
  • RDRAM memory bus dynamic RAM

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Multi Processors (AREA)

Abstract

Disclosed is a distributed multi-task management method. The method comprises: acquiring a task execution request, and traversing, on the basis of the task execution request, a set of tasks that are created on distributed middleware; acquiring at least two target arrays in the set of tasks, wherein each of the target arrays comprises a task ID and a task sequence number of a task to be processed; acquiring an execution node quantity corresponding to idle execution nodes, and determining, according to the task sequence number and the execution node quantity, a target execution node corresponding to each task to be processed; and calling threads corresponding to the execution node quantity to execute at least two tasks to be processed, and acquiring execution results corresponding to the at least two tasks to be processed. By means of the distributed multi-task management method provided by the present application, tasks to be processed are averagely distributed to idle execution nodes, the processing logic is simple and efficient, and the execution speed for the tasks to be processed is accelerated.

Description

分布式多任务管理方法、装置、计算机设备及存储介质Distributed multitasking management method, device, computer equipment and storage medium
本申请以2020年11月17日提交的申请号为202011283749.3,名称为“分布式多任务管理方法、装置、计算机设备及存储介质”的中国发明申请为基础,并要求其优先权。This application is based on the Chinese invention application with the application number 202011283749.3 filed on November 17, 2020, entitled "Distributed Multitasking Management Method, Apparatus, Computer Equipment and Storage Medium", and claims its priority.
技术领域technical field
本申请涉及计算机技术领域,尤其涉及一种分布式多任务管理方法、装置、计算机设备及存储介质。The present application relates to the field of computer technologies, and in particular, to a distributed multitasking management method, apparatus, computer equipment, and storage medium.
背景技术Background technique
目前,在分布式环境下处理多个待执行任务通常是通过锁机制将一个任务自动分配一个或多个执行节点上进行处理,但发明人在实际操作过程中发现这种方法存在部分节点集中处理多个待处理任务,部分节点则仅处理少量或者不处理待处理任务,导致自动化分配时节点负载大,执行任务速度缓慢,过度压榨At present, to process multiple tasks to be executed in a distributed environment, a task is usually automatically allocated to one or more execution nodes for processing through a lock mechanism. However, the inventor found in the actual operation that this method has centralized processing on some nodes. There are multiple pending tasks, and some nodes only process a few or no pending tasks, resulting in heavy node load during automatic allocation, slow task execution, and excessive pressure. CPUCPU 资源,甚至宕机的问题。比如,当前有resources and even downtime. For example, currently there are 66 个待执行任务,每个待执行任务对应一把锁,若节点tasks to be executed, each task to be executed corresponds to a lock, if the node AA 抢到五把锁,需要执行五个待执行任务,该节点的负载远远大于其他节点,导致节点负载不均衡的问题。而且,发明还意识到现有技术中还存在具有执行依赖关系的两个任务(前向任务和后任务),可能先执行后向任务,由于前向任务还没有执行完毕,或者没有执行,导致后向任务被重复执行,浪费资源的问题。To grab five locks, you need to execute five tasks to be executed. The load of this node is much larger than that of other nodes, resulting in the problem of node load imbalance. Moreover, the invention also realizes that there are two tasks (forward task and backward task) with execution dependencies in the prior art, and the backward task may be executed first. Backward tasks are repeatedly executed, wasting resources.
技术问题technical problem
本申请实施例提供一种分布式多任务管理方法、装置、计算机设备及存储介质,以解决节点负载不均衡和浪费资源的问题。Embodiments of the present application provide a distributed multitasking management method, apparatus, computer equipment, and storage medium, so as to solve the problems of unbalanced node load and waste of resources.
技术解决方案technical solutions
一种分布式多任务管理方法,包括:A distributed multitasking management method, comprising:
获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;Obtain a task execution request, and traverse the task collection created on the distributed middleware based on the task execution request;
获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;Obtain at least two target arrays in the task set, each of which includes the task ID and the task sequence number of the task to be processed;
获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes;
调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。A thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
一种分布式多任务管理装置,包括:A distributed multitasking management device, comprising:
任务集合遍历模块,用于获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;a task set traversal module, configured to obtain a task execution request, and traverse the task set created on the distributed middleware based on the task execution request;
目标数组获取模块,用于获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;A target array acquisition module, used to obtain at least two target arrays in the task set, each of the target arrays including the task ID and the task sequence number of the task to be processed;
目标执行节点确定模块,用于获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;a target execution node determination module, configured to obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the to-be-processed tasks according to the task sequence number and the number of execution nodes;
执行结果获取模块,用于调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。The execution result obtaining module is configured to call threads corresponding to the number of execution nodes, execute at least two tasks to be processed, and obtain execution results corresponding to at least two tasks to be processed.
一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其中,所述处理器执行所述计算机可读指令时实现如下步骤:A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer-readable instructions:
获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;Obtain a task execution request, and traverse the task collection created on the distributed middleware based on the task execution request;
获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;Obtain at least two target arrays in the task set, each of which includes the task ID and the task sequence number of the task to be processed;
获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes;
调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。A thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
一个或多个存储有计算机可读指令的可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其中,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:One or more readable storage media having computer-readable instructions stored thereon, the computer-readable storage media having computer-readable instructions stored thereon, wherein the computer-readable instructions, when executed by one or more processors, cause all The one or more processors perform the following steps:
获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;Obtain a task execution request, and traverse the task collection created on the distributed middleware based on the task execution request;
获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;Obtain at least two target arrays in the task set, each of which includes the task ID and the task sequence number of the task to be processed;
获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes;
调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。A thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
有益效果beneficial effect
上述分布式多任务管理方法、装置、计算机设备及存储介质,获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合,为后续实现待处理任务平均分配提供技术支持。获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号,当服务器读取到目标数组时,则可以智能化地将待处理任务分配到执行节点中,实现平均分配。获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点,将待处理任务平均分配到空闲执行节点中,处理逻辑简单且高效,加快待处理任务的执行速度。解决锁机制中分配不均,导致部分执行节点的负载过大,部分执行节点的负载较小的问题。调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果,以实现对待处理任务进行处理。The above-mentioned distributed multi-task management method, device, computer equipment and storage medium obtains a task execution request, traverses the task set created on the distributed middleware based on the task execution request, and provides technical support for the subsequent realization of the equal distribution of pending tasks . Obtain at least two target arrays in the task set, and each target array includes the task ID and task sequence number of the task to be processed. When the server reads the target array, it can intelligently assign the task to be processed to In the execution node, an even distribution is achieved. Obtain the number of execution nodes corresponding to the idle execution nodes, determine the target execution node corresponding to each of the pending tasks according to the task sequence number and the number of execution nodes, and evenly distribute the pending tasks to the idle execution nodes. The processing logic is simple and efficient. Efficient, speeding up the execution of pending tasks. Solve the problem of uneven distribution in the lock mechanism, resulting in excessive load on some execution nodes and small load on some execution nodes. The threads corresponding to the number of execution nodes are called to execute at least two of the to-be-processed tasks, and execution results corresponding to at least two of the to-be-processed tasks are acquired, so as to process the to-be-processed tasks.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the drawings that are used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application. , for those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative labor.
图1是本申请一实施例中分布式多任务管理方法的一应用环境示意图;1 is a schematic diagram of an application environment of a distributed multitasking management method in an embodiment of the present application;
图2是本申请一实施例中分布式多任务管理方法的一流程图;2 is a flowchart of a distributed multitasking management method in an embodiment of the present application;
图3是本申请一实施例中分布式多任务管理方法的另一流程图;3 is another flowchart of a distributed multitasking management method in an embodiment of the present application;
图4是本申请一实施例中分布式多任务管理方法的另一流程图;4 is another flowchart of a distributed multitasking management method in an embodiment of the present application;
图5是本申请一实施例中分布式多任务管理方法的另一流程图;5 is another flowchart of a distributed multitasking management method in an embodiment of the present application;
图6是本申请一实施例中分布式多任务管理方法的另一流程图;6 is another flowchart of a distributed multitasking management method in an embodiment of the present application;
图7是本申请一实施例中分布式多任务管理方法的另一流程图;7 is another flowchart of a distributed multitasking management method in an embodiment of the present application;
图8是本申请一实施例中分布式多任务管理装置的一示意图;8 is a schematic diagram of a distributed multitasking management device in an embodiment of the present application;
图9是本申请一实施例中计算机设备的一示意图。FIG. 9 is a schematic diagram of a computer device in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
本申请实施例提供的分布式多任务管理方法,该分布式多任务管理方法可应用如图1所示的应用环境中。具体地,该分布式多任务管理方法应用在分布式多任务管理系统中,该分布式多任务管理系统包括如图1所示的N个客户端和服务器,每一客户端与服务器通过网络进行通信,用于实现将待处理任务平均分配到空闲执行节点中,处理逻辑简单且高效,加快待处理任务的执行速度。其中,客户端又称为用户端,是指与服务器对应,为客户提供本地服务的程序。客户端可安装在但不限于各种个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备上。服务器可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The distributed multi-task management method provided by the embodiment of the present application can be applied in the application environment shown in FIG. 1 . Specifically, the distributed multitasking management method is applied in a distributed multitasking management system, and the distributed multitasking management system includes N clients and servers as shown in FIG. Communication is used to evenly distribute tasks to be processed to idle execution nodes, the processing logic is simple and efficient, and the execution speed of tasks to be processed is accelerated. Among them, the client is also called the client, which refers to the program corresponding to the server and providing local services for the client. Clients can be installed on, but not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented as an independent server or a server cluster composed of multiple servers.
在一实施例中,如图2所示,提供一种分布式多任务管理方法,以该方法应用在图1中的服务器为例进行说明,包括如下步骤:In one embodiment, as shown in FIG. 2 , a distributed multi-task management method is provided, and the method is applied to the server in FIG. 1 as an example for description, including the following steps:
S201:获取任务执行请求,基于任务执行请求遍历在分布式中间件上创建的任务集合。S201: Obtain a task execution request, and traverse the task set created on the distributed middleware based on the task execution request.
其中,任务执行请求是用于待处理任务的请求。The task execution request is a request for a task to be processed.
分布式中间件可扩展进程之间的通信,同时降低多个系统之间的耦合程度。可以理解地,在分布式中间上创建任务集合可以保证将多个系统的待处理任务同时进行处理。Distributed middleware can extend the communication between processes while reducing the degree of coupling between multiple systems. Understandably, creating a task set on a distributed intermediate can ensure that tasks to be processed by multiple systems are processed at the same time.
任务集合是redis的Set集合,该set集合是 String类型的无序集合,set集合的集合成员是唯一的,这就意味着集合中不能出现重复的数据。 The task collection is the set collection of redis. The set collection is an unordered collection of String type. The collection members of the set collection are unique, which means that duplicate data cannot appear in the collection.
本实施例中,当获取到待处理任务时,则根据待处理任务生成任务集合,以使待处理任务可以快速地分配至任务集合中,当获取任务执行请求,采用返回结果命令读取任务集合,为后续实现待处理任务平均分配提供技术支持,以解决现有技术中依赖锁机制对待处理任务进行处理,造成的有的执行节点上待处理任务数量多,有的待处理任务数量少,导致执行节点负载不均衡的问题。In this embodiment, when a task to be processed is acquired, a task set is generated according to the to-be-processed task, so that the to-be-processed task can be quickly allocated to the task set, and when a task execution request is acquired, a return result command is used to read the task set , to provide technical support for the subsequent realization of the equal distribution of pending tasks, so as to solve the problem of relying on the lock mechanism to process pending tasks in the prior art, resulting in a large number of pending tasks on some execution nodes and a small number of pending tasks, resulting in Execution node load imbalance problem.
S202:获取任务集合中的至少两个目标数组,每一目标数组包括待处理任务的任务ID和任务序号。S202: Acquire at least two target arrays in the task set, where each target array includes a task ID and a task sequence number of a task to be processed.
其中,任务ID是唯一识别待处理任务的ID,例如,该任务ID可以是T0、T1和T2等。The task ID is an ID that uniquely identifies the task to be processed. For example, the task ID may be T0, T1, T2, and so on.
任务序号指示待处理任务在任务集合中顺序的数值,该任务序号与任务ID一一对应,例如,(T0  1)(T1  2)分布式多任务管理The task sequence number indicates the order of the tasks to be processed in the task set, and the task sequence number corresponds to the task ID one-to-one, for example, (T0 1) (T1 2) Distributed multitasking management
目标数组指示任务序号与任务ID对应关系的数组,例如,{(T0  1)(T1  2)分布式多任务管理},当服务器读取到目标数组时,则可以智能化地将待处理任务分配到执行节点中,实现平均分配。The target array indicates the array of the corresponding relationship between the task number and the task ID, for example, {(T0 1)(T1 ) 2) Distributed multi-task management}, when the server reads the target array, it can intelligently allocate the tasks to be processed to the execution nodes to achieve even distribution.
S203:获取空闲执行节点对应的执行节点数量,根据任务序号和执行节点数量,确定每一待处理任务对应的目标执行节点。S203: Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each task to be processed according to the task sequence number and the number of execution nodes.
其中,执行节点数量是指空闲的执行节点的数量,以便后续采用空闲的执行节点对待处理任务进行处理,合理分配节点资源。The number of execution nodes refers to the number of idle execution nodes, so that the idle execution nodes are subsequently used to process the task to be processed, and node resources are allocated reasonably.
具体地,服务器通过对所有的执行节点进行监控,以获取空闲执行节点对应的执行节点数量,每一空闲执行节点携带有节点序号,根据任务序号除以执行节点数量的余数,根据余数查找对应的节点序号,并将节点序号对应的空闲执行节点作为任务序号对应的待处理任务的目标执行节点,将待处理任务平均分配到空闲执行节点中,处理逻辑简单且高效,加快待处理任务的执行速度。解决锁机制中分配不均,导致部分执行节点的负载过大,部分执行节点的负载较小的问题。Specifically, the server monitors all execution nodes to obtain the number of execution nodes corresponding to the idle execution nodes. Each idle execution node carries a node sequence number. According to the remainder of dividing the task sequence number by the number of execution nodes, the corresponding number of execution nodes is searched according to the remainder. The node sequence number, and the idle execution node corresponding to the node sequence number is used as the target execution node of the pending task corresponding to the task sequence number, and the pending tasks are evenly distributed among the idle execution nodes. The processing logic is simple and efficient, and the execution speed of the pending tasks is accelerated. . Solve the problem of uneven distribution in the lock mechanism, resulting in excessive load on some execution nodes and small load on some execution nodes.
例如,待处理任务有T0、T1、T2、T3、T4和T5,目标数组为{(T0  1)(T1  2)(T2  3)(T3  4)(T4  5)(T5  6)},执行节点数量为2,包括执行节点0和执行节点1,则任务序号1除以执行节点数量2的余数为1,因此,任务序号1对应的待处理任务分配给执行节点1处理;任务序号2除以执行节点数量2的余数为0,因此,任务序号2对应的待处理任务分配给执行节点0处理,分布式多任务管理。以将待处理任务平均分配到空闲执行节点中,处理逻辑简单且高效。For example, the pending tasks are T0, T1, T2, T3, T4 and T5, and the target array is {(T0 1)(T1 2)(T2 3) (T3 4) (T4 5) (T5 6)}, the number of execution nodes is 2, including execution node 0 and execution node 1, then the remainder of the task sequence number 1 divided by the execution node number 2 is 1. Therefore, the pending task corresponding to the task sequence number 1 is assigned to Execute node 1 to process; the remainder of task number 2 divided by the number of execution nodes 2 is 0. Therefore, the task to be processed corresponding to task number 2 is allocated to execution node 0 for processing, and distributed multitasking management. In order to evenly distribute the tasks to be processed among idle execution nodes, the processing logic is simple and efficient.
S204:调用与执行节点数量相对应的线程,执行至少两个待处理任务,获取至少两个待处理任务对应的执行结果。S204: Invoke threads corresponding to the number of execution nodes, execute at least two tasks to be processed, and obtain execution results corresponding to the at least two tasks to be processed.
其中,执行结果是指对待处理任务进行处理后得到的结果。The execution result refers to the result obtained after processing the task to be processed.
具体地,根据任务优先对每一目标执行节点上的待处理任务排序,得到每一目标执行节点的所有待处理任务的任务优先级顺序,调用与执行节点数量相对应的线程,按照任务优先级顺序执行所有待处理任务,实现并行处理待处理任务,以提高待处理任务的执行效率。其中,任务优先级顺序指示待处理任务执行的顺序,优先级高,则优先处理;优先级低,则较慢处理,以保证及时处理待处理任务。Specifically, the tasks to be processed on each target execution node are sorted according to the task priority, the task priority order of all the tasks to be processed on each target execution node is obtained, the threads corresponding to the number of execution nodes are called, and the tasks are prioritized according to the task priority. All tasks to be processed are executed sequentially to realize parallel processing of tasks to be processed, so as to improve the execution efficiency of tasks to be processed. Among them, the task priority order indicates the execution order of the tasks to be processed. If the priority is high, it will be processed first; if the priority is low, it will be processed slowly to ensure that the tasks to be processed are processed in a timely manner.
本实施例所提供的分布式多任务管理方法,获取任务执行请求,基于任务执行请求遍历在分布式中间件上创建的任务集合,为后续实现待处理任务平均分配提供技术支持。获取任务集合中的至少两个目标数组,每一目标数组包括待处理任务的任务ID和任务序号,当服务器读取到目标数组时,则可以智能化地将待处理任务分配到执行节点中,实现平均分配。获取空闲执行节点对应的执行节点数量,根据任务序号和执行节点数量,确定每一待处理任务对应的目标执行节点,将待处理任务平均分配到空闲执行节点中,处理逻辑简单且高效,加快待处理任务的执行速度。解决锁机制中分配不均,导致部分执行节点的负载过大,部分执行节点的负载较小的问题。调用与执行节点数量相对应的线程,执行至少两个待处理任务,获取至少两个待处理任务对应的执行结果,以实现对待处理任务进行处理。The distributed multi-task management method provided by this embodiment obtains a task execution request, traverses the task set created on the distributed middleware based on the task execution request, and provides technical support for the subsequent realization of the equal distribution of tasks to be processed. Obtain at least two target arrays in the task set. Each target array includes the task ID and task sequence number of the task to be processed. When the server reads the target array, it can intelligently assign the to-be-processed task to the execution node. achieve an even distribution. Obtain the number of execution nodes corresponding to the idle execution nodes, determine the target execution node corresponding to each pending task according to the task sequence number and the number of execution nodes, and evenly distribute the pending tasks to the idle execution nodes. The processing logic is simple and efficient, speeding up the waiting period. The execution speed of the processing task. Solve the problem of uneven distribution in the lock mechanism, resulting in excessive load on some execution nodes and small load on some execution nodes. A thread corresponding to the number of execution nodes is called, at least two tasks to be processed are executed, and execution results corresponding to the at least two tasks to be processed are obtained, so as to realize the processing of the tasks to be processed.
在一实施例中,如图3所示,在步骤S201之前,即在获取任务执行请求,基于任务执行请求遍历在分布式中间件上创建的任务集合之前,分布式多任务管理方法包括:In one embodiment, as shown in FIG. 3 , before step S201, that is, before obtaining a task execution request and traversing the task set created on the distributed middleware based on the task execution request, the distributed multitasking management method includes:
S301:获取至少两个待分配任务请求,每一待分配任务请求包括待处理任务的任务ID和任务序号。 S301 : Acquire at least two task requests to be assigned, and each task request to be assigned includes a task ID and a task sequence number of the task to be processed.
其中,一个待分配任务请求是指将一个待处理任务分配到任务集合中的请求。可以理解地,当存在多个待处理任务,则获取到多个待分配任务请求,以实现对多个待处理任务进行处理,且可以保证及时处理待处理。A request for a task to be assigned refers to a request for assigning a task to be processed to a task set. It can be understood that when there are multiple tasks to be processed, multiple requests for tasks to be allocated are obtained, so as to realize the processing of the multiple tasks to be processed, and to ensure that the pending tasks are processed in time.
S302:基于每一待处理任务对应的任务ID和任务序号,获取目标数组。S302: Obtain a target array based on the task ID and task sequence number corresponding to each task to be processed.
本实施例中,根据一个待处理任务的任务ID和任务序号获取该待处理任务对应的目标数组。In this embodiment, a target array corresponding to a to-be-processed task is acquired according to the task ID and the task sequence number of the to-be-processed task.
S303:将目标数组插入分布式中间件上创建的原始集合,形成任务集合。S303: Insert the target array into the original collection created on the distributed middleware to form a task collection.
其中,原始集合是指redis的set集合,该原始集合为空集合。在分布式中间件上创建原始集合,将基于任务ID和任务序号形成的目标数组插入原始集合形成任务集合,以为后续平均分配待处理任务提供技术支持。Among them, the original collection refers to the set collection of redis, and the original collection is an empty collection. Create an original set on the distributed middleware, insert the target array formed based on the task ID and task sequence number into the original set to form a task set, and provide technical support for the subsequent even distribution of pending tasks.
本实施例中,在分布式中间件上创建原始集合,将目标数组插入分布式中间件上创建的原始集合时,通过获取待处理任务的类型标识,以确定待处理任务的任务类型,将同一任务类型的待处理任务的任务序号连在一起,需要说明地是,同一任务类型的待处理任务是指执行逻辑相同的任务,因此,同一任务类型的待处理任务的执行时间相近,由于后续根据待处理任务的任务序号除以执行节点数量的余数将待处理任务分配到与余数对应的节点序号对应的执行节点进行处理,因此,同一任务类型的待处理任务的任务序号连在一起,可以保证后续每一执行节点可以分配到数量相近的同一任务类型的待处理任务,以保证每一目标执行节点处理待处理任务的时长相近,充分利用分布式环境的节点资源,保证目标执行节点可以及时处理完成待处理任务。例如,对于任务类型1的待处理任务为3个,待处理任务的任务序号为1、2和3,任务类型2的待处理任务为5个,待处理任务的任务序号为4、5、6、7和8,执行节点为2个,由于同一任务类型的待处理任务的任务序号连在一起,因此,执行节点1的待处理任务为1、3、5和7,执行节点0的待处理任务为2、4、6和8,可以看出执行节点处理待处理任务的时长相近,充分利用分布式环境的节点资源。In this embodiment, when the original collection is created on the distributed middleware, and the target array is inserted into the original collection created on the distributed middleware, the type identifier of the task to be processed is obtained to determine the task type of the task to be processed, and the same The task numbers of the pending tasks of the task type are linked together. It should be noted that the pending tasks of the same task type refer to the tasks with the same execution logic. Therefore, the execution times of the pending tasks of the same task type are similar. The remainder of dividing the task number of the task to be processed by the number of execution nodes allocates the task to be processed to the execution node corresponding to the node number corresponding to the remainder for processing. Therefore, the task numbers of the tasks to be processed of the same task type are linked together to ensure that Each subsequent execution node can be assigned to a similar number of pending tasks of the same task type to ensure that each target execution node processes the pending tasks for a similar length of time, making full use of the node resources of the distributed environment to ensure that the target execution node can be processed in time. Complete pending tasks. For example, for task type 1, there are 3 tasks to be processed, the task numbers of the tasks to be processed are 1, 2, and 3, the number of tasks to be processed for task type 2 is 5, and the task numbers of the tasks to be processed are 4, 5, and 6. , 7 and 8, there are 2 execution nodes. Since the task numbers of the pending tasks of the same task type are connected together, the pending tasks of execution node 1 are 1, 3, 5 and 7, and the pending tasks of execution node 0 are The tasks are 2, 4, 6, and 8. It can be seen that the execution nodes process the pending tasks for a similar length of time, making full use of the node resources of the distributed environment.
本实施例所提供的分布式多任务管理方法,获取至少两个待分配任务请求,每一待分配任务请求包括待处理任务的任务ID和任务序号,以实现对多个待处理任务进行处理,且可以保证及时处理待处理。基于每一待处理任务对应的任务ID和任务序号,获取目标数组;将目标数组插入分布式中间件上创建的原始集合,形成任务集合,将任务ID和任务序号形成的目标数组插入原始集合形成任务集合,以为后续平均分配待处理任务提供技术支持。The distributed multi-task management method provided by this embodiment acquires at least two task requests to be allocated, and each task request to be allocated includes a task ID and a task sequence number of the tasks to be processed, so as to realize the processing of multiple tasks to be processed, And it can be guaranteed to be processed in a timely manner. Based on the task ID and task sequence number corresponding to each task to be processed, the target array is obtained; the target array is inserted into the original collection created on the distributed middleware to form a task collection, and the target array formed by the task ID and task sequence number is inserted into the original collection to form A collection of tasks to provide technical support for subsequent equal distribution of pending tasks.
在一实施例中,如图4所示,步骤S301,即获取至少两个待分配任务请求,包括:In one embodiment, as shown in FIG. 4 , step S301, namely acquiring at least two task requests to be assigned, includes:
S401:当系统当前时间达到预设时间时,则遍历待处理队列,获取至少两个待处理任务对应的任务ID和遍历顺序。S401: When the current time of the system reaches a preset time, traverse the to-be-processed queue, and obtain task IDs and traversal orders corresponding to at least two to-be-processed tasks.
其中,系统当前时间是系统当前的时间。预设时间是预先设定的时间,当系统当前时间达到预设时间时,则自动遍历待处理队列,以便后续对待处理任务进行处理,实现自动化处理待处理任务。Wherein, the current system time is the current time of the system. The preset time is a preset time. When the current time of the system reaches the preset time, it will automatically traverse the pending queue, so that the pending tasks can be processed subsequently, and the pending tasks can be automatically processed.
待处理队列是指存储待处理任务的队列,以便服务器确定预设时间时需要处理的待处理任务的数量。The pending queue refers to a queue that stores pending tasks so that the server can determine the number of pending tasks that need to be processed at a preset time.
遍历顺序是对待处理队列中的任务进行遍历的顺序,该遍历顺序可以是从待处理队列的队列开头遍历到队列结尾,可以是从队列结尾遍历到队列开头,在此不做限定。The traversal order is the order in which the tasks in the queue to be processed are traversed. The traversal order can be from the beginning of the queue to the end of the queue, or from the end of the queue to the beginning of the queue, which is not limited here.
本实施例中,采用定时触发机制,当系统当前时间达到预设时间时,则触发遍历待处理队列,以便确定需要处理的待处理任务的数量和待处理任务对应的任务ID。In this embodiment, a timing trigger mechanism is adopted, and when the current time of the system reaches the preset time, the traversal of the pending queue is triggered to determine the number of pending tasks to be processed and the task ID corresponding to the pending tasks.
S402:根据待处理任务对应的遍历顺序,获取待处理任务对应的任务序号。S402: Acquire a task sequence number corresponding to the to-be-processed task according to the traversal sequence corresponding to the to-be-processed task.
本实施例中,服务器遍历到一个待处理任务则标注该待处理任务,以形成该待处理任务的任务序号,以便后续根据该任务序号实现将待处理任务平均分配到空闲执行节点中。In this embodiment, when the server traverses a task to be processed, it marks the task to be processed to form a task sequence number of the task to be processed, so that the tasks to be processed can be equally distributed to idle execution nodes according to the task sequence number.
S403:根据待处理任务对应的任务ID和任务序号,生成待分配任务请求。S403: Generate a task request to be allocated according to the task ID and task sequence number corresponding to the task to be processed.
本实施例中,根据待处理任务和待处理任务对应的任务ID自动生成待分配任务请求,以实现自动化处理待处理任务,提高智能化处理效率。In this embodiment, the to-be-allocated task request is automatically generated according to the to-be-processed task and the task ID corresponding to the to-be-processed task, so as to realize the automatic processing of the to-be-processed task and improve the intelligent processing efficiency.
本实施例所提供的分布式多任务管理方法,当系统当前时间达到预设时间时,则遍历待处理队列,获取至少两个待处理任务对应的任务ID和遍历顺序;根据待处理任务对应的遍历顺序,获取待处理任务对应的任务序号,以便后续根据该任务序号实现将待处理任务平均分配到空闲执行节点中。根据待处理任务对应的任务ID和任务序号,生成待分配任务请求,以实现自动化处理待处理任务,提高智能化处理效率。In the distributed multi-task management method provided by this embodiment, when the current time of the system reaches the preset time, the queue to be processed is traversed, and the task IDs and the traversal order corresponding to at least two tasks to be processed are obtained; Traverse the sequence to obtain the task sequence number corresponding to the task to be processed, so that the tasks to be processed can be equally distributed to the idle execution nodes according to the task sequence number subsequently. According to the task ID and task sequence number corresponding to the to-be-processed task, a to-be-allocated task request is generated, so as to realize the automatic processing of the to-be-processed task and improve the intelligent processing efficiency.
在一实施例中,如图5所示,目标执行节点包括节点序号。步骤S203,即根据任务序号和执行节点数量,确定每一待处理任务对应的目标执行节点,包括:In one embodiment, as shown in FIG. 5, the target execution node includes a node sequence number. Step S203, namely determining the target execution node corresponding to each task to be processed according to the task sequence number and the number of execution nodes, including:
S501:采用待处理任务的任务序号除以执行节点数量得到余数。S501: The remainder is obtained by dividing the task sequence number of the task to be processed by the number of execution nodes.
S502:将与余数相等的节点序号对应的空闲执行节点,确定为任务序号对应的待处理任务的目标执行节点。S502: Determine the idle execution node corresponding to the node sequence number with the same remainder as the target execution node of the to-be-processed task corresponding to the task sequence number.
本实施例中,将与余数相等的节点序号对应的空闲执行节点确定为任务序号对应待处理任务对应的目标执行节点,实现将待处理任务平均分配到目标执行节点中执行,剔除了redis锁机制,提高程序运行效率。In this embodiment, the idle execution node corresponding to the node sequence number with the same remainder is determined as the target execution node corresponding to the task sequence number corresponding to the pending task, so that the pending tasks are evenly distributed to the target execution nodes for execution, and the redis lock mechanism is eliminated. , to improve the efficiency of program operation.
例如,执行节点数量为2,包括执行节点0和执行节点1,任务序号为1-6,则任务序号1除以执行节点数量2的余数为1,因此,任务序号1对应的待处理任务分配给执行节点1处理;任务序号2除以执行节点数量2的余数为0,因此,任务序号2对应的待处理任务分配给执行节点0处理。For example, if the number of execution nodes is 2, including execution node 0 and execution node 1, and the task sequence number is 1-6, the remainder of the task sequence number 1 divided by the execution node number 2 is 1. Therefore, the task to be processed corresponding to the task sequence number 1 is allocated. Process the execution node 1; the remainder of the task sequence number 2 divided by the execution node number 2 is 0. Therefore, the to-be-processed task corresponding to the task sequence number 2 is allocated to the execution node 0 for processing.
本实施例所提供的分布式多任务管理方法,采用待处理任务的任务序号除以执行节点数量得到余数。将与余数相等的节点序号对应的空闲执行节点,确定为任务序号对应的待处理任务的目标执行节点,以实现将待处理任务平均分配到目标执行节点中,剔除了redis锁机制,提高程序运行效率。In the distributed multi-task management method provided by this embodiment, the remainder is obtained by dividing the task sequence number of the task to be processed by the number of executing nodes. Determine the idle execution node corresponding to the node sequence number equal to the remainder as the target execution node of the pending task corresponding to the task sequence number, so as to realize the even distribution of the pending tasks to the target execution node, eliminate the redis lock mechanism, and improve the program operation. efficiency.
在一实施例中,如图6所示,待处理任务还包括任务单号。步骤S204,即执行至少两个待处理任务,获取至少两个待处理任务对应的执行结果,包括:In one embodiment, as shown in FIG. 6 , the task to be processed further includes a task order number. Step S204, that is, executing at least two tasks to be processed, and obtaining execution results corresponding to the at least two tasks to be processed, including:
S601:根据任务单号,判断至少两个待处理任务是否存在执行依赖关系。S601: According to the task order number, determine whether there is an execution dependency relationship between at least two tasks to be processed.
其中,任务单号是用户预先定义的单号,任务单号中指示了不同待处理任务是否存在执行依赖关系、存在执行依赖关系的待处理任务的数量和存在执行依赖关系的待处理任务等。本实施例中,根据预设规则对所述任务单号进行分析,以得到所述任务单号对应的单号含义,以根据单号含义确定至少两个待处理任务是否存在执行依赖关系,实现自动化处理存在执行依赖关系的待处理任务。其中,预设规则是预先设定的任务单号对应的单号含义的规则,例如,待处理任务的任务单号的第一位数字表示该待处理任务是否存在执行依赖关系,1表示存在执行依赖关系,0表示不存在执行依赖关系;第二位数字表示需要同时处理的同一执行依赖关系下的待处理任务;第三位数字指示存在执行依赖关系的待处理任务的执行顺序。例如,任务单号为011、111、112、122和123,此时,011不存在执行依赖关系,111、112、122和123这4个任务单号对应的待处理任务均存在执行依赖关系,由于111和112的第二位数字相同,则111和112存在同一执行依赖关系,又111和112中111比112小,因此,任务单号为111的待处理任务先执行(即前向任务),任务单号为112的待处理任务后执行(即后向任务)。由于122和123的第二位数字相同,则122和123存在同一执行依赖关系,又122和123中122比123小,因此,任务单号为122的待处理任务先执行,任务单号为123的待处理任务后执行。The task order number is a pre-defined order number by the user, and the task order number indicates whether different tasks to be processed have execution dependencies, the number of pending tasks with execution dependencies, and the pending tasks with execution dependencies. In this embodiment, the task order number is analyzed according to a preset rule to obtain the meaning of the order number corresponding to the task order number, so as to determine whether there is an execution dependency relationship between at least two tasks to be processed according to the meaning of the order number. Automation processes pending tasks for which there are execution dependencies. Among them, the preset rule is the rule of the meaning of the order corresponding to the preset task order number. For example, the first digit of the task order number of the task to be processed indicates whether the to-be-processed task has an execution dependency, and 1 indicates that there is an execution dependency. Dependency, 0 indicates that there is no execution dependency; the second digit indicates the pending tasks under the same execution dependency that need to be processed at the same time; the third digit indicates the execution order of the pending tasks with execution dependencies. For example, the task order numbers are 011, 111, 112, 122, and 123. At this time, 011 does not have an execution dependency, and the pending tasks corresponding to the four task order numbers 111, 112, 122, and 123 all have execution dependencies. Since the second digits of 111 and 112 are the same, 111 and 112 have the same execution dependency, and 111 in 111 and 112 is smaller than 112. Therefore, the pending task with the task order number of 111 is executed first (that is, the forward task) , the pending task with the task order number of 112 is executed (ie, the backward task). Since the second digits of 122 and 123 are the same, 122 and 123 have the same execution dependency, and 122 in 122 and 123 is smaller than 123. Therefore, the pending task with the task order number 122 is executed first, and the task order number is 123 Executed after the pending task.
作为一示例,一个待处理任务为面审订单任务,一个待处理任务为面审记录任务,其中面审订单任务是用户申请贷款时,创建的订单任务,面审记录任务是用于记录面审订单任务的执行结果的任务。As an example, one pending task is an interview order task, and the other pending task is an interview record task, wherein the interview order task is an order task created when a user applies for a loan, and the interview record task is used to record an interview The task of the execution result of the order task.
执行依赖关系是指示待处理任务执行的先后顺序的关系。Execution dependencies are relationships that indicate the order in which tasks to be processed are executed.
S602:若至少两个待处理任务存在执行依赖关系,则根据执行依赖关系将至少两个待处理任务确定为前向任务和后向任务。S602: If at least two tasks to be processed have execution dependencies, determine at least two tasks to be processed as forward tasks and backward tasks according to the execution dependencies.
其中,前向任务是指必须先执行的待处理任务;后向任务为在前向任务执行完成,以根据前向任务的执行结果进行处理的任务,可以理解地,后向任务的数量可以为一个,也可以为多个,当前向任务执行完成时,则依赖于前向任务的后向任务更新为前向任务,例如,对于具有执行依赖关系的待处理任务A、B和C,当A未执行时,B和C为后向任务;当A执行完成时,B前向任务,C为后向任务。Among them, the forward task refers to the pending task that must be executed first; the backward task is the task that is completed after the execution of the forward task and is processed according to the execution result of the forward task. It can be understood that the number of backward tasks can be One, or multiple, when the execution of the forward task is completed, the backward task that depends on the forward task is updated to the forward task. For example, for the pending tasks A, B and C with execution dependencies, when A When not executed, B and C are backward tasks; when A is executed, B is forward task, and C is backward task.
具体地,当服务器获取到待处理任务的任务单号时,则根据预设规则对对待处理任务的任务单号进行分析,,以确定具有执行依赖关系的待处理任务的执行先后顺序,将具有执行依赖关系的待处理任务确定为前向任务和后向任务,以保证待处理任务依序执行,提高待处理任务的处理效率,避免由于不清楚待处理任务的先后顺序导致重复执行待处理任务。Specifically, when the server obtains the task order number of the task to be processed, it analyzes the task order number of the task to be processed according to the preset rule, so as to determine the execution sequence of the to-be-processed tasks with execution dependencies. The pending tasks of execution dependencies are determined as forward tasks and backward tasks to ensure that pending tasks are executed in sequence, improve the processing efficiency of pending tasks, and avoid repeated execution of pending tasks due to unclear sequence of pending tasks. .
S603:依序执行前向任务和后向任务,获取执行结果。S603: Execute the forward task and the backward task in sequence, and obtain the execution result.
本实施例中,依序执行前向任务和后向任务可以保证准确执行待处理任务,加快完成待处理任务。In this embodiment, the sequential execution of the forward task and the backward task can ensure accurate execution of the to-be-processed task and speed up the completion of the to-be-processed task.
本实施例所提供的分布式多任务管理方法,根据任务单号判断任意两个待处理任务是否存在执行依赖关系,以实现自动化处理存在执行依赖关系的待处理任务。若两个待处理任务存在执行依赖关系,则根据执行依赖关系将两个待处理任务确定为前向任务和后向任务,以保证待处理任务依序执行,提高待处理任务的处理效率,避免由于不清楚待处理任务的先后顺序导致重复执行待处理任务。依序执行前向任务和后向任务,获取执行结果,可以保证准确执行待处理任务,加快完成待处理任务。The distributed multi-task management method provided by this embodiment determines whether any two tasks to be processed have an execution dependency according to the task order number, so as to realize automatic processing of the pending tasks with execution dependencies. If there is an execution dependency between the two pending tasks, the two pending tasks are determined as a forward task and a backward task according to the execution dependency, so as to ensure that the pending tasks are executed in sequence, improve the processing efficiency of the pending tasks, and avoid Due to the unclear sequence of the pending tasks, the pending tasks are repeatedly executed. Executing the forward task and the backward task in sequence and obtaining the execution result can ensure the accurate execution of the pending tasks and speed up the completion of the pending tasks.
在一实施例中,如图7所示,步骤S603,即依序执行前向任务和后向任务,获取执行结果,包括:In one embodiment, as shown in FIG. 7 , step S603, that is, executing the forward task and the backward task in sequence, and obtaining the execution result, includes:
S701:判断前向任务和后向任务是否在同一目标执行节点上。S701: Determine whether the forward task and the backward task are on the same target execution node.
具体地,当获取到具有执行依赖关系的前向任务和后向任务,则查看前向任务和后向任务的任务序号,以便快速地确定前向任务和后向任务对应的目标执行节点,以判断前向任务和后向任务对应的目标执行节点是否为同一目标执行节点,针对不同的情况进行相应处理,保证依序处理存在执行依赖关系的待处理任务。Specifically, when a forward task and a backward task with execution dependencies are obtained, check the task sequence numbers of the forward task and the backward task, so as to quickly determine the target execution node corresponding to the forward task and the backward task, so as to Determine whether the target execution nodes corresponding to the forward task and the backward task are the same target execution node, and perform corresponding processing according to different situations to ensure that the pending tasks with execution dependencies are processed in sequence.
S702:若前向任务和后向任务在同一目标执行节点上,则执行依序执行前向任务和后向任务,获取执行结果。S702: If the forward task and the backward task are on the same target execution node, execute the forward task and the backward task in sequence, and obtain an execution result.
当前向任务和后向任务在同一目标执行节点上,则执行依序执行前向任务和后向任务,获取执行结果,保证按照执行依赖关系执行待处理任务。当前向任务和后向任务在同一目标执行节点,此时先执行前向任务,再执行后向任务。If the current task and the backward task are on the same target execution node, the forward task and the backward task are executed in sequence, and the execution result is obtained to ensure that the pending task is executed according to the execution dependency. The current task and the backward task are executed at the same target node. At this time, the forward task is executed first, and then the backward task is executed.
S703:若前向任务和后向任务不在同一目标执行节点上,则在前向任务对应的目标执行节点和后向任务对应的目标执行节点之间建立阻塞队列。S703: If the forward task and the backward task are not on the same target execution node, a blocking queue is established between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task.
其中,阻塞队列是用于存储前向任务的执行结果的队列,实现前向任务与后向任务之间的通信,保证不在同一目标执行节点的前向任务和后向任务可以按照先执行前向任务,后执行后向任务的顺序执行。Among them, the blocking queue is a queue used to store the execution result of the forward task, realizes the communication between the forward task and the backward task, and ensures that the forward task and the backward task that are not in the same target execution node can be executed according to the forward direction first. Tasks are executed in the order of the backward tasks.
具体地,当前向任务和后向任务不在同一目标执行节点时,为了保证一次性完成待处理任务,则在前向任务对应的目标执行节点和后向任务对应的目标执行节点之间创建阻塞队列,保证前向任务和后向任务的通信联系,为后续依序执行前向任务和后向任务提供支持。Specifically, when the forward task and the backward task are not in the same target execution node, in order to ensure that the pending task is completed at one time, a blocking queue is created between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task. , to ensure the communication between the forward task and the backward task, and provide support for the subsequent execution of the forward task and the backward task in sequence.
S704:执行前向任务,获取前向任务对应的执行结果,将前向任务对应的执行结果发送到阻塞队列中,其中,所述阻塞队列用于向所述后向任务对应的目标执行节点发送包括所述前向任务对应的执行结果的执行指令。S704: Execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to a blocking queue, where the blocking queue is used to send the execution result to the target execution node corresponding to the backward task The execution instruction including the execution result corresponding to the forward task.
其中,执行指令是用于触发执行后向任务的指令。The execution instruction is an instruction for triggering the execution of the backward task.
具体地,先执行前向任务,获取前向任务对应的执行结果,将前向任务的执行结果发送到阻塞队列中,以便根据执行结果执行后向任务,保证了待处理任务的处理效率。可以理解地,当前向任务未完成,没有执行结果,则不触发执行指令,而是生成异常提醒信息,保证了待处理任务的处理效率,避免后向任务执行过程失败,且浪费资源。Specifically, the forward task is executed first, the execution result corresponding to the forward task is obtained, and the execution result of the forward task is sent to the blocking queue, so as to execute the backward task according to the execution result, thereby ensuring the processing efficiency of the pending task. Understandably, if the current task is not completed and there is no execution result, the execution instruction is not triggered, but an exception reminder message is generated, which ensures the processing efficiency of the pending task and avoids the failure of the backward task execution process and waste of resources.
S705:根据所述执行指令执行后向任务,获取后向任务对应的执行结果。S705: Execute the backward task according to the execution instruction, and obtain an execution result corresponding to the backward task.
本实施例所提供的分布式多任务管理方法,判断前向任务和后向任务是否在同一目标执行节点上,以针对不同的情况进行相应处理,保证依序处理存在执行依赖关系的待处理任务。若前向任务和后向任务在同一目标执行节点上,则执行依序执行前向任务和后向任务,获取执行结果,保证按照执行依赖关系执行待处理任务。若前向任务和后向任务不在同一目标执行节点上,则在前向任务对应的目标执行节点和后向任务对应的目标执行节点之间建立阻塞队列,保证前向任务和后向任务的通信联系,为后续依序执行前向任务和后向任务提供支持。执行前向任务,获取前向任务对应的执行结果,将前向任务对应的执行结果发送到阻塞队列中,其中,所述阻塞队列用于向所述后向任务对应的目标执行节点发送包括所述前向任务对应的执行结果的执行指令,保证了待处理任务的处理效率。根据所述执行指令执行后向任务,获取后向任务对应的执行结果。The distributed multi-task management method provided by this embodiment determines whether the forward task and the backward task are on the same target execution node, so as to perform corresponding processing according to different situations, so as to ensure that the pending tasks with execution dependencies are processed in sequence. . If the forward task and the backward task are on the same target execution node, execute the forward task and the backward task in sequence, obtain the execution result, and ensure that the pending task is executed according to the execution dependency. If the forward task and the backward task are not on the same target execution node, a blocking queue is established between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task to ensure the communication between the forward task and the backward task Contact to provide support for subsequent sequential execution of forward and backward tasks. Execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to the blocking queue, wherein the blocking queue is used to send the target execution node corresponding to the backward task, including all The execution instruction of the execution result corresponding to the forward task ensures the processing efficiency of the to-be-processed task. The backward task is executed according to the execution instruction, and the execution result corresponding to the backward task is obtained.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the sequence of execution, and the execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
在一实施例中,提供一种分布式多任务管理装置,该分布式多任务管理装置与上述实施例中分布式多任务管理方法一一对应。如图8所示,该分布式多任务管理装置包括任务集合遍历模块801、目标数组获取模块802、目标执行节点确定模块803和执行结果获取模块804。各功能模块详细说明如下:In one embodiment, a distributed multitasking management apparatus is provided, and the distributed multitasking management apparatus corresponds one-to-one with the distributed multitasking management method in the above embodiment. As shown in FIG. 8 , the distributed multi-task management apparatus includes a task set traversal module 801 , a target array acquisition module 802 , a target execution node determination module 803 and an execution result acquisition module 804 . The detailed description of each functional module is as follows:
任务集合遍历模块801,用于获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合。The task set traversing module 801 is configured to obtain a task execution request, and traverse the task set created on the distributed middleware based on the task execution request.
目标数组获取模块802,用于获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号。A target array obtaining module 802, configured to obtain at least two target arrays in the task set, each of the target arrays includes a task ID and a task sequence number of a task to be processed.
目标执行节点确定模块803,用于获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点。The target execution node determination module 803 is configured to acquire the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes.
执行结果获取模块804,用于调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。The execution result obtaining module 804 is configured to call threads corresponding to the number of execution nodes, execute at least two tasks to be processed, and obtain execution results corresponding to at least two tasks to be processed.
在一实施例中,在所述任务集合遍历模块801之前,所述分布式多任务管理装置还包括:待分配任务请求获取单元、目标数组获取单元和任务集合形成单元。In an embodiment, before the task set traversing module 801, the distributed multi-task management apparatus further includes: a to-be-assigned task request acquisition unit, a target array acquisition unit, and a task set formation unit.
待分配任务请求获取单元,用于获取至少两个待分配任务请求,每一所述待分配任务请求包括待处理任务的任务ID和任务序号。The to-be-allocated task request acquisition unit is configured to acquire at least two to-be-allocated task requests, each of the to-be-allocated task requests includes a task ID and a task sequence number of the to-be-processed task.
目标数组获取单元,用于基于每一所述待处理任务对应的所述任务ID和所述任务序号,获取目标数组。A target array obtaining unit, configured to obtain a target array based on the task ID and the task sequence number corresponding to each task to be processed.
任务集合形成单元,用于将所述目标数组插入分布式中间件上创建的原始集合,形成任务集合。The task set forming unit is used for inserting the target array into the original set created on the distributed middleware to form a task set.
在一实施例中,所述待分配任务请求获取单元,包括:待处理队列遍历子单元、任务序号获取子单元和待分配任务请求生成子单元。In one embodiment, the to-be-assigned task request acquisition unit includes: a to-be-processed queue traversal subunit, a task sequence number acquisition subunit, and a to-be-allocated task request generation subunit.
待处理队列遍历子单元,用于当系统当前时间达到预设时间时,则遍历待处理队列,获取至少两个所述待处理任务对应的任务ID和遍历顺序。The to-be-processed queue traversal subunit is used to traverse the to-be-processed queue when the current time of the system reaches a preset time, and obtain the task IDs and the traversal order corresponding to at least two of the to-be-processed tasks.
任务序号获取子单元,用于根据所述待处理任务对应的遍历顺序,获取所述待处理任务对应的任务序号。The task sequence number obtaining subunit is configured to obtain the task sequence number corresponding to the to-be-processed task according to the traversal sequence corresponding to the to-be-processed task.
待分配任务请求生成子单元,用于根据所述待处理任务对应的任务ID和所述任务序号,生成待分配任务请求。The to-be-allocated task request generating subunit is configured to generate a to-be-allocated task request according to the task ID corresponding to the to-be-processed task and the task sequence number.
在一实施例中,目标执行节点包括节点序号;所述目标执行节点确定模块803,包括:获取余数单元和目标执行节点确定单元。In an embodiment, the target execution node includes a node sequence number; the target execution node determination module 803 includes: a remainder obtaining unit and a target execution node determination unit.
获取余数单元,用于采用所述待处理任务的所述任务序号除以所述执行节点数量得到余数。A remainder obtaining unit, configured to divide the task sequence number of the to-be-processed task by the number of execution nodes to obtain a remainder.
目标执行节点确定单元,将与所述余数相等的所述节点序号对应的空闲执行节点,确定为所述任务序号对应的所述待处理任务的目标执行节点。The target execution node determination unit determines the idle execution node corresponding to the node sequence number with the same remainder as the target execution node of the to-be-processed task corresponding to the task sequence number.
在一实施例中,所述待处理任务还包括任务单号;即所述执行结果获取模块804,包括:判断单元、执行依赖关系确定单元和执行结果获取单元。In an embodiment, the task to be processed further includes a task order number; that is, the execution result obtaining module 804 includes: a judgment unit, an execution dependency relationship determination unit, and an execution result obtaining unit.
判断单元,用于根据所述任务单号,判断至少两个所述待处理任务是否存在执行依赖关系。A judging unit, configured to judge whether there is an execution dependency relationship between at least two of the to-be-processed tasks according to the task order number.
执行依赖关系确定单元,用于若至少两个所述待处理任务存在执行依赖关系,则根据所述执行依赖关系,将至少两个所述待处理任务确定为前向任务和后向任务。An execution dependency determination unit, configured to determine at least two of the to-be-processed tasks as a forward task and a backward task according to the execution dependency if there is an execution dependency of the at least two to-be-processed tasks.
执行结果获取单元,用于依序执行所述前向任务和所述后向任务,获取执行结果。The execution result obtaining unit is configured to execute the forward task and the backward task in sequence, and obtain the execution result.
在一实施例中,所述执行结果获取单元,包括:判断子单元、第一执行子单元、阻塞队列建立子单元、前向任务执行子单元和第二执行子单元。In one embodiment, the execution result obtaining unit includes: a judgment subunit, a first execution subunit, a blocking queue establishment subunit, a forward task execution subunit, and a second execution subunit.
判断子单元,用于判断所述前向任务和所述后向任务是否在同一目标执行节点上。A judging subunit, configured to judge whether the forward task and the backward task are on the same target execution node.
第一执行子单元,用于若所述前向任务和所述后向任务在同一目标执行节点上,则执行所述依序执行所述前向任务和所述后向任务,获取执行结果。The first execution subunit is configured to execute the sequential execution of the forward task and the backward task if the forward task and the backward task are on the same target execution node, and obtain an execution result.
阻塞队列建立子单元,用于若所述前向任务和所述后向任务不在同一目标执行节点上,则在所述前向任务对应的目标执行节点和所述后向任务对应的目标执行节点之间建立阻塞队列。Blocking queue establishment subunit, for if the forward task and the backward task are not on the same target execution node, then the target execution node corresponding to the forward task and the target execution node corresponding to the backward task A blocking queue is established between.
前向任务执行子单元,用于执行所述前向任务,获取所述前向任务对应的执行结果,将所述前向任务对应的执行结果发送到阻塞队列中,其中,所述阻塞队列用于向所述后向任务对应的目标执行节点发送包括所述前向任务对应的执行结果的执行指令。The forward task execution subunit is used to execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to the blocking queue, wherein the blocking queue uses and sending an execution instruction including the execution result corresponding to the forward task to the target execution node corresponding to the backward task.
第二执行子单元,用于根据根据所述执行指令执行所述后向任务,获取所述后向任务对应的执行结果。The second execution subunit is configured to execute the backward task according to the execution instruction, and obtain an execution result corresponding to the backward task.
关于分布式多任务管理装置的具体限定可以参见上文中对于分布式多任务管理方法的限定,在此不再赘述。上述分布式多任务管理装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For specific limitations on the distributed multitasking management apparatus, reference may be made to the foregoing limitations on the distributed multitasking management method, which will not be repeated here. Each module in the above-mentioned distributed multitasking management apparatus may be implemented in whole or in part by software, hardware and combinations thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图9所示。该计算机设备包括通过系统总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储待处理任务。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种分布式多任务管理方法。In one embodiment, a computer device is provided, and the computer device may be a server, and its internal structure diagram may be as shown in FIG. 9 . The computer device includes a processor, memory, a network interface, and a database connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, computer readable instructions and a database. The internal memory provides an environment for the execution of the operating system and computer-readable instructions in the non-volatile storage medium. The database of the computer device is used to store pending tasks. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer-readable instructions, when executed by a processor, implement a distributed multitasking management method.
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,处理器执行计算机可读指令时实现上述实施例中分布式多任务管理方法的步骤,例如图2所示的步骤S201-S204,或者图3至图7中所示的步骤,为避免重复,这里不再赘述。或者,处理器执行计算机可读指令时实现分布式多任务管理装置这一实施例中的各模块/单元的功能,例如图8所示的任务集合遍历模块801、目标数组获取模块802、目标执行节点确定模块803和执行结果获取模块804的功能,为避免重复,这里不再赘述。In one embodiment, a computer device is provided, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, and the processor implements the distribution in the above embodiment when the processor executes the computer-readable instructions The steps of the multitasking management method, such as steps S201-S204 shown in FIG. 2 , or steps shown in FIG. 3 to FIG. 7 , are not repeated here to avoid repetition. Alternatively, when the processor executes the computer-readable instructions, the functions of each module/unit in this embodiment of the distributed multitasking management apparatus are implemented, for example, the task set traversal module 801, the target array acquisition module 802, the target execution module shown in FIG. 8 The functions of the node determination module 803 and the execution result acquisition module 804 are not repeated here to avoid repetition.
在一实施例中,提供一个或多个存储有计算机可读指令的可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行时实现上述实施例中分布式多任务管理方法的步骤,例如图2所示的步骤S201-S204,或者图3至图7中所示的步骤,为避免重复,这里不再赘述。或者,处理器执行计算机可读指令时实现分布式多任务管理装置这一实施例中的各模块/单元的功能,例如图8所示的任务集合遍历模块801、目标数组获取模块802、目标执行节点确定模块803和执行结果获取模块804的功能,为避免重复,这里不再赘述。本实施例中的可读存储介质包括非易失性可读存储介质和易失性可读存储介质。In one embodiment, one or more readable storage media storing computer readable instructions are provided, the computer readable storage media having computer readable instructions stored thereon, the computer readable instructions being stored by one or more processors. During execution, the one or more processors implement the steps of the distributed multitasking management method in the foregoing embodiment, such as steps S201-S204 shown in FIG. 2 , or steps shown in FIG. 3 to FIG. 7 . , in order to avoid repetition, it will not be repeated here. Alternatively, when the processor executes the computer-readable instructions, the functions of each module/unit in this embodiment of the distributed multitasking management apparatus are implemented, for example, the task set traversal module 801, the target array acquisition module 802, the target execution module shown in FIG. 8 The functions of the node determination module 803 and the execution result acquisition module 804 are not repeated here to avoid repetition. The readable storage medium in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,所述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink) DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile computer. In the readable storage medium, the computer-readable instructions, when executed, may include the processes of the foregoing method embodiments. Wherein, any reference to memory, storage, database or other medium used in the various embodiments provided in this application may include non-volatile and/or volatile memory. Nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM) and so on.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。Those skilled in the art can clearly understand that, for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned functions can be allocated to different functional units, Module completion, that is, dividing the internal structure of the device into different functional units or modules to complete all or part of the functions described above.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。  The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the above-mentioned embodiments, those of ordinary skill in the art should understand that: it is still possible to implement the above-mentioned implementations. The technical solutions described in the examples are modified, or some technical features thereof are equivalently replaced; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the application, and should be included in the within the scope of protection of this application. 

Claims (20)

  1. 一种分布式多任务管理方法,其中,包括:A distributed multitasking management method, comprising:
    获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;Obtain a task execution request, and traverse the task collection created on the distributed middleware based on the task execution request;
    获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;Obtain at least two target arrays in the task set, each of which includes the task ID and the task sequence number of the task to be processed;
    获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes;
    调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。A thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
  2. 如权利要求1所述的分布式多任务管理方法,其中,在所述获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合之前,所述分布式多任务管理方法包括:The distributed multi-task management method according to claim 1, wherein before the task execution request is acquired and the task set created on the distributed middleware is traversed based on the task execution request, the distributed multi-task management Methods include:
    获取至少两个待分配任务请求,每一所述待分配任务请求包括待处理任务的任务ID和任务序号;Obtain at least two task requests to be assigned, and each described task request to be assigned includes a task ID and a task sequence number of the task to be processed;
    基于每一所述待处理任务对应的所述任务ID和所述任务序号,获取目标数组;Obtain a target array based on the task ID and the task sequence number corresponding to each of the tasks to be processed;
    将所述目标数组插入分布式中间件上创建的原始集合,形成任务集合。Insert the target array into the original collection created on the distributed middleware to form a task collection.
  3. 如权利要求2所述的分布式多任务管理方法,其中,所述获取至少两个待分配任务请求,包括:The distributed multitasking management method according to claim 2, wherein the acquiring at least two task requests to be assigned comprises:
    当系统当前时间达到预设时间时,则遍历待处理队列,获取至少两个所述待处理任务对应的任务ID和遍历顺序;When the current time of the system reaches the preset time, it traverses the queue to be processed, and obtains the task ID and the traversal order corresponding to at least two of the tasks to be processed;
    根据所述待处理任务对应的遍历顺序,获取所述待处理任务对应的任务序号;According to the traversal sequence corresponding to the to-be-processed task, obtain the task sequence number corresponding to the to-be-processed task;
    根据所述待处理任务对应的任务ID和所述任务序号,生成待分配任务请求。A task request to be allocated is generated according to the task ID corresponding to the task to be processed and the task sequence number.
  4. 如权利要求1所述的分布式多任务管理方法,其中,目标执行节点包括节点序号;The distributed multitasking management method of claim 1, wherein the target execution node includes a node sequence number;
    所述根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点,包括:The determining the target execution node corresponding to each task to be processed according to the task sequence number and the number of execution nodes includes:
    采用所述待处理任务的所述任务序号除以所述执行节点数量得到余数;The remainder is obtained by dividing the task sequence number of the task to be processed by the number of execution nodes;
    将与所述余数相等的所述节点序号对应的空闲执行节点,确定为所述任务序号对应的所述待处理任务的目标执行节点。Determine the idle execution node corresponding to the node sequence number equal to the remainder as the target execution node of the to-be-processed task corresponding to the task sequence number.
  5. 如权利要求1所述的分布式多任务管理方法,其中,所述待处理任务还包括任务单号;The distributed multi-task management method according to claim 1, wherein the to-be-processed task further comprises a task order number;
    所述执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果,包括:The executing at least two of the tasks to be processed, and obtaining the execution results corresponding to the at least two tasks to be processed, includes:
    根据所述任务单号,判断至少两个所述待处理任务是否存在执行依赖关系;According to the task order number, determine whether at least two of the to-be-processed tasks have an execution dependency;
    若至少两个所述待处理任务存在执行依赖关系,则根据所述执行依赖关系,将至少两个所述待处理任务确定为前向任务和后向任务;If at least two of the to-be-processed tasks have execution dependencies, determining at least two of the to-be-processed tasks as forward tasks and backward tasks according to the execution dependencies;
    依序执行所述前向任务和所述后向任务,获取执行结果。Execute the forward task and the backward task in sequence to obtain an execution result.
  6. 如权利要求5所述的分布式多任务管理方法,其中,所述依序执行所述前向任务和所述后向任务,获取执行结果,包括:The distributed multi-task management method according to claim 5, wherein the executing the forward task and the backward task in sequence, and obtaining the execution result, comprises:
    判断所述前向任务和所述后向任务是否在同一目标执行节点上;Determine whether the forward task and the backward task are on the same target execution node;
    若所述前向任务和所述后向任务在同一目标执行节点上,则执行所述依序执行所述前向任务和所述后向任务,获取执行结果;If the forward task and the backward task are on the same target execution node, execute the sequential execution of the forward task and the backward task, and obtain an execution result;
    若所述前向任务和所述后向任务不在同一目标执行节点上,则在所述前向任务对应的目标执行节点和所述后向任务对应的目标执行节点之间建立阻塞队列;If the forward task and the backward task are not on the same target execution node, a blocking queue is established between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task;
    执行所述前向任务,获取所述前向任务对应的执行结果,将所述前向任务对应的执行结果发送到阻塞队列中,其中,所述阻塞队列用于向所述后向任务对应的目标执行节点发送包括所述前向任务对应的执行结果的执行指令;Execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to the blocking queue, where the blocking queue is used to send the corresponding execution result to the backward task. The target execution node sends an execution instruction including an execution result corresponding to the forward task;
    根据所述执行指令执行所述后向任务,获取所述后向任务对应的执行结果。The backward task is executed according to the execution instruction, and an execution result corresponding to the backward task is acquired.
  7. 一种分布式多任务管理装置,其中,包括:A distributed multitasking management device, comprising:
    任务集合遍历模块,用于获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;a task set traversal module, configured to obtain a task execution request, and traverse the task set created on the distributed middleware based on the task execution request;
    目标数组获取模块,用于获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;A target array acquisition module, used to obtain at least two target arrays in the task set, each of the target arrays including the task ID and the task sequence number of the task to be processed;
    目标执行节点确定模块,用于获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;a target execution node determination module, configured to obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the to-be-processed tasks according to the task sequence number and the number of execution nodes;
    执行结果获取模块,用于调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。The execution result obtaining module is configured to call threads corresponding to the number of execution nodes, execute at least two tasks to be processed, and obtain execution results corresponding to at least two tasks to be processed.
  8. 如权利要求7所述的分布式多任务管理装置,其中,所述分布式多任务管理装置还包括:The distributed multitasking management device according to claim 7, wherein the distributed multitasking management device further comprises:
    待分配任务请求获取单元,用于获取至少两个待分配任务请求,每一所述待分配任务请求包括待处理任务的任务ID和任务序号;A task request acquisition unit to be assigned, for acquiring at least two task requests to be assigned, each of the task requests to be assigned includes a task ID and a task sequence number of the task to be processed;
    目标数组获取单元,用于基于每一所述待处理任务对应的所述任务ID和所述任务序号,获取目标数组;a target array obtaining unit, used for obtaining a target array based on the task ID and the task sequence number corresponding to each of the tasks to be processed;
    任务集合形成单元,用于将所述目标数组插入分布式中间件上创建的原始集合,形成任务集合。The task set forming unit is used for inserting the target array into the original set created on the distributed middleware to form a task set.
  9. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其中,所述处理器执行所述计算机可读指令时实现如下步骤:A computer device comprising a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer-readable instructions:
    获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;Obtain a task execution request, and traverse the task collection created on the distributed middleware based on the task execution request;
    获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;Obtain at least two target arrays in the task set, each of which includes the task ID and the task sequence number of the task to be processed;
    获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes;
    调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。A thread corresponding to the number of the execution nodes is called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
  10. 如权利要求9所述的计算机设备,其中,在所述获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合之前,所述处理器执行所述计算机可读指令时还实现如下步骤:10. The computer device of claim 9, wherein the processor executes the computer-readable instructions prior to the obtaining a task execution request and traversing a set of tasks created on the distributed middleware based on the task execution request Also implement the following steps:
    获取至少两个待分配任务请求,每一所述待分配任务请求包括待处理任务的任务ID和任务序号;Obtain at least two task requests to be assigned, and each described task request to be assigned includes a task ID and a task sequence number of the task to be processed;
    基于每一所述待处理任务对应的所述任务ID和所述任务序号,获取目标数组;Obtain a target array based on the task ID and the task sequence number corresponding to each of the tasks to be processed;
    将所述目标数组插入分布式中间件上创建的原始集合,形成任务集合。Insert the target array into the original collection created on the distributed middleware to form a task collection.
  11. 如权利要求10所述的计算机设备,其中,所述获取至少两个待分配任务请求,包括:The computer device of claim 10, wherein the acquiring at least two task requests to be assigned comprises:
    当系统当前时间达到预设时间时,则遍历待处理队列,获取至少两个所述待处理任务对应的任务ID和遍历顺序;When the current time of the system reaches the preset time, it traverses the queue to be processed, and obtains the task ID and the traversal order corresponding to at least two of the tasks to be processed;
    根据所述待处理任务对应的遍历顺序,获取所述待处理任务对应的任务序号;According to the traversal sequence corresponding to the to-be-processed task, obtain the task sequence number corresponding to the to-be-processed task;
    根据所述待处理任务对应的任务ID和所述任务序号,生成待分配任务请求。A task request to be allocated is generated according to the task ID corresponding to the task to be processed and the task sequence number.
  12. 如权利要求9所述的计算机设备,其中,目标执行节点包括节点序号;The computer device of claim 9, wherein the target execution node includes a node sequence number;
    所述根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点,包括:The determining the target execution node corresponding to each task to be processed according to the task sequence number and the number of execution nodes includes:
    采用所述待处理任务的所述任务序号除以所述执行节点数量得到余数;The remainder is obtained by dividing the task sequence number of the task to be processed by the number of execution nodes;
    将与所述余数相等的所述节点序号对应的空闲执行节点,确定为所述任务序号对应的所述待处理任务的目标执行节点。Determine the idle execution node corresponding to the node sequence number equal to the remainder as the target execution node of the to-be-processed task corresponding to the task sequence number.
  13. 如权利要求9所述的计算机设备,其中,所述待处理任务还包括任务单号;The computer device of claim 9, wherein the task to be processed further comprises a task order number;
    所述执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果,包括:The executing at least two of the tasks to be processed, and obtaining the execution results corresponding to the at least two tasks to be processed, includes:
    根据所述任务单号,判断至少两个所述待处理任务是否存在执行依赖关系;According to the task order number, determine whether at least two of the to-be-processed tasks have an execution dependency;
    若至少两个所述待处理任务存在执行依赖关系,则根据所述执行依赖关系,将至少两个所述待处理任务确定为前向任务和后向任务;If at least two of the to-be-processed tasks have execution dependencies, determining at least two of the to-be-processed tasks as forward tasks and backward tasks according to the execution dependencies;
    依序执行所述前向任务和所述后向任务,获取执行结果。Execute the forward task and the backward task in sequence to obtain an execution result.
  14. 如权利要求13所述的计算机设备,其中,所述依序执行所述前向任务和所述后向任务,获取执行结果,包括:The computer device according to claim 13, wherein, executing the forward task and the backward task in sequence, and obtaining the execution result, comprises:
    判断所述前向任务和所述后向任务是否在同一目标执行节点上;Determine whether the forward task and the backward task are on the same target execution node;
    若所述前向任务和所述后向任务在同一目标执行节点上,则执行所述依序执行所述前向任务和所述后向任务,获取执行结果;If the forward task and the backward task are on the same target execution node, execute the sequential execution of the forward task and the backward task, and obtain an execution result;
    若所述前向任务和所述后向任务不在同一目标执行节点上,则在所述前向任务对应的目标执行节点和所述后向任务对应的目标执行节点之间建立阻塞队列;If the forward task and the backward task are not on the same target execution node, a blocking queue is established between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task;
    执行所述前向任务,获取所述前向任务对应的执行结果,将所述前向任务对应的执行结果发送到阻塞队列中,其中,所述阻塞队列用于向所述后向任务对应的目标执行节点发送包括所述前向任务对应的执行结果的执行指令;Execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to the blocking queue, where the blocking queue is used to send the corresponding execution result to the backward task. The target execution node sends an execution instruction including an execution result corresponding to the forward task;
    根据所述执行指令执行所述后向任务,获取所述后向任务对应的执行结果。The backward task is executed according to the execution instruction, and an execution result corresponding to the backward task is acquired.
  15. 一个或多个存储有计算机可读指令的可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其中,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:One or more readable storage media having computer-readable instructions stored thereon, the computer-readable storage media having computer-readable instructions stored thereon, wherein the computer-readable instructions, when executed by one or more processors, cause all The one or more processors perform the following steps:
    获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合;Obtain a task execution request, and traverse the task collection created on the distributed middleware based on the task execution request;
    获取所述任务集合中的至少两个目标数组,每一所述目标数组包括待处理任务的任务ID和任务序号;Obtain at least two target arrays in the task set, each of which includes the task ID and the task sequence number of the task to be processed;
    获取空闲执行节点对应的执行节点数量,根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点;Obtain the number of execution nodes corresponding to the idle execution nodes, and determine the target execution node corresponding to each of the tasks to be processed according to the task sequence number and the number of execution nodes;
    调用与所述执行节点数量相对应的线程,执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果。The threads corresponding to the number of execution nodes are called to execute at least two of the tasks to be processed, and execution results corresponding to the at least two tasks to be processed are obtained.
  16. 如权利要求15所述的可读存储介质,其中,在所述获取任务执行请求,基于所述任务执行请求遍历在分布式中间件上创建的任务集合之前,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器还执行如下步骤:16. The readable storage medium of claim 15, wherein the computer-readable instructions are executed by one or more prior to obtaining the task execution request and traversing the task set created on the distributed middleware based on the task execution request. When executed by multiple processors, the one or more processors are caused to further perform the following steps:
    获取至少两个待分配任务请求,每一所述待分配任务请求包括待处理任务的任务ID和任务序号;Obtain at least two task requests to be assigned, and each described task request to be assigned includes a task ID and a task sequence number of the task to be processed;
    基于每一所述待处理任务对应的所述任务ID和所述任务序号,获取目标数组;Obtain a target array based on the task ID and the task sequence number corresponding to each of the tasks to be processed;
    将所述目标数组插入分布式中间件上创建的原始集合,形成任务集合。Insert the target array into the original collection created on the distributed middleware to form a task collection.
  17. 如权利要求16所述的可读存储介质,其中,所述获取至少两个待分配任务请求,包括:The readable storage medium of claim 16, wherein the acquiring at least two task requests to be assigned comprises:
    当系统当前时间达到预设时间时,则遍历待处理队列,获取至少两个所述待处理任务对应的任务ID和遍历顺序;When the current time of the system reaches the preset time, the queue to be processed is traversed, and the task ID and the traversal order corresponding to at least two of the tasks to be processed are obtained;
    根据所述待处理任务对应的遍历顺序,获取所述待处理任务对应的任务序号;According to the traversal sequence corresponding to the to-be-processed task, obtain the task sequence number corresponding to the to-be-processed task;
    根据所述待处理任务对应的任务ID和所述任务序号,生成待分配任务请求。A task request to be allocated is generated according to the task ID corresponding to the task to be processed and the task sequence number.
  18. 如权利要求15所述的可读存储介质,其中,目标执行节点包括节点序号;The readable storage medium of claim 15, wherein the target execution node includes a node sequence number;
    所述根据所述任务序号和执行节点数量,确定每一所述待处理任务对应的目标执行节点,包括:The determining the target execution node corresponding to each task to be processed according to the task sequence number and the number of execution nodes includes:
    采用所述待处理任务的所述任务序号除以所述执行节点数量得到余数;The remainder is obtained by dividing the task sequence number of the task to be processed by the number of execution nodes;
    将与所述余数相等的所述节点序号对应的空闲执行节点,确定为所述任务序号对应的所述待处理任务的目标执行节点。Determine the idle execution node corresponding to the node sequence number equal to the remainder as the target execution node of the to-be-processed task corresponding to the task sequence number.
  19. 如权利要求15所述的可读存储介质,其中,所述待处理任务还包括任务单号;The readable storage medium of claim 15, wherein the task to be processed further comprises a task ticket number;
    所述执行至少两个所述待处理任务,获取至少两个所述待处理任务对应的执行结果,包括:The executing at least two tasks to be processed and obtaining the execution results corresponding to the at least two tasks to be processed include:
    根据所述任务单号,判断至少两个所述待处理任务是否存在执行依赖关系;According to the task order number, determine whether at least two of the to-be-processed tasks have an execution dependency;
    若至少两个所述待处理任务存在执行依赖关系,则根据所述执行依赖关系,将至少两个所述待处理任务确定为前向任务和后向任务;If at least two of the to-be-processed tasks have execution dependencies, determining at least two of the to-be-processed tasks as forward tasks and backward tasks according to the execution dependencies;
    依序执行所述前向任务和所述后向任务,获取执行结果。Execute the forward task and the backward task in sequence to obtain an execution result.
  20. 如权利要求19所述的可读存储介质,其中,所述依序执行所述前向任务和所述后向任务,获取执行结果,包括:The readable storage medium according to claim 19, wherein the executing the forward task and the backward task in sequence, and obtaining the execution result, comprises:
    判断所述前向任务和所述后向任务是否在同一目标执行节点上;Determine whether the forward task and the backward task are on the same target execution node;
    若所述前向任务和所述后向任务在同一目标执行节点上,则执行所述依序执行所述前向任务和所述后向任务,获取执行结果;If the forward task and the backward task are on the same target execution node, execute the sequential execution of the forward task and the backward task, and obtain an execution result;
    若所述前向任务和所述后向任务不在同一目标执行节点上,则在所述前向任务对应的目标执行节点和所述后向任务对应的目标执行节点之间建立阻塞队列;If the forward task and the backward task are not on the same target execution node, a blocking queue is established between the target execution node corresponding to the forward task and the target execution node corresponding to the backward task;
    执行所述前向任务,获取所述前向任务对应的执行结果,将所述前向任务对应的执行结果发送到阻塞队列中,其中,所述阻塞队列用于向所述后向任务对应的目标执行节点发送包括所述前向任务对应的执行结果的执行指令;Execute the forward task, obtain the execution result corresponding to the forward task, and send the execution result corresponding to the forward task to the blocking queue, wherein the blocking queue is used to send the corresponding execution result to the backward task. The target execution node sends an execution instruction including an execution result corresponding to the forward task;
    根据所述执行指令执行所述后向任务,获取所述后向任务对应的执行结果。The backward task is executed according to the execution instruction, and an execution result corresponding to the backward task is acquired.
      
PCT/CN2021/125570 2020-11-17 2021-10-22 Distributed multi-task management method and apparatus, and computer device and storage medium WO2022105531A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011283749.3A CN112099958B (en) 2020-11-17 2020-11-17 Distributed multi-task management method and device, computer equipment and storage medium
CN202011283749.3 2020-11-17

Publications (1)

Publication Number Publication Date
WO2022105531A1 true WO2022105531A1 (en) 2022-05-27

Family

ID=73786008

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/125570 WO2022105531A1 (en) 2020-11-17 2021-10-22 Distributed multi-task management method and apparatus, and computer device and storage medium

Country Status (2)

Country Link
CN (1) CN112099958B (en)
WO (1) WO2022105531A1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115296958A (en) * 2022-06-28 2022-11-04 青岛海尔科技有限公司 Distribution method and device of equipment control task, storage medium and electronic device
CN115794660A (en) * 2023-02-06 2023-03-14 青软创新科技集团股份有限公司 Control method, device and system based on distributed program evaluation
CN116561171A (en) * 2023-07-10 2023-08-08 浙江邦盛科技股份有限公司 Method, device, equipment and medium for processing dual-time-sequence distribution of inclination data
CN116680064A (en) * 2023-08-03 2023-09-01 中航信移动科技有限公司 Task node management method, electronic equipment and storage medium
CN117573730A (en) * 2024-01-16 2024-02-20 腾讯科技(深圳)有限公司 Data processing method, apparatus, device, readable storage medium, and program product

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112099958B (en) * 2020-11-17 2021-03-02 深圳壹账通智能科技有限公司 Distributed multi-task management method and device, computer equipment and storage medium
CN112925618A (en) * 2021-02-22 2021-06-08 北京达佳互联信息技术有限公司 Distributed task processing method and device
CN112835945A (en) * 2021-02-25 2021-05-25 平安消费金融有限公司 User data-based label processing method, system, device and storage medium
CN113127172A (en) * 2021-04-21 2021-07-16 上海销氪信息科技有限公司 Task execution method and device, electronic equipment and storage medium
CN113052707A (en) * 2021-04-30 2021-06-29 中国工商银行股份有限公司 Application production method and device, computer equipment and storage medium
CN113379259A (en) * 2021-06-17 2021-09-10 北京沃东天骏信息技术有限公司 Information processing method, device and system
CN113608851A (en) * 2021-08-03 2021-11-05 北京金山云网络技术有限公司 Task allocation method and device, electronic equipment and storage medium
CN114020420B (en) * 2021-09-22 2024-08-06 成都鲁易科技有限公司 Distributed task to be executed execution method and system, storage medium and terminal
CN118210597A (en) * 2022-12-15 2024-06-18 华为技术有限公司 Task scheduling method, device and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271167A (en) * 2011-09-09 2011-12-07 刘浩 Agent parallel processing method and structure suitable for distributive communication middleware
CN110716796A (en) * 2019-09-02 2020-01-21 中国平安财产保险股份有限公司 Intelligent task scheduling method and device, storage medium and electronic equipment
US10742313B1 (en) * 2017-08-01 2020-08-11 Diego Favarolo System to optimize allocation and usage of resources, goods, and services among nodes in a cluster of nodes and a method for the optimal and transparent exchange of resources, goods, and services among nodes in a cluster of nodes
CN112099958A (en) * 2020-11-17 2020-12-18 深圳壹账通智能科技有限公司 Distributed multi-task management method and device, computer equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6823516B1 (en) * 1999-08-10 2004-11-23 Intel Corporation System and method for dynamically adjusting to CPU performance changes
CN103414762B (en) * 2013-07-23 2016-05-25 中国联合网络通信集团有限公司 cloud backup method and device
CN105159783A (en) * 2015-10-09 2015-12-16 上海瀚之友信息技术服务有限公司 System task distribution method
CN108446171B (en) * 2018-02-01 2022-07-08 平安科技(深圳)有限公司 Electronic device, distributed system execution task allocation method and storage medium
CN110297711B (en) * 2019-05-16 2024-01-19 平安科技(深圳)有限公司 Batch data processing method, device, computer equipment and storage medium
CN110413391B (en) * 2019-07-24 2022-02-25 上海交通大学 Deep learning task service quality guarantee method and system based on container cluster

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102271167A (en) * 2011-09-09 2011-12-07 刘浩 Agent parallel processing method and structure suitable for distributive communication middleware
US10742313B1 (en) * 2017-08-01 2020-08-11 Diego Favarolo System to optimize allocation and usage of resources, goods, and services among nodes in a cluster of nodes and a method for the optimal and transparent exchange of resources, goods, and services among nodes in a cluster of nodes
CN110716796A (en) * 2019-09-02 2020-01-21 中国平安财产保险股份有限公司 Intelligent task scheduling method and device, storage medium and electronic equipment
CN112099958A (en) * 2020-11-17 2020-12-18 深圳壹账通智能科技有限公司 Distributed multi-task management method and device, computer equipment and storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115296958A (en) * 2022-06-28 2022-11-04 青岛海尔科技有限公司 Distribution method and device of equipment control task, storage medium and electronic device
CN115296958B (en) * 2022-06-28 2024-03-22 青岛海尔科技有限公司 Distribution method and device of equipment control tasks, storage medium and electronic device
CN115794660A (en) * 2023-02-06 2023-03-14 青软创新科技集团股份有限公司 Control method, device and system based on distributed program evaluation
CN116561171A (en) * 2023-07-10 2023-08-08 浙江邦盛科技股份有限公司 Method, device, equipment and medium for processing dual-time-sequence distribution of inclination data
CN116561171B (en) * 2023-07-10 2023-09-15 浙江邦盛科技股份有限公司 Method, device, equipment and medium for processing dual-time-sequence distribution of inclination data
CN116680064A (en) * 2023-08-03 2023-09-01 中航信移动科技有限公司 Task node management method, electronic equipment and storage medium
CN116680064B (en) * 2023-08-03 2023-10-10 中航信移动科技有限公司 Task node management method, electronic equipment and storage medium
CN117573730A (en) * 2024-01-16 2024-02-20 腾讯科技(深圳)有限公司 Data processing method, apparatus, device, readable storage medium, and program product
CN117573730B (en) * 2024-01-16 2024-04-05 腾讯科技(深圳)有限公司 Data processing method, apparatus, device, readable storage medium, and program product

Also Published As

Publication number Publication date
CN112099958B (en) 2021-03-02
CN112099958A (en) 2020-12-18

Similar Documents

Publication Publication Date Title
WO2022105531A1 (en) Distributed multi-task management method and apparatus, and computer device and storage medium
US10178045B2 (en) Dynamic discovery and management of microservices for multi-cluster computing platforms
WO2020147330A1 (en) Data stream processing method and system
US9921870B2 (en) System and method for supporting a scalable thread pool in a distributed data grid
CN110383764B (en) System and method for processing events using historical data in a serverless system
WO2017133623A1 (en) Data stream processing method, apparatus, and system
US9348709B2 (en) Managing nodes in a distributed computing environment
US20170031622A1 (en) Methods for allocating storage cluster hardware resources and devices thereof
US9104501B2 (en) Preparing parallel tasks to use a synchronization register
WO2022105138A1 (en) Decentralized task scheduling method, apparatus, device, and medium
CN107291536B (en) Application task flow scheduling method in cloud computing environment
WO2016206564A1 (en) Operation scheduling method, device and distribution system
Fu et al. Twitter heron: Towards extensible streaming engines
Ding et al. Optimal operator state migration for elastic data stream processing
CN112231098A (en) Task processing method, device, equipment and storage medium
Petrov et al. Adaptive performance model for dynamic scaling Apache Spark Streaming
CN110442454A (en) A kind of resource regulating method, device and computer equipment
CN112039963B (en) Processor binding method and device, computer equipment and storage medium
WO2021093323A1 (en) Data recovery method and system, data storage node, and database management node
US9934268B2 (en) Providing consistent tenant experiences for multi-tenant databases
WO2021179522A1 (en) Computing resource allocation system, method, and apparatus, and computer device
US9110823B2 (en) Adaptive and prioritized replication scheduling in storage clusters
US20220114188A1 (en) Efficient Database Loading
CN113986523A (en) Method, system, equipment and medium for optimizing resource allocation of Flink system
CN114610765A (en) Stream calculation method, apparatus, device and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21893679

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.08.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21893679

Country of ref document: EP

Kind code of ref document: A1