Resource load balancing method and device, electronic equipment and storage medium
By filtering and scheduling virtual machines to the most resource-rich NUMA nodes in the OpenStack platform, the problem of unbalanced virtual machine resource allocation is solved, and resource utilization and system performance are improved.
Patent Information
- Application Number
- CN202411178851.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2024-12-20
AI Technical Summary
In the OpenStack platform, the allocation of NUMA resources of virtual machines is unbalanced, resulting in excessive consumption of resources of some nodes while the resources of other nodes are underutilized.
By obtaining the non-uniform memory access NUMA topology of the virtual machine, filter out the host NUMA node tuples that meet the needs of the virtual machine, calculate the weighted values of each node, arrange them in descending order by weighting values, and schedule the virtual machine to the node with the richest resources. , to achieve load balancing.
It effectively solves the problem of unbalanced NUMA resource allocation, improves resource utilization, and ensures system performance and reliability.
Smart Images

Figure CN119166334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource load balancing method, device, electronic device, and storage medium. Background Art
[0002] OpenStack is an open source cloud computing management platform project, which is composed of several major components to complete specific tasks. In order to meet diverse computing needs, you can create virtual machines or adjust virtual machine specifications on the OpenStack platform. By flexibly managing virtual machines, users can use computing resources more efficiently, reduce costs, and improve application performance and reliability. In the OpenStack platform, the Non-Uniform Memory Access (NUMA) architecture is mainly used to optimize the performance of virtual machines, especially in multi-processor systems. NUMA is to separate the central processing unit resources and group them into nodes. Each node has unique central processing unit, memory and other resources. NUMA's unique perceptual scheduling, topology-aware virtual machine configuration, and node binding enable the OpenStack environment combined with NUMA to use resources more efficiently, improve system performance, flexibility and reliability, and is particularly suitable for scenarios that require high-performance computing and large-scale deployment.
[0003] Based on the OpenStack platform, when creating a virtual machine or adjusting the specifications of a virtual machine, etc., the process of allocating NUMA resources to the virtual machine is involved. When the remaining resources of the first few NUMA NODEs of the host machine (physical machine) on the OpenStack management platform meet the NUMA resource requirements of the virtual machine, the resources requested by the newly created virtual machine or the virtual machine of the migration service will fall on the first few NUMA NODEs of the host machine (physical machine), resulting in unbalanced resource allocation on the host machine's NUMA NODE, excessive consumption of resources on the first few NUMA NODEs, and under-utilization of resources on other NUMA NODEs. Summary of the invention
[0004] The present application provides a resource load balancing method, device, electronic device, and storage medium to solve the technical problem that the existing NUMA resource allocation based on the OpenStack platform is unbalanced, the resources of some nodes are over-consumed, and the resources of other nodes are not fully utilized.
[0005] In a first aspect, the present application provides a resource load balancing method, comprising:
[0006] Obtaining a virtual machine non-uniform memory access NUMA topology structure, wherein the virtual machine NUMA topology structure includes a target node number and required resources;
[0007] Filtering out a plurality of tuples satisfying the NUMA topology of the virtual machine from the NUMA topology of the host machine, wherein the number of nodes of the tuple is the same as the number of target nodes, and the remaining resources of the nodes of the tuple satisfy the required resources;
[0008] Calculate the weighted value of each tuple according to the preset weight calculation rule, where the weighted value is the weight set value of the remaining resources of each node in the tuple;
[0009] Arrange the tuples in descending order according to the weighted values to generate a descending queue, identify the tuple at the head of the descending queue as a resource node of the NUMA topology structure of the virtual machine, and schedule the virtual machine to the resource node.
[0010] Optionally, in the method described above, the step of selecting a plurality of tuples satisfying the NUMA topology structure of the virtual machine from the NUMA topology structure of the host machine includes:
[0011] Arrange the nodes of the host machine NUMA topology structure into a group according to the target number of nodes to obtain multiple node combinations and generate a node combination set;
[0012] A target node combination that meets the required resources is selected from the node combination set as a tuple.
[0013] Optionally, in the above method, the step of selecting a target node combination that meets the required resources from the node combination set as a tuple includes:
[0014] Determine whether the remaining resources of each node in the node combination are not less than the required resources;
[0015] If so, confirming that the node combination is the target node combination;
[0016] If not, delete the node combination.
[0017] Optionally, in the method described above, the step of selecting a plurality of tuples satisfying the NUMA topology structure of the virtual machine from the NUMA topology structure of the host machine includes:
[0018] Determine whether the remaining resources of each node in the NUMA topology of the host machine are not less than the required resources;
[0019] If so, taking the node as an available node;
[0020] The available nodes are arranged in groups according to the number of target nodes to obtain a plurality of tuples.
[0021] Optionally, in the method described above, the step of calculating the weighted value of each tuple according to a preset weight calculation rule includes:
[0022] Confirm the resource categories of the required resources and the remaining resources of each node in the tuple, and obtain the weight coefficient corresponding to each resource category from a preset resource weight table, wherein the resource weight table is used to store the corresponding relationship between each resource category and the weight coefficient;
[0023] Calculating a weight value of each node in the tuple based on the weight coefficient;
[0024] The weight values of the nodes in the tuple are accumulated to obtain the weighted value of the tuple.
[0025] Optionally, in the method as described above, the calculating the weight value of each node in the tuple based on the weight coefficient includes:
[0026] For each resource category, the difference between the remaining resources of each node in the tuple and the required resources is calculated, and the ratio of the difference to the remaining resources of each node in the tuple is used as the resource category weight value of the tuple node;
[0027] The resource category weight value of each node in the tuple is weighted and calculated according to the weight coefficient of each resource category to obtain the weight value of each node.
[0028] Optionally, in the above method, if the head of the descending queue is a tuple of two or more tuples with the same weight value, the method further includes:
[0029] A target tuple is randomly selected from the tuples with the same weighted values, and the target tuple is confirmed as a resource node of the NUMA topology structure of the virtual machine.
[0030] In a second aspect, the present application provides a resource load balancing device, comprising:
[0031] A resource application module, used to obtain a virtual machine non-uniform memory access NUMA topology structure, wherein the virtual machine NUMA topology structure includes a target node number and required resources;
[0032] A tuple screening module is used to screen out a number of tuples that meet the NUMA topology of the virtual machine from the host machine NUMA topology, the number of nodes in the tuple is the same as the number of target nodes, and the remaining resources of the nodes in the tuple meet the required resources;
[0033] A weighted calculation module, used to calculate the weighted value of each tuple according to a preset weight calculation rule, wherein the weighted value is a weighted set value of the remaining resources of each node in the tuple;
[0034] The resource node confirmation module is used to arrange the tuples in descending order according to the weighted values, generate a descending queue, confirm the tuple at the head of the descending queue as the resource node of the virtual machine NUMA topology structure, and schedule the virtual machine to the resource node.
[0035] In a third aspect, the present application provides an electronic device comprising a memory, a processor, and computer-executable instructions stored in the memory and executable on the processor, wherein when the processor executes the computer-executable instructions, the resource load balancing method described in any one of the first aspects above is implemented.
[0036] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the resource load balancing method described in any one of the above-mentioned first aspects is implemented.
[0037] In a fifth aspect, the present application provides a computer program product. When the computer program product runs on a terminal device, the terminal device executes the resource load balancing method described in any one of the first aspects above.
[0038] The resource load balancing method, device, electronic device, and storage medium provided in the present application obtain a virtual machine non-uniform memory access NUMA topology structure, wherein the virtual machine NUMA topology structure includes a target node number and required resources; a plurality of tuples satisfying the virtual machine NUMA topology structure are screened out from the host machine NUMA topology structure, wherein the number of nodes in the tuple is the same as the target node number, and the remaining resources of the nodes in the tuple satisfy the required resources; a weighted value of each tuple is calculated according to a preset weight calculation rule, wherein the weighted value is a weight set value of the remaining resources of each node in the tuple; each tuple is arranged in descending order according to the weighted value to generate a descending queue, the tuple at the head of the descending queue is confirmed as a resource node of the virtual machine NUMA topology structure, and the virtual machine is scheduled to the resource node to achieve load balancing distribution on the NUMA NODE. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0040] Figure 1 A schematic diagram of an application scenario of the resource load balancing method provided in an embodiment of the present application.
[0041] Figure 2 A flowchart of a resource load balancing method provided in an embodiment of the present application.
[0042] Figure 3A schematic diagram of a resource load balancing device provided in an embodiment of the present application.
[0043] Figure 4 A schematic diagram of the structure of an electronic device applicable to the resource load balancing method provided in an embodiment of the present application.
[0044] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0045] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0046] In the related art, in the process of creating a virtual machine or adjusting the specifications of a virtual machine based on the OpenStack platform, which involves the allocation of NUMA resources for the virtual machine, there is a general order for the NUMA NODE. When the remaining resources of the first few NUMA NODEs meet the NUMA resource requirements applied for by the virtual machine, the resources applied for by the newly created virtual machine or the virtual machine of the migration business will fall on these first few NUMA NODEs. However, overall, this will lead to an unbalanced allocation of resources on the host NUMA NODE, with the resources of the first few NUMA NODEs being over-consumed and the resources of other NUMA NODEs not being fully utilized.
[0047] In response to the above technical problems, the embodiments of the present application aim to propose a resource load balancing method, device, electronic device, and storage medium. The core concept of the method is: after the host machine (physical machine) filters out the physical machine NUMA NODE that meets the conditions according to the virtual machine NUMA topology structure, the remaining resources of each NUMANODE in the tuple composed of the screened NUMA NODEs are calculated to obtain the weighted value of each tuple, and then the tuple with the largest weighted value (that is, the NUMA NODE of the host machine with the most remaining resources) is selected as the NUMA NODE for the virtual machine to apply for resources, thereby realizing load balancing allocation of NUMA NODE resources.
[0048] In order to better understand the solution of the embodiment of the present application, an application scenario involved in the embodiment of the present application is first introduced below.
[0049] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of the resource load balancing method provided in an embodiment of the present application, such as Figure 1 As shown, it includes a user terminal 100 and a server 200. The user terminal 100 can be used to send virtual machine service related instructions to the server 200 according to user needs, such as creating a virtual machine, hot migration of a virtual machine, cold migration of a virtual machine, and resize services of a virtual machine. The server 200 includes an Opensatck cloud platform and a NUMA architecture. The Opensatck cloud platform can respond to user instructions and apply for resource processes (claim processes) according to different business types. In this process, the computing service module (Nova-compute) of OpenStack will find a suitable NUMA NODE according to the requested resource requirements (such as central processing unit, memory, etc.) and allocate resources.
[0050] Specifically, after obtaining the NUMA topology of the virtual machine (including the number of nodes and required resources), a tuple consisting of NUMA NODEs that meet the NUMA topology of the virtual machine can be screened out from the NUMA topology of the host machine, and the remaining resources of each NUMA NODE in the tuple are calculated to obtain a weight value, and then the weight value of each NUMA NODE in the tuple is added and calculated as the weight value of the entire tuple. Then, the weight values are sorted in descending order, and the NUMA NODE in the tuple where the first value of the descending queue of the weight value that meets the conditions is located is the NUMA NODE for which the virtual machine applies for resources, and the virtual machine is scheduled to the resource node.
[0051] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0052] Figure 2 Flow chart of the resource load balancing method provided in the embodiment of the present application. Figure 2 As shown, the method of this embodiment includes:
[0053] S201: Obtain a virtual machine non-uniform memory access NUMA topology structure, where the virtual machine NUMA topology structure includes a target node quantity and required resources.
[0054] The execution subject of the embodiment of the present application may be a server, or a resource load balancing system in the server, wherein the resource load balancing system may be implemented by software.
[0055] It is understood that NUMA is a computer memory architecture that allows processors to access their local memory faster than non-local memory. NUMA topology describes the relationship between processors and memory, including the distribution of processor cores, memory, and I / O devices. The virtual machine NUMA topology conditions refer to the specific requirements and configurations of the virtual machine for NUMA NODE resources at runtime. When creating or adjusting a virtual machine, users can specify the NUMA topology conditions of the virtual machine through a configuration file or API request. For example, in OpenStack, the NUMA topology of the virtual machine can be specified through Nova's flavor and extra_specs.
[0056] The required resources may include a central processing unit, memory, and I / O devices, etc. For example, a virtual machine request may specify the following NUMA topology conditions: 4 CPU cores are required, distributed on 2 NUMA NODEs, with 2 cores on each node; and 8 GB of memory is required, distributed on 2 NUMA NODEs, with 4 GB of memory on each node.
[0057] S202: Filter out several tuples that satisfy the NUMA topology of the virtual machine from the host machine NUMA topology structure, where the tuple is a group of nodes in the host machine NUMA topology structure, the number of nodes in the group of nodes is the same as the number of target nodes, and the remaining resources of the group of nodes satisfy the required resources.
[0058] In this application, the tuple refers to the NUMA NODE combination composed of the NUMA NODE on the host according to the NUMA topology of the virtual machine. All these tuples are actually a The result of the permutation is a set, where m represents the number of NUMA NODEs of the host machine and n represents the number of NUMA NODEs of the virtual machine. The number of NUMA NODEs contained in the tuple is determined by the topology of the virtual machine. That is, if the NUMA topology of the virtual machine contains n NUMA NODEs, then the tuple must contain n NUMA NODEs.
[0059] S203: Calculate the weighted value of each tuple according to a preset weight calculation rule, where the weighted value is a weight set value of the remaining resources of each node in the tuple.
[0060] In this step, the weighted value of the tuple is related to the remaining resources of the tuple. The more remaining resources there are, the greater the weighted value of the tuple is. The weighted value of the tuple is the sum of the resource weight values of each node in the tuple.
[0061] It is understandable that from the perspective of resources, each NUMA NODE is a collection of resources. Because all the resources of NUMA NODE are different in terms of scarcity and cost, different weights can be defined for different resources according to certain rules, such as the weight of the CPU is 1.0, the weight of the memory is 2.0, etc. The final resource weight value of each node is the product of the weight of each resource and its resource category weight value, where the resource category weight value can be calculated by the remaining resources and the corresponding required resources.
[0062] S204: Arrange the tuples in descending order according to the weighted values to generate a descending queue, identify the tuple at the head of the descending queue as a resource node of the NUMA topology structure of the virtual machine, and schedule the virtual machine to the resource node.
[0063] It can be understood that the weighted value of each tuple is positively correlated with its corresponding remaining resources. Therefore, selecting the tuple with the largest weighted value as the resource node can ensure that when the virtual machine business applies for resources, load balancing calculations will be performed based on the amount of remaining resources, ensuring that resources are applied for first on the NUMA NODE with more remaining resources.
[0064] The resource load balancing method provided in this embodiment obtains a non-uniform memory access NUMA topology structure of a virtual machine, wherein the virtual machine NUMA topology structure includes a target node number and required resources; selects a plurality of tuples satisfying the NUMA topology structure of the virtual machine from the NUMA topology structure of the host machine, wherein the number of nodes in the tuple is the same as the target node number, and the remaining resources of the nodes in the tuple satisfy the required resources; calculates a weighted value of each tuple according to a preset weight calculation rule, wherein the weighted value is a weight set value of the remaining resources of each node in the tuple; arranges each tuple in descending order according to the weighted value to generate a descending queue, identifies the tuple at the head of the descending queue as a resource node of the NUMA topology structure of the virtual machine, and schedules the virtual machine to the resource node to achieve load balancing distribution on the NUMA NODE.
[0065] The technical solution of the above resource load balancing method is introduced in detail below.
[0066] In a possible implementation, the resource load balancing method provided in this embodiment first arranges the nodes of the host NUMA topology structure into groups according to the target number of nodes to generate a node combination set, and then selects a suitable node combination set as a tuple.
[0067] Specifically, a plurality of tuples satisfying the NUMA topology of the virtual machine are selected from the NUMA topology of the host machine, including: arranging the nodes of the NUMA topology of the host machine into a group according to the target number of nodes, obtaining a plurality of node combinations, and generating a node combination set; and selecting the target node combination satisfying the required resources as a tuple from the node combination set.
[0068] Furthermore, a target node combination that meets the required resources is screened out from the node combination set as a tuple, including: determining whether the remaining resources of each node in the node combination are not less than the required resources; if so, confirming the node combination as the target node combination; if not, deleting the node combination.
[0069] It is understandable that the number of nodes in the host NUMA topology exceeds the target number of nodes in the virtual machine NUMA topology. Therefore, the nodes in the host NUMA topology can be arranged and combined according to the target number of nodes to generate all node combinations. Then, according to whether each node in the node combination meets the required resources of the virtual machine NUMA topology, the appropriate node combination is selected as a tuple.
[0070] For example, the virtual machine NUMA topology contains two nodes. Node 0 requires 2 CPUs and 2G memory, and Node 1 requires 3 CPUs and 3G memory. The host machine (physical machine) where the virtual machine is located contains 5 NUMA NODEs, namely numa_node0 to numa_node4. The computing service module (Nova-compute) Arrange them into 20 tuples, specifically (noma_node0, noma_node1)...(noma_node5, noma_node4), and then filter and compare the 20 tuples to find the tuple whose central processing unit and memory resources meet the NUMA topology conditions of the virtual machine.
[0071] In this embodiment, each node of the host NUMA topology structure is first arranged into a group according to the target number of nodes to generate a node combination set, and then a suitable node combination set is screened as a tuple. By first generating all possible node combinations and then screening out combinations that meet the requirements, this method ensures that all possible combinations are taken into account, reduces the risk of omissions, and can handle complex resource requirements more flexibly because it considers all possible combinations and can find the optimal resource allocation plan. It is suitable for scenarios with complex and diverse resource requirements and can handle a variety of different resource allocation requirements.
[0072] In a possible implementation manner, the resource load balancing method provided in this embodiment first screens out available nodes, and then arranges the available nodes to obtain tuples.
[0073] Specifically, a plurality of tuples satisfying the NUMA topology structure of the virtual machine are selected from the NUMA topology structure of the host machine, including: determining whether the remaining resources of each node in the NUMA topology structure of the host machine are not less than the required resources; if so, treating the node as an available node; and arranging the available nodes into groups according to the target number of nodes to obtain a plurality of tuples.
[0074] It is understandable that, if there are many nodes in the host NUMA topology, you can first filter out the available nodes that meet the NUMA topology of the virtual machine, and then select the nodes based on the target number of nodes. This can reduce unnecessary combination calculations and improve the efficiency of resource allocation.
[0075] In this embodiment, available nodes are first screened out, and then tuples are obtained by arranging the available nodes. Available nodes whose remaining resources are not less than required resources are first screened out, and then combined and arranged. The calculation process is simplified, which is suitable for scenarios that require fast response.
[0076] In a possible implementation manner, the resource load balancing method provided in this embodiment obtains the weighted value of the tuple by performing weighted calculation on the weight values of different resource categories of each node in the tuple.
[0077] Specifically, the weighted value of each tuple is calculated according to a preset weight calculation rule, including: confirming the resource category of the required resources and the remaining resources of each node in the tuple, obtaining the weight coefficient corresponding to each resource category from a preset resource weight table, and the resource weight table is used to store the correspondence between each resource category and the weight coefficient; calculating the weight value of each node in the tuple based on the weight coefficient; accumulating the weight value of each node in the tuple to obtain the weighted value of the tuple.
[0078] Among them, calculating the weight value of each node in the tuple based on the weight coefficient may include: for each resource category, calculating the difference between the remaining resources of each node in the tuple and the required resources, and taking the ratio of the difference to the remaining resources of each node in the tuple as the resource category weight value of the tuple node; weightedly calculating the resource category weight value of each node in the tuple according to the weight coefficient of each resource category to obtain the weight value of each node.
[0079] For example, for a host machine with three NUMA NODEs, the remaining resources of each NUMA NODE are as follows: noma_node0 has 20 remaining CPUs and 10G remaining memory; noma_node1 has 30 remaining CPUs and 20G remaining memory; noma_node2 has 40 remaining CPUs and 20G remaining memory; and the virtual machine NUMA topology is to create two NUMA NODEs, requiring 10 CPUs and 5G memory. For noma_node0, the resource category weight value of its CPU is (20-10) / 20=0.5, and the resource category weight value of its memory is (10-5) / 10=0.5. When the weight of the CPU is 1.0 and the weight of the memory is 2.0, the weight value of noma_node0 is [(20-10) / 20]*1+[(10-5) / 10]*2=1.5. Similarly, the weight values of noma_node1 and noma_node2 can be calculated.
[0080] In this case, the virtual machine applies for 2 NUMA NODEs and the host has 3 NUMA NODEs. The tuple set can be {(0,1),(0,2),(1,0),(1,2),(2,0),(2,1)} (the numbers omit the prefix noma_node). Taking (0,1) as an example, its weighted value is the sum of the weight values of noma_node0 and noma_node1.
[0081] In this embodiment, by performing weighted calculation on the weight values of different resource categories of each node in the tuple to obtain the weighted value of the tuple, the availability of remaining resources in various node combinations can be calculated, so that more appropriate resources can be further allocated according to the NUMA topology structure of the virtual machine.
[0082] In a possible implementation manner, if the head of the descending queue is a tuple with two or more identical weighted values, the resource load balancing method provided in this embodiment further includes:
[0083] A target tuple is randomly selected from the tuples with the same weighted values, and the target tuple is confirmed as a resource node of the NUMA topology structure of the virtual machine.
[0084] It is understandable that when the head of the descending queue is a tuple with two or more identical weighted values, one of them needs to be selected as the resource node. Random selection can avoid always selecting the same node combination, thereby evenly distributing the load and preventing some nodes from being overloaded. More importantly, random selection can avoid complex decision-making processes, simplify the implementation and maintenance of the algorithm, and random selection does not require additional computational overhead to compare and select the optimal node combination, thereby improving the efficiency of resource allocation.
[0085] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0086] It should be further noted that, although the various steps in the flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flow chart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0087] Figure 3 Schematic diagram of a resource load balancing device provided in an embodiment of the present application. Figure 3 As shown, the resource load balancing device includes:
[0088] A resource application module 31 is used to obtain a virtual machine non-uniform memory access NUMA topology structure, wherein the virtual machine NUMA topology structure includes a target node number and required resources;
[0089] A tuple screening module 32 is used to screen out a plurality of tuples satisfying the NUMA topology of the virtual machine from the NUMA topology of the host machine, wherein the number of nodes of the tuple is the same as the number of target nodes, and the remaining resources of the nodes of the tuple satisfy the required resources;
[0090] A weighted calculation module 33, used to calculate the weighted value of each tuple according to a preset weight calculation rule, wherein the weighted value is a weighted set value of the remaining resources of each node in the tuple;
[0091] The resource node confirmation module 34 is used to arrange the tuples in descending order according to the weighted values to generate a descending queue, confirm the tuple at the head of the descending queue as the resource node of the NUMA topology structure of the virtual machine, and schedule the virtual machine to the resource node.
[0092] In a possible design, the tuple screening module 32 is specifically used for:
[0093] Arrange the nodes of the host machine NUMA topology structure into a group according to the target number of nodes to obtain multiple node combinations and generate a node combination set;
[0094] A target node combination that meets the required resources is selected from the node combination set as a tuple.
[0095] In a possible design, the tuple screening module 32 is specifically used for:
[0096] Determine whether the remaining resources of each node in the node combination are not less than the required resources;
[0097] If so, confirming that the node combination is the target node combination;
[0098] If not, delete the node combination.
[0099] In a possible design, the tuple screening module 32 is specifically used for:
[0100] Determine whether the remaining resources of each node in the NUMA topology of the host machine are not less than the required resources;
[0101] If so, taking the node as an available node;
[0102] The available nodes are arranged in groups according to the number of target nodes to obtain a plurality of tuples.
[0103] In a possible design, the weighted calculation module 33 is specifically used for:
[0104] Confirm the resource categories of the required resources and the remaining resources of each node in the tuple, and obtain the weight coefficient corresponding to each resource category from a preset resource weight table, wherein the resource weight table is used to store the corresponding relationship between each resource category and the weight coefficient;
[0105] Calculating a weight value of each node in the tuple based on the weight coefficient;
[0106] The weight values of the nodes in the tuple are accumulated to obtain the weighted value of the tuple.
[0107] In a possible design, the weighted calculation module 33 is specifically used for:
[0108] For each resource category, the difference between the remaining resources of each node in the tuple and the required resources is calculated, and the ratio of the difference to the remaining resources of each node in the tuple is used as the resource category weight value of the tuple node;
[0109] The resource category weight value of each node in the tuple is weighted and calculated according to the weight coefficient of each resource category to obtain the weight value of each node.
[0110] In a possible design, the resource node confirmation module 34 is specifically used for:
[0111] If there are two or more tuples with the same weight value at the head of the descending queue, a target tuple is randomly selected from the tuples with the same weight value, and the target tuple is confirmed as a resource node of the NUMA topology structure of the virtual machine.
[0112] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0113] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0114] Figure 4 A schematic diagram of the structure of an electronic device applicable to the resource load balancing method provided in an embodiment of the present application. Figure 4 As shown, the electronic device of this embodiment includes: at least one processor 40 ( Figure 4 Only one is shown in the figure) a processor, a memory 41, and a computer program stored in the memory 41 and executable on at least one processor 40, and when the processor 40 executes the computer program, the steps in any of the above-mentioned method embodiments are implemented.
[0115] The electronic device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will appreciate that Figure 4 These are merely examples of electronic devices and do not constitute a limitation on the electronic devices. The electronic devices may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, the electronic devices may also include input and output devices, network access devices, etc.
[0116] The processor 40 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0117] The specific implementation process of the processor 401 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0118] In some embodiments, the memory 41 may be an internal storage unit of an electronic device, such as a memory of the electronic device. In other embodiments, the memory 41 may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 41 may also include both an internal storage unit of the electronic device and an external storage device. The memory 41 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs, etc. The memory 41 may also be used to temporarily store data that has been output or is to be output.
[0119] The embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0120] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0121] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the above-mentioned electronic device.
[0122] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.
[0123] In the above embodiments, the description of each embodiment has its own emphasis. For the part not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0124] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0125] It should be understood that the present application is not limited to the precise 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 application is limited only by the appended claims.
Claims
1. A resource load balancing method, characterized in that: include: Obtaining a virtual machine non-uniform memory access NUMA topology structure, wherein the virtual machine NUMA topology structure includes a target node number and required resources; Filtering out a plurality of tuples satisfying the NUMA topology of the virtual machine from the NUMA topology of the host machine, wherein the number of nodes of the tuple is the same as the number of target nodes, and the remaining resources of the nodes of the tuple satisfy the required resources; Calculate the weighted value of each tuple according to the preset weight calculation rule, where the weighted value is the weight set value of the remaining resources of each node in the tuple; Arrange the tuples in descending order according to the weighted values to generate a descending queue, identify the tuple at the head of the descending queue as a resource node of the NUMA topology structure of the virtual machine, and schedule the virtual machine to the resource node.
2. The method according to claim 1, characterized in that The step of selecting a plurality of tuples satisfying the NUMA topology structure of the virtual machine from the NUMA topology structure of the host machine includes: Arrange the nodes of the host machine NUMA topology structure into a group according to the target number of nodes to obtain multiple node combinations and generate a node combination set; A target node combination that meets the required resources is selected from the node combination set as a tuple.
3. The method according to claim 2, characterized in that The step of selecting a target node combination that meets the required resources from the node combination set as a tuple includes: Determine whether the remaining resources of each node in the node combination are not less than the required resources; If so, confirming that the node combination is the target node combination; If not, delete the node combination.
4. The method according to claim 1, characterized in that The step of selecting a plurality of tuples satisfying the NUMA topology structure of the virtual machine from the NUMA topology structure of the host machine includes: Determine whether the remaining resources of each node in the NUMA topology of the host machine are not less than the required resources; If so, taking the node as an available node; The available nodes are arranged in groups according to the number of target nodes to obtain a plurality of tuples.
5. The method according to any one of claims 1 to 4, characterized in that: The step of calculating the weighted value of each tuple according to a preset weight calculation rule includes: Confirm the resource categories of the required resources and the remaining resources of each node in the tuple, and obtain the weight coefficient corresponding to each resource category from a preset resource weight table, wherein the resource weight table is used to store the corresponding relationship between each resource category and the weight coefficient; Calculating a weight value of each node in the tuple based on the weight coefficient; The weight values of the nodes in the tuple are accumulated to obtain the weighted value of the tuple.
6. The method according to claim 5, characterized in that The calculating the weight value of each node in the tuple based on the weight coefficient includes: For each resource category, the difference between the remaining resources of each node in the tuple and the required resources is calculated, and the ratio of the difference to the remaining resources of each node in the tuple is used as the resource category weight value of the tuple node; The resource category weight value of each node in the tuple is weighted and calculated according to the weight coefficient of each resource category to obtain the weight value of each node.
7. The method according to any one of claims 1 to 4, characterized in that: If the head of the descending queue is a tuple of two or more tuples with the same weight value, the method further includes: A target tuple is randomly selected from the tuples with the same weighted values, and the target tuple is confirmed as a resource node of the NUMA topology structure of the virtual machine.
8. A resource load balancing device, characterized in that: include: A resource application module, used to obtain a virtual machine non-uniform memory access NUMA topology structure, wherein the virtual machine NUMA topology structure includes a target node number and required resources; A tuple screening module is used to screen out a number of tuples that meet the NUMA topology of the virtual machine from the host machine NUMA topology, the number of nodes in the tuple is the same as the number of target nodes, and the remaining resources of the nodes in the tuple meet the required resources; A weighted calculation module, used to calculate the weighted value of each tuple according to a preset weight calculation rule, wherein the weighted value is a weighted set value of the remaining resources of each node in the tuple; The resource node confirmation module is used to arrange the tuples in descending order according to the weighted values, generate a descending queue, confirm the tuple at the head of the descending queue as the resource node of the NUMA topology structure of the virtual machine, and schedule the virtual machine to the resource node.
9. An electronic device, characterized in that: include: 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 the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Patent Citations
Selection method and device of virtual network function
CN109639578A
NUMA node scheduling method and device of virtual machine, equipment and medium
CN111078363A
NUMA node scheduling method and device of virtual machine, equipment and storage medium
CN115269120A
Virtual machine NUMA topology generation method and device, equipment and medium
CN116069447A
CPU (Central Processing Unit) resource allocation scheduling optimization method for Fengyun S2500
CN116361010A
Cited By
Resource scheduling method and device, storage medium, electronic equipment and program product
CN119759597A
