Task allocation method and device, medium, equipment and product
By migrating node tasks in computing power nodes in automotive wireless communication technology, the problem of waste of computing power resources is solved, resource utilization is improved and task processing is ensured.
Patent Information
- Application Number
- CN202411487713.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-14
Smart Images

Figure CN119440819A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to a task allocation method, apparatus, medium, equipment and product. Background Art
[0002] Vehicle to x (V2X) is a general term for vehicle to vehicle (V2V), vehicle to infrastructure (V2I), and vehicle to pedestrian (V2P). The computing nodes that can be used in the Internet of Vehicles scenario include: central cloud, edge cloud, roadside equipment, vehicle-mounted computing power, etc.
[0003] However, each type of task sent by the vehicle is usually processed on a different computing node. If some computing nodes have idle resources but the idle resources are not enough to process new tasks, it may lead to a waste of computing resources. Summary of the invention
[0004] The present application provides a task allocation method, apparatus, medium, equipment and product for improving the utilization of computing resources.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions:
[0006] In a first aspect, a task allocation method is provided, which includes: obtaining tasks to be processed; migrating node tasks in a first computing node to a second computing node when the amount of idle resources of multiple computing nodes is less than the amount of required resources for the tasks to be processed; the amount of idle resources of the first computing node after migrating the node tasks is less than the amount of required resources for the tasks to be processed; the amount of idle resources of the second computing node is greater than or equal to the amount of required resources for the node tasks; the first computing node and the second computing node are different computing nodes among multiple computing nodes; and allocating the tasks to be processed to the first computing node after migrating the node tasks.
[0007] Optionally, the task to be processed is a processing task sent by the vehicle, and the method also includes: when the amount of idle resources of multiple computing nodes is greater than or equal to the amount of required resources of the task to be processed, allocating the task to be processed to a third computing node; the third computing node is a computing node among the multiple computing nodes whose distance from the vehicle is less than a distance threshold.
[0008] Optionally, the method also includes: when the amount of idle resources of multiple computing power nodes is greater than or equal to the amount of required resources of the task to be processed, determining multiple pre-selected computing power nodes from the multiple computing power nodes; the resource utilization rate of the multiple pre-selected computing power nodes is less than or equal to the utilization rate threshold; allocating the task to be processed to the fourth computing power node; the fourth computing power node is a computing power node among the multiple pre-selected computing power nodes whose distance from the vehicle is less than the distance threshold.
[0009] Optionally, the method also includes: when the amount of idle resources of multiple computing nodes is less than the amount of required resources for the task to be processed and there is no second computing node, adding the task to be processed to a waiting queue, and the waiting queue is used to store the task to be processed.
[0010] Optionally, when there are multiple node tasks to be migrated, the method also includes: allocating different node tasks to different computing nodes in the computing node combination; the amount of idle resources of different computing nodes in the computing node combination is greater than or equal to the required amount of resources of the allocated node tasks.
[0011] Optionally, the method further includes: obtaining a task type of the task to be processed; determining the required resource amount corresponding to the task type according to a preset mapping relationship; the preset mapping relationship includes a correspondence between different task types and different required resource amounts.
[0012] Based on the technical solution provided by the present application, after obtaining the task to be processed, when the idle resources of multiple computing nodes are less than the required resources of the task to be processed, the node tasks in the first computing node are migrated, and the task to be processed is allocated to the first computing node after the node task is migrated. Since the idle resources of the first computing node after the node task is migrated are less than the required resources of the task to be processed, and the idle resources of the second computing node are greater than or equal to the required resources of the node task. In this way, two computing nodes that cannot meet the required resources of the task to be processed can be made to meet the required resources of the task to be processed by readjusting the node tasks in the computing nodes, thereby improving the resource utilization of the computing nodes.
[0013] In a second aspect, a task allocation device is provided, which includes: an acquisition unit and a processing unit; the acquisition unit is used to acquire the task to be processed; the processing unit is used to migrate the node task in the first computing power node to the second computing power node when the idle resource amount of multiple computing power nodes is less than the required resource amount of the task to be processed; the idle resource amount of the first computing power node after migrating the node task is less than the required resource amount of the task to be processed; the idle resource amount of the second computing power node is greater than or equal to the required resource amount of the node task; the first computing power node and the second computing power node are different computing power nodes among the multiple computing power nodes; the processing unit is used to allocate the task to be processed to the first computing power node after migrating the task.
[0014] Optionally, when there are multiple node tasks to be migrated, the processing unit is also used to assign different node tasks to different computing nodes in the computing node combination; the amount of idle resources of different computing nodes in the computing node combination is greater than or equal to the required amount of resources of the assigned node tasks.
[0015] Optionally, the task to be processed is a processing task sent by the vehicle, and the processing unit is also used to allocate the task to be processed to a third computing node when the amount of idle resources of multiple computing nodes is greater than or equal to the amount of required resources of the task to be processed; the third computing node is a computing node among the multiple computing nodes whose distance from the vehicle is less than a distance threshold.
[0016] Optionally, the processing unit is also used to determine multiple pre-selected computing power nodes from multiple computing power nodes when the amount of idle resources of the multiple computing power nodes is greater than or equal to the amount of required resources of the task to be processed; the resource utilization rate of the multiple pre-selected computing power nodes is less than or equal to the utilization rate threshold; the processing unit is also used to allocate the task to be processed to the fourth computing power node; the fourth computing power node is a computing power node among the multiple pre-selected computing power nodes whose distance from the vehicle is less than the distance threshold.
[0017] Optionally, the processing unit is also used to add the task to be processed to a waiting queue when the amount of idle resources of multiple computing nodes is less than the amount of required resources of the task to be processed and the second computing node does not exist. The waiting queue is used to store the task to be processed.
[0018] Optionally, the acquisition unit is further used to obtain the task type of the task to be processed; the processing unit is further used to determine the required resource amount corresponding to the task type according to a preset mapping relationship; the preset mapping relationship includes the correspondence between different task types and different required resource amounts.
[0019] In a third aspect, a task allocation device is provided, which can implement the functions performed by the task allocation device in the above-mentioned aspects or possible designs. The functions can be implemented through hardware, such as: in one possible design, the task allocation device may include: a processor and a communication interface, and the processor can be used to support the task allocation device to implement the functions involved in the above-mentioned first aspect or any possible design of the first aspect.
[0020] In another possible design, the task allocation device may further include a memory, the memory being used to store the necessary computer execution instructions and data for the task allocation device. When the task allocation device is running, the processor executes the computer execution instructions stored in the memory so that the task allocation device performs the above-mentioned first aspect or any possible task allocation method of the first aspect.
[0021] In a fourth aspect, a computer-readable storage medium is provided, which may be a readable non-volatile storage medium, and which stores computer instructions or programs. When the computer-readable storage medium is run on a computer, the computer can execute the first aspect or any possible task allocation method of the above aspects.
[0022] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the task allocation method of the first aspect or any possible design of the above aspects.
[0023] In a sixth aspect, an electronic device is provided, the electronic device comprising one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the task allocation method as described in the first aspect or any possible design of the first aspect.
[0024] In a seventh aspect, a chip system is provided, the chip system including a processor and a communication interface, the chip system can be used to implement the functions performed by the task allocation device in the first aspect or any possible design of the first aspect. In one possible design, the chip system also includes a memory, the memory is used to store program instructions and / or data. The chip system can be composed of a chip, or it can include a chip and other discrete devices, without limitation. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 A schematic diagram of the structure of a task allocation system provided in an embodiment of the present application;
[0026] Figure 2 A schematic diagram of the structure of a task allocation device provided in an embodiment of the present application;
[0027] Figure 3 A flowchart of a task allocation method provided in an embodiment of the present application;
[0028] Figure 4 A flowchart of another task allocation method provided in an embodiment of the present application;
[0029] Figure 5 A flowchart of another task allocation method provided in an embodiment of the present application;
[0030] Figure 6 A schematic diagram of the structure of another task allocation device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] 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 application will be clearly and completely described below in conjunction with the accompanying drawings.
[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 interchangeable 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 embodiments of the present application as detailed in the attached claims.
[0033] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.
[0034] Vehicle wireless communication technology is a general term for vehicle-to-vehicle communication, vehicle-to-infrastructure communication, and vehicle-to-pedestrian communication. The computing nodes that can be applied in the Internet of Vehicles scenario include: central cloud, edge cloud, roadside equipment, vehicle-mounted computing power, etc.
[0035] However, each type of task sent by the vehicle is usually processed on a different computing node. If some computing nodes have idle resources but the idle resources are not enough to process new tasks, it may lead to a waste of computing resources.
[0036] In one example, for each different type of task, due to the different characteristics of the task, the time when the traffic tide occurs for each task is different. For example, task A is at the peak of the traffic wave, and task B is at the trough of the traffic wave. When the number of business requests of A increases, the processing capacity will be lower than the number of requests, and the requests will be queued. At this time, the processing capacity of task B is higher than the number of requests, and the resources are idle. In this case, the idle resources cannot be provided to task A with a shortage of resources, which not only causes a waste of resources, but also affects the business experience.
[0037] In view of this, an embodiment of the present application provides a task allocation method, including: obtaining tasks to be processed; when the amount of idle resources of multiple computing nodes is less than the amount of required resources of the tasks to be processed, migrating node tasks in the first computing node; the amount of idle resources of the first computing node after migrating the node tasks is less than the amount of required resources of the tasks to be processed; the first computing node is any node among the multiple computing nodes; and allocating the tasks to be processed to the first computing node after the tasks are migrated.
[0038] The method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0039] It should be noted that the network system described in the embodiment of the present application is to more clearly illustrate the technical solution of the embodiment of the present application, and does not constitute a limitation on the technical solution provided in the embodiment of the present application. Ordinary technicians in this field can know that with the evolution of network systems and the emergence of other network systems, the technical solution provided in the embodiment of the present application is also applicable to similar technical problems.
[0040] Figure 1 FIG. 1 is a schematic diagram of a task allocation system 10 provided in an embodiment of the present application. Figure 1 As shown, the task assignment system 10 may include a vehicle 11 and a server 12 .
[0041] The vehicle 11 is connected to the server 12. For example, the vehicle 11 and the server 12 may be connected wirelessly, or may be connected wiredly. There is no limitation.
[0042] Among them, the vehicle 11 involved in the embodiment of the present application is used to send a task to be processed to the server 12. For example, the vehicle 11 can be a vehicle in an automatic driving scene, etc. The embodiment of the present application does not limit the specific technology, specific number and specific device form adopted by the vehicle 11.
[0043] Among them, the server 12 involved in the embodiment of the present application is used to determine the computing power node that processes the task to be assigned after receiving the task to be processed of the vehicle. For example, the task assignment device 12 can also be a server, a computer, etc. Among them, the server can be a single server, or it can be a server cluster composed of multiple servers. In some implementations, the server cluster can also be a distributed cluster. The embodiment of the present application does not limit the specific technology, specific number and specific device form of the task assignment device 12. The embodiment of the present application does not limit the specific technology, specific number and specific device form of the task assignment device 12.
[0044] When implementing it specifically, Figure 1 Each device in the Figure 2 The structure shown, or including Figure 2 Parts shown. Figure 2 The structure diagram of a task allocation device 200 provided in an embodiment of the present application is shown in FIG. 2 . The task allocation device 200 may be a network device, or the task allocation device 200 may be a chip or a system on a chip in a network device. Figure 2As shown, the task allocation device 200 includes a processor 201 , a communication interface 202 and a communication line 203 .
[0045] Furthermore, the task allocation device 200 may also include a memory 204 . The processor 201 , the memory 204 and the communication interface 202 may be connected via a communication line 203 .
[0046] The processor 201 is a CPU, a general processor, a network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller, a programmable logic device (PLD), or any combination thereof. The processor 201 may also be other devices with processing functions, such as circuits, devices, or software modules, without limitation.
[0047] The communication interface 202 is used to communicate with other devices or other communication networks. The communication interface 202 can be a module, a circuit, a communication interface or any device capable of implementing communication.
[0048] The communication line 203 is used to transmit information between the components included in the task allocation device 200.
[0049] The memory 204 is used to store instructions, where the instructions may be computer programs.
[0050] The memory 204 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), magnetic disk storage media or other magnetic storage devices, etc., without limitation.
[0051] It should be noted that the memory 204 can exist independently of the processor 201, or can be integrated with the processor 201. The memory 204 can be used to store instructions or program codes or some data, etc. The memory 204 can be located in the task allocation device 200, or can be located outside the task allocation device 200, without limitation. The processor 201 is used to execute the instructions stored in the memory 204 to implement the task allocation method provided in the following embodiments of the present application.
[0052] In one example, the processor 201 may include one or more CPUs, for example, Figure 2 CPU0 and CPU1 in.
[0053] As an optional implementation, the task allocation device 200 includes multiple processors, for example, Figure 2 In addition to the processor 201, a processor 205 may also be included.
[0054] It should be pointed out that Figure 2 The composition shown in the Figure 1 The limitations of each device in Figure 2 In addition to the parts shown, Figure 1 The individual devices in the Figure 2 More or fewer components, or combinations of certain components, or different arrangements of components.
[0055] In the embodiment of the present application, the chip system may be composed of a chip, or may include a chip and other discrete devices.
[0056] In addition, the actions, terms, etc. involved in the various embodiments of the present application can refer to each other without limitation. The message name or parameter name in the message exchanged between the various devices in the embodiments of the present application is only an example, and other names can also be used in the specific implementation without limitation.
[0057] In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish the same or similar items with substantially the same functions and effects. Those skilled in the art can understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference.
[0058] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0059] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0060] Combine the following Figure 1 The task allocation system shown describes the task allocation method provided in the embodiment of the present application.
[0061] Figure 3 A flowchart of a task allocation method provided in an embodiment of the present application is applied to a server, which can Figure 1 Server 12 in. Figure 3 As shown, the method includes the following S301-S303:
[0062] S301, obtaining tasks to be processed.
[0063] The tasks to be processed are tasks from the vehicle. The types of tasks to be processed may include multiple types, such as image processing tasks, radar signal processing tasks, positioning processing tasks, audio resource acquisition tasks, etc.
[0064] As a possible implementation, the vehicle is equipped with a vehicle networking terminal. The vehicle can send pending tasks to the server through the configured vehicle networking terminal. Correspondingly, the server receives the pending tasks from the vehicle.
[0065] It should be noted that the number of tasks to be processed may be one or more.
[0066] After obtaining the pending tasks, the server may parse the pending tasks to obtain task information of the pending tasks. The task information may include vehicle location information, task priority, and the like.
[0067] Furthermore, the server may determine the required resource amount corresponding to the task type according to a preset mapping relationship.
[0068] The preset mapping relationship includes the corresponding relationship between different task types and different required resource amounts.
[0069] S302: When the amount of idle resources of multiple computing nodes is less than the amount of required resources for the tasks to be processed, the node tasks in the first computing node are migrated to the second computing node.
[0070] The plurality of computing nodes may be a plurality of nodes within the service range controlled by the server. For example, they may include but are not limited to the central cloud, edge cloud, roadside equipment, vehicle-mounted computing power, etc. The amount of idle resources may be the difference between the total amount of resources of the preset proportion of the computing nodes and the amount of resources used. The preset proportion may be set as required. For example, it may be 80%, etc.
[0071] The idle resource amount of the first computing node after the node task is migrated is less than the required resource amount of the task to be processed; the first computing node is any node among the multiple computing nodes. The node tasks in the first computing node may include multiple. The resource may include but is not limited to at least one of the following: CPU resources, memory resources, etc.
[0072] As a possible implementation method, the server can obtain the resource usage of the computing node, and if there is a resource demand of the second computing node, migrate a node task in the first computing node to the second computing node.
[0073] The idle resource amount of the second computing node is greater than or equal to the required resource amount of the node task. The first computing node and the second computing node are different nodes in the computing node.
[0074] In one example, the server can set the set of all computing nodes S = [S 1 ,S 2 ,...S N ], the corresponding relationship Q between the computing power node S and its resource situation is defined as: Q s,r =[{S 1 :[[MEM s1,used ,MEM s1,total ,
[0075] R s1,mem ],[CPU s1,used ,CPU s1,total , R s1,cpu ]]},...,{S m :[[MEM sm,used ,MEM sm,total ,
[0076] R sm,mem ],[CPU sm,used ,CPU sm,total , R sm,cpu ]]}]. The mapping relationship of the remaining resource usage corresponding to the computing power node set S is L s,r =[{S1 :[80%*MEM s1,total -MEM s1,used ,80%*CPU s1,total -CPU s1,used CPU s1,used ]},...,{S m :{[80%*MEM sm,total -CPU sm,used ,80%*CPU sm,total -CPU sm,used ]}]. The mapping relationship between each allocated service and its resource usage H = [{APP 1 :[Mem app1 ,CPU app1 ]},...,{APP m :Mem appm ,CPU appm ]}].
[0077] Among them, MEM s1,used Is the memory value that has been used. MEM s1,total It is the computing power node S 1 The total CPU value, R s1,mem =MEM s1,used / MEM s1,total , indicating memory usage. CPU s1,used It is the CPU value that computing power node S1 has used. CPU s1,total It is the total CPU value on computing power node S1. s1,cpu =CPU s1,used / CPU s1,total , indicating CPU usage. APP 1 Indicates node task 1 in the first computing power node, CPU app1 For APP 1 The CPU value required to provide normal services, Mem app1 For APP 1 The amount of memory required to provide normal services.
[0078] The server can determine the first computing power node and the second computing power node by means of a for loop.
[0079] For example, for APP1 in H, first determine the memory resource required by APP1 (Mem app1 ) and the amount of free memory resources of the computing power node (80%*MEM s1,total -MEM s1,used ), the CPU resource requirement of APP1 (CPU app1 ) and the amount of idle CPU resources (80%*CPUs1,total -CPU s1,used )’s size relationship.
[0080] In the first case, if 80%*MEM s1,total -MEM s1,used Greater than Mem app1 And 80%*CPU s1,total -CPU s1,used Larger than CPU app1 , then APP1 is assumed to be migrated to computing power node S 1 (Do not perform the migration operation yet), and add the computing node originally deployed by APP1 to the set S in the above description 2, and perform all the steps in the above 2. If an available computing node can be selected in all the steps in 2, then migrate APP1 to the computing node S 1 .
[0081] Otherwise, continue to execute the second level for loop and compare APP1 in H with L s,r Medium computing power node S 2 The resource relationship between S 1 same.
[0082] The second case 80%*MEM s1,total -MEM s1,used Less than Mem app1 or 80%*CPU s1,total -CPU s1,used Smaller than CPU app1 , then continue to execute the second level for loop, comparing APP1 in H with L s,r Medium computing power node S 2 The resource relationship of S 1 same.
[0083] In the third case, until APP1 and L s,r After all node resources in are compared, if there is still no suitable computing node, it returns to execute the first layer loop, then APP2 and L s,r Each node resource in is compared in the same way as APP1.
[0084] In one example, the pseudo code corresponding to the for loop may include:
[0085]
[0086] As another possible implementation, the server may obtain the resource usage of the computing nodes, and assign different node tasks to different computing nodes in the computing node combination when there is no resource demand of the second computing node.
[0087] Among them, the amount of idle resources of different computing nodes in the computing node combination is greater than or equal to the required amount of resources of the assigned node tasks.
[0088] In one example, different node tasks may include task 1 and task 2. The computing power node combination may include computing power node 1 and computing power node 2.
[0089] If the required resource amount of task 1 is a, and the required resource amount of task 2 is b, task 1 is migrated to computing node 1, and computing node 1 is migrated to computing node 2. Then the idle resource amount of computing node 1 is greater than or equal to a, and the idle resource amount of computing node 2 is greater than or equal to b.
[0090] In actual applications, the server can use open source tools to obtain the resource usage of computing nodes.
[0091] The open source tool can be set as needed. For example, the open source tool can be Prometheus.
[0092] S303: Allocate tasks to be processed to the first computing power node after the migration node task.
[0093] As a possible implementation method, after determining the first computing power node, the server can send the address information of the first computing power node to the vehicle, and the vehicle can send the to-be-processed task to the first computing power node based on the address information of the first computing power node.
[0094] As another possible implementation, after determining the first computing power node, the server may forward the to-be-processed tasks from the vehicle to the first computing power node.
[0095] It should be noted that the server can send a migration indication message to the first computing power node, and upon receiving a migration reply message, determine that the first computing power node has completed the migration node task.
[0096] The migration indication message is used to indicate the first computing power node to migrate the node task. The migration reply message is used to indicate that the first computing power node has completed the migration node task.
[0097] Based on the technical solution provided by the present application, after obtaining the task to be processed, when the idle resources of multiple computing nodes are less than the required resources of the task to be processed, the node tasks in the first computing node are migrated, and the task to be processed is allocated to the first computing node after the node task is migrated. Since the idle resources of the first computing node after the node task is migrated are less than the required resources of the task to be processed, and the idle resources of the second computing node are greater than or equal to the required resources of the node task. In this way, two computing nodes that cannot meet the required resources of the task to be processed can be made to meet the required resources of the task to be processed by readjusting the node tasks in the computing nodes, thereby improving the resource utilization of the computing nodes.
[0098] In a possible embodiment, when there are multiple node tasks to be migrated, the task allocation method of the present application may further include the following S401.
[0099] S401. Allocate different node tasks to different computing nodes in the computing node combination.
[0100] Among them, the amount of idle resources of different computing nodes in the computing node combination is greater than or equal to the required amount of resources of the assigned node tasks.
[0101] As a possible implementation method, the server can determine the idle resource amount of each computing node and the required resource amount of different node tasks. Further, each node task is allocated to different node tasks in order of size.
[0102] The order of size can be from small to large or from large to small, without limitation.
[0103] It should be noted that, in the process of allocating each node task to different node tasks, the server may allocate each node task to different node tasks based on the principle of maximum resource utilization.
[0104] For example, the principle of maximum resource utilization can be: for each node task, determine the difference between the required resource amount of the node task and the idle resource amount of multiple computing nodes, and determine the computing node with the smallest difference among the multiple computing nodes as the computing node corresponding to the node task.
[0105] In a possible embodiment, when there are multiple node tasks to be migrated, the task allocation method of the present application may further include the following S501.
[0106] S501: when the idle resources of multiple computing nodes are greater than or equal to the required resources of the task to be processed, assign the task to be processed to the third computing node.
[0107] Among them, the third computing power node is a computing power node whose distance from the vehicle is less than the distance threshold among the multiple computing power nodes.
[0108] The distance threshold may be set as required, for example, the distance corresponding to the computing node with the shortest distance from the vehicle among the multiple computing nodes.
[0109] As a possible implementation method, the server can determine whether the amount of idle resources of the computing node closest to the vehicle is greater than or equal to the amount of required resources for the task to be processed. If the amount of idle resources of the computing node closest to the vehicle is greater than or equal to the amount of required resources for the task to be processed, the computing node closest to the vehicle is determined to be the third computing node, and the task to be processed is assigned to the third computing node.
[0110] When the amount of idle resources of the computing power node closest to the vehicle is less than the amount of required resources for the task to be processed, determine whether the amount of idle resources of other computing power nodes except the computing power node closest to the vehicle is greater than the amount of required resources for the task to be processed, and when the amount of idle resources of other computing power nodes is greater than the amount of required resources for the task to be processed, determine the other computing power node closest to the vehicle from other computing power nodes as the third computing power node.
[0111] In a possible embodiment, when there are multiple node tasks to be migrated, the task allocation method of the present application may further include the following S601-S602.
[0112] S601: When the idle resources of multiple computing nodes are greater than or equal to the required resources of the task to be processed, determine multiple pre-selected computing nodes from the multiple computing nodes.
[0113] Among them, the resource utilization rate of multiple pre-selected computing power nodes is less than or equal to the utilization rate threshold.
[0114] The usage rate threshold can be set as needed, for example, 70%.
[0115] As a possible implementation method, the server can determine whether the amount of idle resources of the computing power node closest to the vehicle is greater than or equal to the amount of required resources for the task to be processed. If the amount of idle resources of the computing power node closest to the vehicle is less than the amount of required resources for the task to be processed, multiple pre-selected computing power nodes are determined from multiple other computing power nodes whose amount of idle resources is greater than or equal to the amount of required resources for the task to be processed.
[0116] In one example, the set of all computing nodes S = [S 1 ,S 2 ,...S N ], the mapping relationship between the computing power node and the resource usage on the node is Qs,r =[{S 1 :[[MEM s1,used , MEM s1,total , R s1,mem ],
[0117] [CPU s1,used ,CPU s1,total , R s1,cpu ]]},...,{S m :[[MEM sm,used ,MEM sm,total , R sm,mem ],
[0118] [CPU sm,used ,CPU sm,total , R sm,cpu ]]}], first in the mapping relationship Q s,r From the set, select the pre-selected computing nodes whose CPU and memory usage are less than or equal to 70% (this is a schematic value and can be set according to the priority of the specific task to be processed). Let the set corresponding to the pre-selected computing nodes that meet the requirements be W = [S 1 ,S 5 ,...S N-m ].
[0119] In some embodiments, the server can determine multiple pre-selected computing nodes from multiple computing nodes when the priority of the task to be processed is greater than the priority threshold and the idle resources of the multiple computing nodes are greater than or equal to the required resources of the task to be processed.
[0120] It should be noted that the priority of the task to be processed is positively correlated with the number of concurrent tasks to be processed, and negatively correlated with the value of the maximum delay of the task to be processed.
[0121] It can be understood that by pre-screening multiple pre-selected computing power nodes whose resource utilization is less than or equal to the utilization threshold when the priority of the task to be processed is greater than the priority threshold, and then determining the computing power node to which the task to be processed is assigned from the multiple pre-selected computing power nodes, it is possible to avoid computing power nodes with high resource utilization processing the tasks to be processed, thereby ensuring the processing stability of priority tasks.
[0122] S602. Allocate tasks to be processed to the fourth computing power node.
[0123] Among them, the fourth computing power node is a computing power node whose distance from the vehicle is less than the distance threshold among multiple pre-selected computing power nodes.
[0124] The distance threshold may be set as required, for example, the distance corresponding to the computing power node with the shortest distance from the vehicle among the plurality of pre-selected computing power nodes.
[0125] As a possible implementation method, the server pre-stores the location information of each computing power node. The server can determine the distance between each pre-selected computing power node and the vehicle based on the location information of each pre-selected computing power node and the location information of the vehicle, and then determine the computing power node with the shortest distance from the vehicle among multiple pre-selected computing power nodes, and determine the computing power node as the fourth computing power node, and then assign the task to be processed to the fourth computing power node.
[0126] In one example, according to the mapping relationship R between each service to be allocated and its resource usage recorded in the scheduling platform, where R = [{Se 1 :[CPU se1 ,Mem se1 ]},...,{Se m :[CPU sem ,Mem sem ]}],Se 1 Indicates that it is pending task 1, CPU se1 Se 1 Required CPU value, Mem se1 Se 1 The amount of memory required.
[0127] Assume that the pending tasks Se 1 Allocate to the set W corresponding to the pre-selected computing power nodes, and select the CPU and memory usage rate not higher than 80% in the allocated computing power set W (this is a schematic value and can be determined according to the specific business). The specific method is as follows:
[0128] The mapping relationship between the resource usage of the expected nodes of the pre-allocated W computing power node is updated to Q w,r =[{S 1 :[[MEM s1,used +Mem se1 ,MEM s1,total , R s1,mem ],[CPU s1,used +CPU se1 ,CPU s1,total , R s1,cpu ]]},...,{S N-m :[[MEM sn-m,used +Mem se1 ,MEM sn-m,total ,R mem ],[CPU sn-m,used +CPU se1 ,CP U sn-m,total , R sn-m,cpu ]]}].
[0129] Among them, R sn-m,mem Update to Rmem =MEM sn-m,used +Mem se1 / MEM sn-m,total .
[0130] R sn-m,cpu Update to R cpu =CPU sn-m,used +CPU se1 / CPU sn-m,total .
[0131] From Q w,r Calculate R sn-m,mem <80% and R sn-m,cpu <80% of the computing power node set, after selection, M=[M 1+ ,M 5 ,...M N-m ]. Finally, the computing power node closest to the user is selected in M to ensure that the latency is minimized while meeting the computing power requirements.
[0132] Part that needs to be explained: The CPU and memory usage values of 70% and 80% are related to specific business and are set according to the following principles 1-3. The thresholds can be adjusted flexibly by monitoring the business over a long period of time.
[0133] 1. Business concurrency: A high-concurrency application may require a lower threshold to ensure service stability.
[0134] 2. Whether the business traffic is bursty. For businesses with bursty traffic, it is necessary to set a low threshold in advance based on the peak occurrence time.
[0135] 3. Business type: If it is an online business with latency sensitivity, a low threshold is required. If it is an offline business, a high threshold can be configured.
[0136] In a possible embodiment, when the idle resources of multiple computing nodes are less than the required resources of the tasks to be processed and there is no second computing node, the tasks to be processed are added to the waiting queue.
[0137] The waiting queue is used to store pending tasks. The server can process the pending tasks in the waiting queue in descending order of priority of the pending tasks.
[0138] A possible embodiment, Figure 4 A flowchart of another task allocation method provided in an embodiment of the present application is shown as follows: Figure 4 As shown, the method includes the following S1-S4.
[0139] S1. Get pending tasks.
[0140] The specific content of this step can be referred to the description of S301 above, which will not be repeated here.
[0141] S2. parse the pending tasks and obtain the task types of the pending tasks.
[0142] The specific content of this step can be referred to the description of S301 above, which will not be repeated here.
[0143] S3. Obtain computing power resource information.
[0144] In one example, the server can use preset open source tools to obtain computing resource information of different computing nodes.
[0145] The preset open source tool can be set as needed, for example, Prometheus.
[0146] S4. Execute the scheduling algorithm.
[0147] The specific content of this step can be found in the following Figure 5 The description of some parts will not be repeated here.
[0148] S4. Publish the selected computing nodes and update computing resources.
[0149] Among them, the selected computing power node is assigned to the task to be processed, and updating the computing power resources refers to re-determining the amount of used resources of the selected computing power node.
[0150] A possible embodiment, Figure 5 A flowchart of another task allocation method provided in an embodiment of the present application is shown as follows: Figure 5 As shown, the method includes the following S11-S17.
[0151] S11. Determine the priority of the tasks to be processed.
[0152] As a possible implementation manner, the server may determine the priority having a mapping relationship with the type of the task to be processed according to the priority mapping relationship.
[0153] The priority mapping relationship includes a plurality of task types and priorities corresponding to the plurality of task types.
[0154] S12: When there are multiple tasks to be processed, process the tasks to be processed according to their priorities.
[0155] In one example, when the priorities of multiple pending tasks are different, the server may process the pending tasks in order from the highest priority to the lowest.
[0156] When multiple pending tasks have the same priority, the server may process the pending tasks in sequence according to the order of their reception time.
[0157] S13: Determine whether the idle resource amount of the computing power node closest to the vehicle is greater than or equal to the required resource amount of the task to be processed.
[0158] S14. When the idle resource amount of the computing power node closest to the vehicle is greater than or equal to the required resource amount of the task to be processed, the task to be processed is allocated to the computing power node closest to the vehicle.
[0159] S15. When the idle resource amount of the computing power node closest to the vehicle is less than the required resource amount of the task to be processed, if there are multiple computing power nodes whose idle resource amount is greater than or equal to the required resource amount of the task to be processed, multiple pre-selected computing power nodes are determined from the multiple computing power nodes, and the task to be processed is assigned to the fourth computing power node.
[0160] The specific content of this step can be referred to the subsequent description of S501-S502, which will not be repeated here.
[0161] S16. When the amount of idle resources of multiple computing nodes is less than the amount of required resources for the tasks to be processed, the node tasks in the first computing node are migrated to the second computing node, and the tasks to be processed are allocated to the first computing node after the node tasks are migrated.
[0162] The specific content of this step can be referred to the subsequent description of S601-S602, which will not be repeated here.
[0163] S17: When the idle resources of multiple computing nodes are less than the required resources of the task to be processed and the second computing node does not exist, the task to be processed is added to the waiting queue.
[0164] The embodiment of the present application can divide the task allocation device into functional modules or functional units according to the above method example. For example, each functional module or functional unit can be divided according to each function, or two or more functions can be integrated into one processing module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules or functional units. Among them, the division of modules or units in the embodiment of the present application is schematic, which is only a logical function division. There may be other division methods in actual implementation.
[0165] In the case of dividing each functional module into corresponding functional modules, Figure 6The schematic diagram of the structure of a task allocation device 700 is shown, and the task allocation device may be a server, or a chip or processor used in a server, etc. The task allocation device 700 may be used to perform the functions of the task allocation device involved in the above embodiments. Figure 6 The task allocation device 700 shown may include: an acquisition unit 701 and a processing unit 702; the acquisition unit 701 is used to acquire the task to be processed; the processing unit 702 is used to migrate the node task in the first computing power node to the second computing power node when the idle resource amount of multiple computing power nodes is less than the required resource amount of the task to be processed; the idle resource amount of the first computing power node after migrating the node task is less than the required resource amount of the task to be processed; the idle resource amount of the second computing power node is greater than or equal to the required resource amount of the node task; the first computing power node and the second computing power node are different computing power nodes among the multiple computing power nodes; the processing unit 702 is used to allocate the task to be processed to the first computing power node after migrating the task.
[0166] Optionally, when there are multiple node tasks to be migrated, the processing unit 702 is also used to assign different node tasks to different computing nodes in the computing node combination; the amount of idle resources of different computing nodes in the computing node combination is greater than or equal to the required amount of resources of the assigned node tasks.
[0167] Optionally, the task to be processed is a processing task sent by the vehicle, and the processing unit 702 is also used to allocate the task to be processed to a third computing power node when the amount of idle resources of multiple computing power nodes is greater than or equal to the amount of required resources of the task to be processed; the third computing power node is a computing power node among the multiple computing power nodes whose distance from the vehicle is less than a distance threshold.
[0168] Optionally, processing unit 702 is also used to determine multiple pre-selected computing power nodes from multiple computing power nodes when the amount of idle resources of multiple computing power nodes is greater than or equal to the amount of required resources of the task to be processed; the resource utilization rate of the multiple pre-selected computing power nodes is less than or equal to the utilization rate threshold; processing unit 702 is also used to allocate the task to be processed to a fourth computing power node; the fourth computing power node is a computing power node among the multiple pre-selected computing power nodes whose distance from the vehicle is less than the distance threshold.
[0169] Optionally, the processing unit 702 is also used to add the task to be processed to a waiting queue when the amount of idle resources of multiple computing nodes is less than the amount of required resources of the task to be processed and the second computing node does not exist. The waiting queue is used to store the task to be processed.
[0170] Optionally, the acquisition unit 701 is further used to obtain the task type of the task to be processed; the processing unit 702 is further used to determine the required resource amount corresponding to the task type according to a preset mapping relationship; the preset mapping relationship includes the correspondence between different task types and different required resource amounts.
[0171] The embodiment of the present application also provides a computer-readable storage medium. All or part of the processes in the above method embodiments can be completed by a computer program to instruct the relevant hardware, and the program can be stored in the above computer-readable storage medium. When the program is executed, it can include the processes of the above method embodiments. The computer-readable storage medium can be an internal storage unit of the task allocation device (including the data sending end and / or the data receiving end) of any of the above embodiments, such as a hard disk or memory of the task allocation device. The above computer-readable storage medium can also be an external storage device of the above terminal device, such as a plug-in hard disk equipped on the above terminal device, a smart memory card (smart media card, SMC), a secure digital (secure digital, SD) card, a flash card (flash card), etc. Further, the above computer-readable storage medium can also include both the internal storage unit of the above task allocation device and an external storage device. The above computer-readable storage medium is used to store the above computer program and other programs and data required by the above task allocation device. The above computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0172] It should be noted that the terms "first" and "second" in the specification, claims and drawings of the present application are used to distinguish different objects rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.
[0173] It should be understood that in the present application, "at least one (item)" means one or more, "more than one" means two or more, "at least two (items)" means two or three and more than three, and "and / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0174] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0175] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0176] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0177] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0178] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks or optical disks.
[0179] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto, and any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A task allocation method, characterized in that: The method comprises: Get pending tasks; In the case where the idle resources of multiple computing nodes are less than the required resources of the task to be processed, the node task in the first computing node is migrated to the second computing node; the idle resources of the first computing node after migrating the node task are less than the required resources of the task to be processed; the idle resources of the second computing node are greater than or equal to the required resources of the node task; the first computing node and the second computing node are different computing nodes among the multiple computing nodes; Allocate the to-be-processed task to the first computing power node after migrating the node task.
2. The method according to claim 1, characterized in that The task to be processed is a processing task sent by the vehicle, and the method further includes: When the idle resources of the multiple computing nodes are greater than or equal to the required resources of the task to be processed, the task to be processed is allocated to a third computing node; the third computing node is a computing node among the multiple computing nodes whose distance to the vehicle is less than a distance threshold.
3. The method according to claim 1, characterized in that The method further comprises: In a case where the idle resource amount of the plurality of computing power nodes is greater than or equal to the required resource amount of the task to be processed, a plurality of pre-selected computing power nodes are determined from the plurality of computing power nodes; and the resource utilization rate of the plurality of pre-selected computing power nodes is less than or equal to the utilization rate threshold; Allocate the task to be processed to a fourth computing power node; the fourth computing power node is a computing power node among the multiple pre-selected computing power nodes whose distance from the vehicle is less than a distance threshold.
4. The method according to claim 1, characterized in that: The method further comprises: When the idle resources of the multiple computing nodes are less than the required resources of the task to be processed and there is no second computing node, the task to be processed is added to a waiting queue, which is used to store the task to be processed.
5. The method according to claim 1, characterized in that In the case where there are multiple node tasks to be migrated, the method further includes: Different node tasks are assigned to different computing nodes in the computing node combination; the amount of idle resources of different computing nodes in the computing node combination is greater than or equal to the required amount of resources of the assigned node tasks.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Obtaining the task type of the task to be processed; According to a preset mapping relationship, the required resource amount corresponding to the task type is determined; the preset mapping relationship includes a correspondence between different task types and different required resource amounts.
7. A task allocation device, characterized in that: The device comprises: an acquisition unit and a processing unit; The acquisition unit is used to acquire the tasks to be processed; The processing unit is used to migrate the node task in the first computing node to the second computing node when the idle resource amount of the multiple computing nodes is less than the required resource amount of the task to be processed; the idle resource amount of the first computing node after migrating the node task is less than the required resource amount of the task to be processed; the idle resource amount of the second computing node is greater than or equal to the required resource amount of the node task; the first computing node and the second computing node are different computing nodes among the multiple computing nodes; The processing unit is used to allocate the task to be processed to the first computing power node after migrating the task.
8. A computer-readable storage medium, characterized in that: The readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: include: A processor, a memory and a communication interface; wherein the communication interface is used for the electronic device to communicate with other devices or networks; The memory is used to store one or more programs, which include computer-executable instructions. When the electronic device is running, the processor executes the computer-executable instructions stored in the memory to enable the electronic device to perform the method described in any one of claims 1-6.
10. A computer program product, comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Cited By
Decoding resource allocation method, computer equipment and readable storage medium
CN119645663A