Task allocation method and device

By matching task channels based on task type in a distributed system and allocating tasks according to channel weights, the problems of low resource utilization and unbalanced load are solved, and the overall efficiency of the system and task execution efficiency are improved.

CN118963941AInactive Publication Date: 2024-11-15CHINA ELECTRONICS JINXIN DIGITAL TECH GRP CO LTD

Patent Information

Application Number
CN202410995402.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-15
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The problems of low resource utilization and unbalanced load in distributed systems affect the overall efficiency and service quality of the system. Improper task allocation leads to idle resources in some service nodes and excessive loads in other service nodes.

Method used

By obtaining the task type of the task to be assigned, matching the corresponding task channel, and determining the target task channel based on the channel weight, the tasks are allocated to service nodes with the best performance and available resources to achieve load balancing and improve resource utilization.

Benefits of technology

It effectively avoids the service node resources being idle or overloaded, improves task execution efficiency and overall system performance, and ensures full utilization of resources and balanced load distribution.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118963941A_ABST
    Figure CN118963941A_ABST
Patent Text Reader

Abstract

The invention provides a task allocation method and device, and the method comprises the steps: obtaining a task type of a to-be-allocated task, and obtaining a first candidate task channel matched with the task type; determining a target task channel based on the channel weight of each first candidate task channel; distributing the to-be-distributed task to a target task channel, so that a target service node corresponding to the target task channel executes the to-be-distributed task; therefore, task allocation is carried out through the channel weights of the task channels, load balancing can be achieved, the resource utilization rate can be increased, and the situation that resources of part of service nodes are idle and loads of other service nodes are too heavy is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing technology, and in particular to a task allocation method and device. Background Art

[0002] With the rapid development of information technology, distributed systems have become key infrastructure to support large-scale data processing, high-concurrency services and complex business scenarios.

[0003] However, with the continuous expansion of the scale of distributed systems and the increasing complexity of business needs, distributed systems are facing unprecedented challenges, among which the problems of low resource utilization and unbalanced load are particularly prominent, which seriously affect the overall performance and service quality of distributed systems. Task allocation is a key link in distributed systems, which directly affects the resource utilization and load balancing of distributed systems. Therefore, how to achieve task allocation has become a problem that needs to be solved urgently. Summary of the invention

[0004] The present disclosure provides a task allocation method and device to solve one of the technical problems in the related art at least to a certain extent. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, a task assignment method is provided, comprising: obtaining a task type of a task to be assigned, and obtaining a first candidate task channel matching the task type; determining a target task channel based on a channel weight of each of the first candidate task channels; and assigning the task to be assigned to the target task channel so that a target service node corresponding to the target task channel executes the task to be assigned.

[0006] According to a second aspect of an embodiment of the present disclosure, a task allocation device is provided, comprising: an acquisition module, used to acquire the task type of the task to be allocated, and acquire a first candidate task channel matching the task type; a determination module, used to determine a target task channel based on the channel weight of each of the first candidate task channels; and an allocation module, used to allocate the task to be allocated to the target task channel, so that a target service node corresponding to the target task channel executes the task to be allocated.

[0007] According to the third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement a task allocation method as described in the first aspect of an embodiment of the present disclosure.

[0008] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement a task allocation method as described in the first aspect of an embodiment of the present disclosure.

[0009] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, which, when executed by a processor, implements a task allocation method as described in the first aspect of an embodiment of the present disclosure.

[0010] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0011] Obtain the task type of the task to be assigned, and obtain the first candidate task channel that matches the task type; determine the target task channel based on the channel weights of each first candidate task channel; assign the task to be assigned to the target task channel so that the target service node corresponding to the target task channel executes the task to be assigned. Thus, assigning tasks by the channel weights of the task channels helps to achieve load balancing and improve resource utilization, and avoids the situation where some service nodes have idle resources while other service nodes are overloaded. In addition, the first candidate task channels other than the historical task channels in the first candidate task channels are used as the second task candidate channels, and the target task channel is determined based on the channel weights of each second candidate task channel. This can avoid assigning the task to be assigned to the historical task channel again when the task has been assigned to the historical task channel, thereby avoiding the overload of the service nodes corresponding to the historical task channel. Among them, in response to the fact that the channel weights of all second candidate task channels are less than the set weight threshold, a third candidate task channel matching the task type of the task to be assigned is obtained, and based on the channel weight of the third candidate task channel, a target task channel is selected from the third candidate task channels. Thus, when the load of the service node corresponding to the second candidate task channel is heavy, the target task channel is selected from the third candidate task channel, which effectively shortens the waiting time for the task to be assigned to be executed and improves the task execution efficiency.

[0012] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] The above and / or additional aspects and advantages of the present disclosure will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0014] Figure 1 A flowchart of a task allocation method provided in the first embodiment of the present disclosure;

[0015] Figure 2A flowchart of a task allocation method provided in the second embodiment of the present disclosure;

[0016] Figure 3 A flowchart of a task allocation method provided in the third embodiment of the present disclosure;

[0017] Figure 4 A flowchart of a task allocation method provided in the fourth embodiment of the present disclosure;

[0018] Figure 5 A flowchart of a task allocation method provided in the fifth embodiment of the present disclosure;

[0019] Figure 6 A structural diagram of a task allocation device provided in a sixth embodiment of the present disclosure;

[0020] Figure 7 A structural schematic diagram of a task allocation device provided in the seventh embodiment of the present disclosure;

[0021] Figure 8 is a block diagram of an electronic device provided by an eighth embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0024] It should be noted that in the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information are all carried out with the user's consent, and are in compliance with relevant laws and regulations and do not violate public order and good morals.

[0025] The task allocation method and device according to the embodiments of the present disclosure are described below with reference to the accompanying drawings.

[0026] It should be noted that the execution subject of the task allocation method of this embodiment is a task allocation device, which can be implemented by software and / or hardware and can be configured in an electronic device. The electronic device serves as a task allocation node, which is used to transfer the task to be allocated to a service node so that the service node executes the task to be allocated.

[0027] Figure 1 A flowchart of a task allocation method provided in the first embodiment of the present disclosure.

[0028] like Figure 1 As shown, the task allocation method includes the following steps:

[0029] Step 101: Obtain the task type of the task to be assigned, and obtain the first candidate task channel matching the task type.

[0030] It should be noted that the tasks to be assigned refer to mathematical calculation tasks, image processing tasks, encryption and decryption tasks, decompression tasks, and data transmission tasks; the task type of the tasks to be assigned is used to indicate the resources required to execute the tasks to be assigned. For example, the task type of the tasks to be assigned may refer to CPU-intensive tasks, input / output (IO)-intensive tasks, memory-intensive tasks, and network-intensive tasks; the task channel refers to the channel or pipeline used to transmit and process tasks in a distributed system, which is usually used to transmit the tasks to be assigned from the task assignment node to a service node used to execute the tasks to be assigned. Through the distributed task channel, the tasks in the distributed system can be effectively managed and coordinated, and the performance and scalability of the distributed system can be improved.

[0031] It should be understood that, due to different resource configurations of different service nodes, different service nodes process tasks of different task types, and there is a corresponding relationship between task channels and service nodes. Therefore, in order to improve the efficiency of task execution, different task channels in the present disclosure are used to transmit different types of tasks. As an example, after receiving the task to be assigned, it is necessary to obtain the first candidate task channel that matches the task type of the task to be assigned from each task channel of the distributed system according to the matching relationship between the pre-defined task type and the task channel.

[0032] Step 102: Determine a target task channel based on the channel weights of the first candidate task channels.

[0033] As an example, the maximum value of the weights of the channel weights of the first candidate task channels is obtained, and the first candidate task channel corresponding to the maximum value of the weight is used as the target task channel.

[0034] The channel weight of the first candidate task channel is used to indicate the performance and available resources of the corresponding service node. It should be noted that the larger the channel weight, the better the performance of the corresponding service node and the more available resources.

[0035] Step 103: Allocate the task to be allocated to the target task channel, so that the target service node corresponding to the target task channel executes the task to be allocated.

[0036] In an embodiment of the present disclosure, there are one or more target service nodes corresponding to the target task channel; as an example, after determining the target task channel, the task to be assigned is transmitted to one or more target service nodes corresponding to the target task channel through the target task channel, so as to execute the task to be assigned through one or more target service nodes.

[0037] As an example, the target service node refers to a Pod node, which is a node running a container group (Pod) in a Kubernetes cluster.

[0038] It should be understood that the present disclosure distributes and schedules tasks in an orderly manner through task channels, thereby avoiding the situation where multiple tasks compete for the same service node resources at the same time, and thus there is no problem of service node resource preemption, while also avoiding the risk of system instability and crash caused by resource conflicts.

[0039] In summary, the task type of the task to be assigned is obtained, and the first candidate task channel matching the task type is obtained; based on the channel weights of each first candidate task channel, the target task channel is determined; the task to be assigned is assigned to the target task channel, so that the target service node corresponding to the target task channel executes the task to be assigned. Therefore, task assignment through the channel weight of the task channel helps to achieve load balancing and improve resource utilization, and avoid the situation where some service nodes have idle resources while other service nodes are overloaded.

[0040] In order to clearly explain how to determine the target task channel based on the channel weights of each first candidate task channel in the above embodiment, the present disclosure proposes another task allocation method.

[0041] Figure 2 A flowchart of a task allocation method provided in the second embodiment of the present disclosure.

[0042] like Figure 2 As shown, the task allocation method may include the following steps:

[0043] Step 201: Obtain the task type of the task to be assigned, and obtain the first candidate task channel matching the task type.

[0044] Step 202 , obtaining a historical task channel corresponding to a target historical task that has been assigned within a set historical period; wherein the task type of the target historical task is the same as the task type of the task to be assigned.

[0045] In the disclosed embodiment, the target historical task refers to a historical task that was assigned within a set historical period before the task to be assigned and has the same task type as the task to be assigned. The historical task channel corresponding to the target historical task refers to the task channel that transmits the target historical task.

[0046] As an example, the target historical task refers to the target task channel determined by the previous round of task allocation process.

[0047] Step 203: Acquire second candidate task channels other than the historical task channels in the first candidate task channels.

[0048] In order to avoid allocating the to-be-allocated task to the historical task channel again when the task has already been allocated to the historical task channel, resulting in excessive load on the service node corresponding to the historical task channel, as an example, the historical task channel is deleted from the first candidate task channel, and the remaining first candidate task channels are used as second candidate task channels; that is, the first candidate task channels except the historical task channels in the first candidate task channels are used as second task candidate channels.

[0049] Step 204: Determine the target task channel based on the channel weights of the second candidate task channels.

[0050] Since the channel weight indicates the performance and available resources of the corresponding service node, in order to improve the task execution efficiency and make full use of the service node resources, as an example, the maximum weight among the channel weights of each second candidate task channel is obtained, and the second candidate task channel corresponding to the maximum weight is used as the target task channel.

[0051] Step 205: Allocate the task to be allocated to the target task channel, so that the target service node corresponding to the target task channel executes the task to be allocated.

[0052] It should be noted that the execution process of step 201 and step 205 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0053] In summary, the historical task channel corresponding to the target historical task that has been assigned within the set historical period is obtained; wherein the task type of the target historical task is the same as the task type of the task to be assigned; the second candidate task channel other than the historical task channel in the first candidate task channel is obtained; and the target task channel is determined based on the channel weights of each second candidate task channel. Thus, the first candidate task channel other than the historical task channel in the first candidate task channel is used as the second task candidate channel, which avoids allocating the task to be assigned to the historical task channel again when the task has been assigned to the historical task channel, thereby avoiding overloading of the service node corresponding to the historical task channel.

[0054] In order to clearly explain how to determine the target task channel based on the channel weights of each second candidate task channel in the above embodiment, the present disclosure proposes another task allocation method.

[0055] Figure 3 A flowchart of a task allocation method provided in the third embodiment of the present disclosure.

[0056] like Figure 3 As shown, the task allocation method may include the following steps:

[0057] Step 301: Obtain the task type of the task to be assigned, and obtain the first candidate task channel matching the task type.

[0058] Step 302: Obtain the historical task channel corresponding to the target historical task that has been allocated within the set historical period.

[0059] Step 303: Acquire second candidate task channels other than the historical task channels in the first candidate task channels.

[0060] Step 304 : In response to the channel weight of any second candidate task channel being greater than or equal to a set weight threshold, a target task channel is selected from the second candidate task channels based on the channel weights of the second candidate task channels.

[0061] It should be understood that if the channel weight of the second candidate task channel is greater than or equal to the set weight threshold, it means that the service node corresponding to the second candidate task channel has a light load and the node performance meets the set requirements.

[0062] Therefore, in order to improve the task execution efficiency and make full use of service node resources, as an example, when the channel weight of any second candidate task channel is greater than or equal to the set weight threshold, the maximum weight among the channel weights of each second candidate task channel is obtained, and the second candidate task channel corresponding to the maximum weight is used as the target task channel.

[0063] Step 305 , in response to the channel weights of the second candidate task channels being less than the set weight threshold, a third candidate task channel matching the task type of the task to be assigned is obtained, and the priority of the third candidate task channel is lower than that of the first candidate task channel.

[0064] When the channel weight of the second candidate task channel is less than the set weight threshold, it means that the service node corresponding to the second candidate task channel is heavily loaded and the node performance does not meet the set requirements. Therefore, in order to improve the efficiency of task execution and achieve load balancing, as a possible implementation method, when the channel weights of each second candidate task channel are less than the set weight threshold, a third candidate task channel matching the task type of the task to be assigned is obtained based on the priority; wherein the priority corresponding to the task channel in the distributed system is pre-set, and the priority is used to indicate the degree of matching between the task channel and the task type of the task to be assigned.

[0065] As an example, resource configuration information of a first service node corresponding to a first candidate task channel is obtained; based on the resource configuration information, a third service node similar to the first service node is selected from second service nodes corresponding to other task channels, where other task channels refer to task channels other than the first candidate task channel in task channels matching each reference task type; a third candidate task channel matching the third service node is determined from other task channels; it should be noted that the more similar the resource configurations of the service nodes are, the closer the efficiency of the service nodes in executing the tasks to be assigned is, and in order to improve the execution efficiency of the tasks to be assigned, when selecting the third service node based on the resource configuration information, the similarity between the resource configuration information of the first service node and the resource configuration information of the second service node is obtained, and the second service node whose similarity is greater than the set similarity threshold is used as the third service node.

[0066] Among them, resource configuration information refers to the configuration information of network resources, memory resources, computing resources and other resources; reference task types are multiple task types obtained after pre-classification of tasks, each task type has a matching task channel, and the task channels matching each task type form the task channels in the distributed system. Other task channels refer to the task channels in the distributed system except the first candidate task channel.

[0067] Step 306 : Select a target task channel from the third candidate task channels based on the channel weights of the third candidate task channels.

[0068] In order to improve task execution efficiency and make full use of service node resources, as an example, the maximum weight among the channel weights of each third candidate task channel is obtained, and the third candidate task channel corresponding to the maximum weight is used as the target task channel.

[0069] Step 307: Allocate the task to be allocated to the target task channel, so that the target service node corresponding to the target task channel executes the task to be allocated.

[0070] It should be noted that the execution process of step 301 to step 303 and step 307 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0071] In summary, in response to the channel weight of any second candidate task channel being greater than or equal to the set weight threshold, the target task channel is selected from each second candidate task channel based on the channel weight of the second candidate task channel; in response to the channel weight of each second candidate task channel being less than the set weight threshold, a third candidate task channel matching the task type of the task to be assigned is obtained, and the target task channel is selected from the third candidate task channel based on the channel weight of the third candidate task channel. Thus, when the load of the service node corresponding to the second candidate task channel is heavy, the target task channel is selected from the third candidate task channel matching the task type of the task to be assigned, which effectively shortens the waiting time for the task to be assigned to be executed and improves the efficiency of task execution.

[0072] In order to clearly explain how to obtain the task type of the task to be assigned in the above embodiment, the present disclosure proposes another task assignment method.

[0073] Figure 4 A flowchart of a task allocation method provided in the fourth embodiment of the present disclosure.

[0074] like Figure 4 As shown, the task allocation method may include the following steps:

[0075] Step 401, obtaining the target execution script of the task to be assigned.

[0076] In the embodiment of the present disclosure, the execution script of the task to be assigned is an automated script used to execute a series of operations after the task is assigned.

[0077] As an example, the target execution script of the task to be assigned is queried from the execution script library.

[0078] Step 402: Execute a script based on the target of the task to be assigned to determine the task type to be assigned.

[0079] In order to reduce the need for manual intervention and improve the level of automation, as an example, the functional functions in the target execution script are parsed to obtain the task type of the task to be assigned.

[0080] Step 403: Acquire a first candidate task channel that matches the task type.

[0081] Step 404: determine the target task channel based on the channel weights of the first candidate task channels.

[0082] Step 405: Allocate the task to be allocated to the target task channel, so that the target service node corresponding to the target task channel executes the task to be allocated.

[0083] It should be noted that the execution process of step 403 to step 405 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0084] In summary, obtaining the target execution script of the task to be assigned and determining the task type of the task to be assigned based on the target execution script of the task to be assigned can greatly reduce the need for manual intervention, thereby improving the level of automation.

[0085] In order to clearly explain how to execute the script based on the target of the task to be assigned and determine the task type of the task to be assigned in the above embodiment, the present disclosure proposes another task assignment method.

[0086] Figure 5 A flowchart of a task allocation method provided in the fifth embodiment of the present disclosure.

[0087] like Figure 5 As shown, the task allocation method may include the following steps:

[0088] Step 501, obtaining the target execution script of the task to be assigned.

[0089] Step 502: Determine whether the target execution script contains comment content.

[0090] As an example, after obtaining the target execution script, it is detected whether the target execution script contains comment symbols; if the target execution script contains comment symbols, it is determined that the target execution script contains comment content; if the target execution script does not contain comment symbols, it is determined that the target execution script does not contain comment content.

[0091] Step 503: In response to the target execution script containing annotation content, extract the annotation content in the target execution script.

[0092] As an example, when the target execution script includes comment content, the comment content in the target execution script is extracted based on the comment symbol.

[0093] Step 504: semantically parse the annotation content to obtain the task type of the task to be assigned.

[0094] In order to improve the efficiency and accuracy of determining the task type, as an example, a large model is called to perform semantic analysis on the annotation content to obtain the task type of the task to be assigned.

[0095] It should be noted that the large model has a faster response speed and can complete the parsing of annotation content and the judgment of task type in a short time; in addition, the large model has a strong context understanding ability and takes into account the contextual relationship in the annotation when performing semantic analysis, thereby achieving more accurate judgment of task type.

[0096] Step 505 , in response to the target execution script not containing annotation content, obtain a reference execution script cluster matching each reference task type; wherein the reference execution script cluster is obtained by clustering the reference execution scripts of the reference tasks under each reference task type.

[0097] In order to improve the recognition accuracy of task types, as an example, after obtaining the reference task, the reference execution scripts of the reference task are clustered using a clustering algorithm based on the reference task type to obtain a reference execution script cluster.

[0098] Among them, the reference task refers to the task under each reference task type, such as the historical task under each reference task type or the unassigned task under each reference task type; there is a matching relationship between the reference execution script cluster and the reference task type, each reference execution script cluster has a matching reference task type, and the clustering algorithm can refer to a hierarchical clustering algorithm.

[0099] Step 506 : for any reference execution script in the reference execution script cluster, determine the similarity between any reference execution script and the target execution script.

[0100] In order to accurately determine the reference execution script cluster to which the target execution script belongs, so as to accurately identify the task type of the task to be assigned, the similarity between the target execution script and the reference execution scripts in each reference execution script cluster is first determined. As an example, a reference execution script is selected from each reference execution script cluster; the similarity between the target execution script and each selected reference execution script is determined.

[0101] In order to accurately determine the target execution script cluster to which the target execution script belongs, as an example, a reference execution script is selected near the center point of each reference execution script cluster.

[0102] Step 507: Based on the similarity, determine the target execution script cluster to which the target execution script belongs from the reference execution script cluster.

[0103] As an example, a reference execution script that is most similar to the target execution script is determined based on the similarity, and a reference execution script cluster in which the reference execution script that is most similar to the target execution script is located is used as the target execution script cluster.

[0104] Step 508: Use the reference task type that matches the target execution script cluster as the task type of the task to be assigned.

[0105] As an example, based on the matching relationship between the reference execution script cluster and the reference task type, a reference task type matching the target execution script cluster is determined, and the determined reference task type is the task type of the task to be assigned.

[0106] Step 509: Acquire a first candidate task channel that matches the task type.

[0107] Step 5010: Determine a target task channel based on the channel weights of the first candidate task channels.

[0108] Step 5011, assigning the task to be assigned to the target task channel, so that the target service node corresponding to the target task channel executes the task to be assigned.

[0109] It should be noted that the execution process of step 501 and step 509 to step 5011 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0110] In summary, it is determined whether the target execution script contains annotation content; in response to the target execution script containing annotation content, the annotation content in the target execution script is extracted; the annotation content is semantically parsed to obtain the task type of the task to be assigned; in response to the target execution script not containing annotation content, a reference execution script cluster matching each reference task type is obtained; for any reference execution script in the reference execution script cluster, the similarity between any reference execution script and the target execution script is determined; based on the similarity, the target execution script cluster to which the target execution script belongs is determined from the reference execution script cluster; the reference task type matching the target execution script cluster is used as the task type of the task to be assigned. Therefore, in the case where the target execution script contains annotation content, the efficiency and accuracy of determining the task type of the task to be assigned based on the annotation content are high; in the case where the target execution script does not contain annotation content, the task type of the task to be assigned is determined based on the similarity between the target execution script and the reference execution scripts in each reference execution script cluster, thereby avoiding the situation where the task type of the task to be assigned cannot be confirmed due to the absence of annotation content in the target execution script, so as to ensure the correct execution of subsequent steps.

[0111] In order to clearly explain how the channel weight of the target task channel is updated in the above embodiment, the present disclosure proposes another task allocation method.

[0112] Figure 6 A flowchart of a task allocation method provided in the sixth embodiment of the present disclosure.

[0113] like Figure 6 As shown, the task allocation method may include the following steps:

[0114] Step 601: Obtain the task type of the task to be assigned, and obtain the first candidate task channel matching the task type.

[0115] Step 602: Determine a target task channel based on the channel weights of the first candidate task channels.

[0116] Step 603: Allocate the task to be allocated to the target task channel, so that the target service node corresponding to the target task channel executes the task to be allocated.

[0117] Step 604: Obtain a first performance score of the target service node before executing the task to be assigned, and a second performance score of the target service node after executing the task to be assigned.

[0118] In the disclosed embodiment, the target service node has multiple performance indicators, including central processing unit (CPU) utilization, memory utilization, disk IO utilization, network bandwidth utilization, etc.

[0119] It should be noted that the target service node includes at least one CPU unit, at least one memory unit, at least one disk IO unit and at least one network bandwidth unit. In the case where the target service node includes multiple CPU units, multiple memory units, multiple disk IO units and multiple network bandwidth units, the CPU usage of the target service node is determined based on the CPU usage of multiple CPU units, the memory usage of the target service node is determined based on the memory usage of multiple memory units, the disk IO usage of the target service node is determined based on the disk IO usage of multiple disk IO units, and the network bandwidth usage of the target service node is determined based on the network bandwidth usage of multiple network bandwidth units. Taking the CPU unit as an example, the average CPU usage is determined based on the CPU usage of multiple CPU units, and the average CPU usage is used as the CPU usage of the target service node.

[0120] In order to accurately determine the performance difference of the target service node before and after executing the task to be assigned, as an example, before the target service node executes the task to be assigned, the index value of each performance indicator is obtained, and based on the index value of each performance indicator, a first performance score is determined; and after the target service node executes the task to be assigned, the index value of each performance indicator is obtained, and based on the index value of each performance indicator, a second performance score is determined; wherein the first performance score and the second performance score are used to indicate the comprehensive performance of the target service node.

[0121] Step 605 , determining a performance score difference according to the first performance score and the second performance score, and updating the channel weight of the target task channel based on the performance score difference.

[0122] As an example, the channel weight of the target task channel is updated by the following formula:

[0123] W′=W×(α×(U2–U1)+1)

[0124] Among them, W represents the channel weight of the target task channel, W′ represents the channel weight after the channel weight of the target task channel is updated, α represents the learning rate factor, which is used to indicate the update step size of the channel weight, U1 represents the first performance score, and U2 represents the second performance score.

[0125] Step 606: Obtain the task scale of the task to be assigned, and predict the resource occupation of the task to be assigned based on the task type and task scale of the task to be assigned.

[0126] It is important to understand that the task size reflects the time required to perform the assigned task. The larger the task size of the assigned task, the more time it will take.

[0127] In order to reasonably update the channel weight of the target task channel to improve resource utilization, as an example, the task scale pre-marked by the user for the task to be assigned is obtained, or, as another example, the task scale of the task to be assigned is determined based on the amount of data to be processed by the task to be assigned.

[0128] Among them, there is a set matching relationship between the task type, task scale and the resource occupation of each type of resource. After obtaining the task type and task scale of the task to be assigned, the resource occupation of each type of resource of the task to be assigned is predicted according to the set matching relationship.

[0129] Step 607: determine the channel weight change based on the resource occupancy, and update the channel weight of the target task channel according to the channel weight change.

[0130] In order to quantify the impact of resource occupancy on channel weight and to reasonably adjust the channel weight of the target task channel, as an example, the resource occupancy of each type of resource of the task to be assigned is substituted into the set mapping function to obtain the change in channel weight.

[0131] Furthermore, the channel weight of the target task channel is subtracted from the channel weight change to obtain the updated channel weight of the target task channel.

[0132] It should be noted that the execution process of step 601 to step 603 can be implemented in any way in the embodiments of the present disclosure, and the embodiments of the present disclosure do not limit this and will not be described in detail.

[0133] In summary, the first performance score of the target service node before executing the task to be assigned and the second performance score after executing the task to be assigned are obtained; the performance score difference is determined based on the first performance score and the second performance score, and the channel weight of the target task channel is updated based on the performance score difference; the task scale of the task to be assigned is obtained, and the resource occupancy of the task to be assigned is predicted based on the task type and task scale of the task to be assigned; the channel weight change is determined based on the resource occupancy, and the channel weight of the target task channel is updated based on the channel weight change. Therefore, by using any of the two updating methods to update the channel weight of the target task channel, dynamic adjustment of the channel weight can be achieved, so that the channel weight accurately reflects the performance and available resources of the service node.

[0134] In order to implement the above embodiment, the embodiment of the present disclosure also proposes a task allocation device.

[0135] Figure 7 A structural diagram of a task allocation device provided in the seventh embodiment of the present disclosure.

[0136] like Figure 7 As shown, the task allocation device 700 includes: an acquisition module 701 , a determination module 702 and an allocation module 703 .

[0137] Among them, the acquisition module 701 is used to obtain the task type of the task to be assigned, and obtain the first candidate task channel matching the task type; the determination module 702 is used to determine the target task channel based on the channel weight of each first candidate task channel; the allocation module 703 is used to allocate the task to be assigned to the target task channel, so that the target service node corresponding to the target task channel executes the task to be assigned.

[0138] As a possible implementation method of the present disclosure, a determination module 702 is used to obtain a historical task channel corresponding to a target historical task that has been assigned within a set historical period; wherein the task type of the target historical task is the same as the task type of the task to be assigned; obtain a second candidate task channel other than the historical task channel in the first candidate task channel; and determine the target task channel based on the channel weights of each second candidate task channel.

[0139] As a possible implementation of the present disclosure, determination module 702 is used to select a target task channel from each second candidate task channel based on the channel weight of the second candidate task channel in response to the channel weight of any second candidate task channel being greater than or equal to a set weight threshold; in response to the channel weights of each second candidate task channel being less than the set weight threshold, obtain a third candidate task channel that matches the task type of the task to be assigned, the priority of the third candidate task channel being lower than the first candidate task channel; and select the target task channel from the third candidate task channel based on the channel weight of the third candidate task channel.

[0140] As a possible implementation of the present disclosure, a determination module 702 is used to obtain resource configuration information of a first service node corresponding to a first candidate task channel; based on the resource configuration information, a third service node similar to the first service node is selected from second service nodes corresponding to other task channels; wherein other task channels refer to task channels other than the first candidate task channel among task channels matching each reference task type; and a third candidate task channel matching the third service node is determined from other task channels.

[0141] As a possible implementation of the present disclosure, the acquisition module 701 is used to acquire a target execution script of the task to be assigned; and determine the task type of the task to be assigned based on the target execution script of the task to be assigned.

[0142] As a possible implementation of the present disclosure, an acquisition module 701 is used to determine whether the target execution script contains comment content; in response to the target execution script containing comment content, extract the comment content in the target execution script; and perform semantic analysis on the comment content to obtain the task type of the task to be assigned.

[0143] As a possible implementation of the present disclosure, an acquisition module 701 is used to obtain a reference execution script cluster matching each reference task type in response to the target execution script not containing annotation content; wherein the reference execution script cluster is obtained by clustering the reference execution scripts of the reference tasks under each reference task type; for any reference execution script in the reference execution script cluster, determine the similarity between any reference execution script and the target execution script; based on the similarity, determine the target execution script cluster to which the target execution script belongs from the reference execution script cluster; and use the reference task type matching the target execution script cluster as the task type of the task to be assigned.

[0144] As a possible implementation of the present disclosure, the device also includes: a score acquisition module, used to obtain a first performance score of the target service node before executing the task to be assigned, and a second performance score after executing the task to be assigned; a difference determination module, used to determine the performance score difference based on the first performance score and the second performance score; a weight update module, used to update the channel weight of the target task channel based on the performance score difference.

[0145] As a possible implementation of the present disclosure, the device also includes: a scale acquisition module, used to acquire the task scale of the task to be assigned; a prediction module, used to predict the resource occupancy of the task to be assigned based on the task type and task scale of the task to be assigned; a change determination module, used to determine the channel weight change based on the resource occupancy; and a weight update module, used to update the channel weight of the target task channel according to the channel weight change.

[0146] It should be noted that the above explanations of the embodiment of the task allocation method are also applicable to the task allocation device of this embodiment, and will not be repeated here.

[0147] Figure 8 A schematic diagram of the structure of an electronic device provided for the eighth embodiment of the present disclosure. Among them, the electronic device 800 in this embodiment is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0148] like Figure 8 As shown, the electronic device 800 includes:

[0149] The memory 801 and the processor 802, a bus 803 connecting different components (including the memory 801 and the processor 802), the memory 801 stores a computer program, and when the processor 802 executes the program, the task allocation method of the embodiment of the present disclosure is implemented.

[0150] Bus 803 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus structures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus and Peripheral Component Interconnect (PCI) bus.

[0151] The electronic device 800 typically includes a variety of electronic device readable media. These media can be any available media that can be accessed by the electronic device 800, including volatile and non-volatile media, removable and non-removable media.

[0152] The memory 801 may also include computer system readable media in the form of volatile memory, such as random access memory (RAM) 804 and / or cache memory 805. The electronic device 800 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 806 may be used to read and write non-removable, non-volatile magnetic media ( Figure 8 not shown, usually called a "hard drive"). Although Figure 8 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 803 via one or more data medium interfaces. The memory 801 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present disclosure.

[0153] A program / utility 808 having a set (at least one) of program modules 807 may be stored, for example, in the memory 801, such program modules 807 including but not limited to an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 807 generally perform the functions and / or methods of the embodiments described in the present disclosure.

[0154] The electronic device 800 may also communicate with one or more external devices 809 (e.g., keyboard, pointing device, display 811, etc.), one or more devices that enable a user to interact with the electronic device 800, and / or any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through an input / output (I / O) interface 812. Furthermore, the electronic device 800 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through a network adapter 813. Figure 8 As shown, the network adapter 813 communicates with other modules of the electronic device 800 via the bus 803. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0155] The processor 802 executes various functional applications and data processing by running the programs stored in the memory 801 .

[0156] It should be noted that the implementation process and technical principles of the electronic device of this embodiment refer to the aforementioned explanation of the task allocation method of the embodiment of the present disclosure, and will not be repeated here.

[0157] In order to implement the above embodiments, the present disclosure also provides a computer-readable storage medium, in which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the method provided in the above embodiments is implemented. The computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0158] In order to implement the above embodiments, the present disclosure also proposes a computer program product, including a computer program, which implements the methods provided by the above embodiments when executed by a processor.

[0159] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0160] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A task allocation method, characterized in that: The following steps are involved: Obtaining a task type of a task to be assigned, and obtaining a first candidate task channel matching the task type; Determining a target task channel based on the channel weights of each of the first candidate task channels; The task to be assigned is assigned to the target task channel, so that the target service node corresponding to the target task channel executes the task to be assigned.

2. The method according to claim 1, characterized in that The determining of the target task channel based on the channel weights of the first candidate task channels includes: Obtaining a historical task channel corresponding to a target historical task that has been assigned within a set historical period; wherein the task type of the target historical task is the same as the task type of the task to be assigned; Acquire a second candidate task channel other than the historical task channel from the first candidate task channel; The target task channel is determined based on the channel weights of the second candidate task channels.

3. The method according to claim 2, characterized in that The determining the target task channel based on the channel weights of each of the second candidate task channels includes: In response to a channel weight of any of the second candidate task channels being greater than or equal to a set weight threshold, selecting the target task channel from each of the second candidate task channels based on the channel weight of the second candidate task channel; In response to the channel weights of the second candidate task channels being less than the set weight threshold, obtaining a third candidate task channel that matches the task type of the task to be assigned, wherein the priority of the third candidate task channel is lower than that of the first candidate task channel; The target task channel is selected from the third candidate task channels based on the channel weights of the third candidate task channels.

4. The method according to claim 3, characterized in that The obtaining of a third candidate task channel that matches the task type of the task to be assigned includes: Obtaining resource configuration information of a first service node corresponding to the first candidate task channel; Based on the resource configuration information, a third service node similar to the first service node is selected from second service nodes corresponding to other task channels; wherein the other task channels refer to task channels other than the first candidate task channel among the task channels matching each reference task type; A third candidate task channel matching the third service node is determined from the other task channels.

5. The method according to claim 1, characterized in that The task type of the task to be assigned is obtained, including: Obtaining a target execution script for the task to be assigned; A script is executed based on the target of the task to be assigned to determine the task type of the task to be assigned.

6. The method according to claim 5, characterized in that The step of executing a script based on the target of the task to be assigned to determine the task type of the task to be assigned includes: Determining whether the target execution script contains comment content; In response to the target execution script containing annotation content, extracting the annotation content in the target execution script; The annotation content is semantically parsed to obtain the task type of the task to be assigned.

7. The method according to claim 6, characterized in that After determining whether the target execution script contains annotation content, the method further includes: In response to the target execution script not containing annotation content, obtaining a reference execution script cluster matching each reference task type; wherein the reference execution script cluster is obtained by clustering the reference execution scripts of the reference tasks under each reference task type; For any reference execution script in the reference execution script cluster, determine the similarity between the any reference execution script and the target execution script; Based on the similarity, determining a target execution script cluster to which the target execution script belongs from the reference execution script cluster; The reference task type that matches the target execution script cluster is used as the task type of the task to be assigned.

8. The method according to any one of claims 1 to 7, characterized in that: After allocating the to-be-allocated task to the target task channel, the method further includes: Obtaining a first performance score of the target service node before executing the task to be assigned, and a second performance score of the target service node after executing the task to be assigned; determining a performance score difference based on the first performance score and the second performance score; Based on the performance score difference, the channel weight of the target task channel is updated.

9. The method according to any one of claims 1 to 7, characterized in that: After allocating the to-be-allocated task to the target task channel, the method further includes: Obtaining the task scale of the task to be assigned; Predicting the resource usage of the task to be assigned based on the task type and the task scale of the task to be assigned; Based on the resource occupancy, determining a channel weight change amount; The channel weight of the target task channel is updated according to the channel weight change.

10. A task allocation device, characterized in that: include: An acquisition module, used to acquire a task type of a task to be assigned, and acquire a first candidate task channel matching the task type; A determination module, configured to determine a target task channel based on the channel weights of each of the first candidate task channels; The allocation module is used to allocate the task to be allocated to the target task channel so that the target service node corresponding to the target task channel executes the task to be allocated.

Citation Information

Patent Citations

  • Processing method and device of code files

    CN107305527A

  • Task distribution method and device, storage medium and server

    CN109784646A

  • Load balancing method, system and device

    CN111581033A

  • Resource information recommendation method and system, electronic equipment and storage medium

    CN117332142A

  • Task distribution method and device, electronic equipment and storage medium

    CN117742948A

Cited By

  • Computing task allocation method and system, electronic equipment, medium and product

    CN119292793A