Virtual core binding method and device, computer equipment and storage medium
By dynamically binding the virtual core to the physical core, based on the goal of load balancing, the problem of low resource utilization under the traditional static scheduling method is solved, and the performance of cloud hosts and the cache hit rate is improved.
Patent Information
- Application Number
- CN202411789344.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-18
AI Technical Summary
Traditional static scheduling methods cannot effectively sense the resource usage of virtual machines or virtual cores, resulting in low system resource utilization, prone to cross-node access to data, increasing resource overhead, and reducing cloud host performance.
By obtaining the load data of multiple virtual cores in the NUMA architecture of the cloud host, determining the load average data of the physical core based on the load data and preset over-ratio, and binding the virtual core to the physical core to the physical core to ensure that the virtual core of the same virtual machine is bound to the same NUMA node.
It realizes load balancing of physical core resources, improves resource utilization, improves cloud host performance, and improves the cache hit rate of NUMA system through local data access.
Smart Images

Figure CN119645650A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud computing technology, and in particular to a virtual core binding method, apparatus, computer equipment, storage medium and computer program product. Background Art
[0002] As the application of NUMA (Non-Uniform Memory Access) architecture in cloud hosts becomes more and more widespread, in a multi-node NUMA architecture, multiple processors or processor cores are grouped, and processors or processor cores access local memory faster. By reasonably allocating the virtual cores of the virtual machine to each processor (physical core) in the NUMA node, the performance of the cloud host can be improved.
[0003] In traditional solutions, all physical cores are usually shared and scheduled based on NUMA nodes, and the physical cores and the physical memory corresponding to the physical cores are shared among multiple virtual machines to provide resources and services for multiple virtual machines or multiple user tasks at the same time.
[0004] However, the traditional solution provides a static scheduling method that cannot perceive the subsequent resource usage of a virtual machine or a virtual core. It is also difficult to ensure the utilization of system resources during the scheduling process, and it is easy to access data across nodes, which increases resource overhead and causes the performance of the cloud host to deteriorate. Summary of the invention
[0005] Based on this, it is necessary to provide a virtual core binding method, device, computer equipment, computer-readable storage medium and computer program product that can improve the performance of a cloud host in response to the above technical problems.
[0006] In a first aspect, the present application provides a virtual core binding method. The method comprises:
[0007] Obtain load data of multiple virtual cores in the non-uniform memory access architecture of the cloud host;
[0008] Determining load mean data of physical cores in a non-uniform memory access architecture according to the load data of the plurality of virtual cores and a preset over-provisioning ratio;
[0009] With the goal of minimizing the difference between the actual load of the physical core and the load mean data, the plurality of virtual cores are respectively bound to each physical core;
[0010] The physical cores bound to the virtual cores belonging to the same virtual machine are located in the same node of the non-uniform memory access architecture.
[0011] In one embodiment, the step of binding the plurality of virtual cores to the physical cores respectively with the goal of minimizing the difference between the actual load of the physical core and the load mean data includes:
[0012] sorting the virtual cores according to the load data of the plurality of virtual cores to obtain a sorting result;
[0013] With the goal of minimizing the difference between the actual load of the physical core and the load mean data, the plurality of virtual cores are respectively bound to each physical core according to the sorting result.
[0014] In one embodiment, after the plurality of virtual cores are respectively bound to each physical core, the method further comprises:
[0015] When a preset timed swap task is triggered, load data of multiple virtual cores in a non-uniform memory access architecture is obtained;
[0016] According to the load data of the multiple virtual cores, updating the load mean data of the physical cores in the non-uniform memory access architecture;
[0017] With the goal of minimizing the difference between the actual load of the physical core after adjustment and the updated load mean data, and minimizing the number of adjusted virtual cores, the physical cores bound to the virtual cores are adjusted, wherein the physical cores bound to the virtual cores belonging to the same virtual machine after adjustment are in the same node of the non-uniform memory access architecture.
[0018] In one embodiment, the method further comprises:
[0019] According to the load data of the plurality of virtual cores, the plurality of virtual cores are divided into a first type of virtual cores and a second type of virtual cores, the load data of the first virtual cores being higher than the load data of the second virtual cores;
[0020] The adjusting the physical core bound to the virtual core includes:
[0021] The physical cores bound to the second-type virtual cores are adjusted, and the physical cores bound to the first-type virtual cores remain unchanged.
[0022] In one embodiment, the step of obtaining load data of multiple virtual cores in a non-uniform memory access architecture of a cloud host includes:
[0023] For each virtual core, initial load data of the virtual core in different preset time periods is obtained, and based on preset time weight factors corresponding to different preset time periods, weighted summation is performed on the initial load data in different preset time periods to obtain the load data of the virtual core.
[0024] In one embodiment, determining the load mean data of the physical cores in the non-uniform memory access architecture according to the load data of the plurality of virtual cores and a preset over-provisioning ratio includes:
[0025] Determining load mean data of the virtual core according to the load data of the plurality of virtual cores;
[0026] Based on the load mean data of the virtual core and the preset over-provisioning ratio, the load mean data of the physical core is determined.
[0027] In a second aspect, the present application also provides a virtual core binding device. The device comprises:
[0028] A data acquisition module, used to acquire load data of multiple virtual cores in a non-uniform memory access architecture of a cloud host;
[0029] A load average determination module, configured to determine load average data of physical cores in a non-uniform memory access architecture according to load data of the plurality of virtual cores and a preset over-provisioning ratio;
[0030] A virtual core binding module, configured to bind the plurality of virtual cores to the physical cores respectively with the goal of minimizing the difference between the actual load of the physical core and the load mean data;
[0031] The physical cores bound to the virtual cores belonging to the same virtual machine are located in the same node of the non-uniform memory access architecture.
[0032] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps in the above-mentioned virtual core binding method embodiment are implemented.
[0033] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above-mentioned virtual core binding method embodiment are implemented.
[0034] In a fifth aspect, the present application further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned virtual core binding method embodiment are implemented.
[0035] The above-mentioned virtual core binding method, device, computer equipment, storage medium and computer program product are different from the traditional static shared scheduling method. When allocating virtual cores, this solution first collects the load data of multiple virtual cores in the NUMA architecture of the cloud host, and determines the load mean data of the physical core in the NUMA architecture based on the load data of the virtual core and the preset over-provisioning ratio, so as to minimize the difference between the actual load of the physical core and the load mean data, and bind multiple virtual cores to each physical core respectively. In this way, each physical core can be in a load-balanced state, improve the utilization rate of physical core resources, and improve the performance of the cloud host. In addition, this solution also binds the virtual cores belonging to the same virtual machine to the physical core of the same NUMA node, so that when the virtual machine processes user tasks, even if the process switches back and forth in different virtual cores, the process still accesses local data, which can improve the cache hit rate of the NUMA system, thereby improving the performance of the cloud host. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is an application environment diagram of a virtual core binding method in an embodiment;
[0037] Figure 2 A schematic diagram of a flow chart of a virtual core binding method in one embodiment;
[0038] Figure 3 is a schematic flow chart of a virtual core binding method in another embodiment;
[0039] Figure 4 is a flowchart of a virtual core binding method in yet another embodiment;
[0040] Figure 5 A schematic diagram of a flow chart of a virtual core binding method in another embodiment;
[0041] Figure 6 A schematic diagram of a flow chart of a virtual core binding method in a detailed embodiment;
[0042] Figure 7 is a structural block diagram of a virtual core binding device in one embodiment;
[0043] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0045] The virtual core binding method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown, NUMA node 102 communicates with server 104 via a network. The data storage system can store data that server 104 needs to process. The data storage system can be integrated on server 104, or placed on a cloud or other network server.
[0046] Specifically, a timed collection task may be pre-set in the NUMA node 102 of the cloud host to collect load data of multiple virtual cores in the NUMA architecture and send the data to the server 104. The server 104 determines the load mean data of the physical cores in the NUMA architecture based on the load data of the multiple virtual cores and the preset over-provisioning ratio. Then, the server 104 binds the multiple virtual cores to each physical core with the goal of minimizing the difference between the actual load of the physical core and the load mean data. The physical cores bound to the virtual cores belonging to the same virtual machine are in the same NUMA node.
[0047] The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.
[0048] In one embodiment, Figure 2 As shown, a virtual core binding method is provided, which is applied to Figure 1 Taking the server 104 in the example as an example, the following steps are included:
[0049] S100, obtaining load data of multiple virtual cores in a non-uniform memory access architecture of a cloud host.
[0050] Among them, cloud host is a virtual computing resource in cloud computing services. It is an independent virtual server provided to users after virtualizing the resources of physical servers (such as CPU, memory, storage, network, etc.) through cloud computing technology.
[0051] NUMA (Non-Uniform Memory Access) architecture is a multi-processor computer memory architecture. In NUMA architecture, physical memory is divided into multiple NUMA nodes. Each node contains a set of physical cores (CPUs) and local memory. The physical core accesses local memory faster than the remote memory of other nodes. This is because memory access between different nodes needs to go through additional interconnect links, such as QPI (Quick Path Interconnect), which will cause a certain delay. Therefore, in order to make full use of NUMA architecture, NUMA-aware memory allocation functions can be used, such as numa_alloc_onnode() function, to allocate the thread's memory in the local memory corresponding to the node where the thread is located, or bind the thread to a specific physical core and memory node, or schedule the thread to the physical core corresponding to the local memory node where its data is located. This can reduce cross-node memory access and improve cache hit rate. Performance analysis tools can also be used to monitor and analyze cache hit rate to identify hot spots and performance bottlenecks, and take corresponding optimization measures based on the analysis results, such as redesigning data layout, adjusting thread binding and memory allocation strategies, etc.
[0052] A virtual core (vCPU) is a virtual CPU unit created on the basis of a physical core through virtualization technology. Multiple virtual cores can run simultaneously on one physical core. For example, through software virtualization technology, one physical core can virtualize multiple vCPUs, and each vCPU can be assigned to different virtual machines as an independent CPU of the virtual machine. Load data is used to measure the resource utilization of computer systems (including physical systems and virtual systems), including but not limited to CPU utilization, memory utilization, I / O utilization, network bandwidth utilization, etc.
[0053] Specifically, a resource self-detection module may be deployed on each NUMA node, which is responsible for collecting the load data of the node at regular intervals. The collected load data may be stored in a local file or file database. For example, the load data of multiple virtual cores in a NUMA node may be collected by using an agent / Python script or the like. The collected load data may be stored in a rolling manner. The load data within 24 hours may be stored, and the data may be rolled every 10 seconds. A maximum of 8640 load data may be stored. In addition, in addition to collecting the load data of the virtual core, the load data of the physical core may also be collected to understand the resource utilization rate of the physical core and the detailed resource usage of the entire cloud host.
[0054] S200, determining load average data of physical cores in a non-uniform memory access architecture according to load data of multiple virtual cores and a preset over-provisioning ratio.
[0055] The preset over-provisioning ratio refers to the ratio of the number of virtual cores to the number of physical cores. For example, an over-provisioning ratio of 3 means that one physical core can be virtualized into three virtual cores, so as to fully utilize the physical core resources in a virtualized environment.
[0056] For example, there are multiple virtual machines in the NUMA architecture, and each virtual machine has multiple virtual cores. The load data of each virtual core can be superimposed and then the average value is calculated to obtain the load mean of the virtual core. Furthermore, if the over-provisioning ratio is 3, it means that 1 physical core corresponds to 3 virtual cores, so the load mean data of the physical core in the NUMA architecture should be three times the load mean of the virtual core.
[0057] S300 , with the goal of minimizing the difference between the actual load of the physical core and the load mean data, multiple virtual cores are respectively bound to each physical core.
[0058] The physical cores bound to the virtual cores belonging to the same virtual machine are located in the same NUMA node.
[0059] Specifically, the goal of this embodiment is to minimize the difference between the actual load of the physical core and the average load data, that is, by reasonably binding the virtual core to the physical core, the actual load borne by each physical core is as close as possible to the previously calculated load average data, which means that the physical core resources are more evenly distributed and utilized, reducing the situation where some physical cores are overloaded while other physical cores are idle, thereby improving the resource utilization of the cloud host. For example, it can be to allocate virtual cores with high load first, and then bind virtual cores with small load to physical cores, or it can be to use an optimization algorithm to quickly calculate the best virtual core binding result.
[0060] In addition, the physical cores bound to the virtual cores of the same virtual machine should be in the same NUMA node. This is because under the NUMA architecture, the physical core accesses local memory (that is, the memory in the same NUMA node as itself) much faster than accessing remote memory of other NUMA nodes. If the virtual cores of the same virtual machine are scattered and bound to the physical cores of different NUMA nodes, then during the operation of the virtual machine, memory access across NUMA nodes may occur frequently, which will cause serious performance delays. Therefore, in order to fully utilize the advantages of the NUMA architecture and improve the performance of the cloud host, it is necessary to bind the virtual cores of the same virtual machine to the physical cores in the same NUMA node.
[0061] The above virtual core binding method is different from the traditional static shared scheduling method. When allocating virtual cores, this solution first collects the load data of multiple virtual cores in the NUMA architecture of the cloud host, and determines the load mean data of the physical core in the NUMA architecture based on the load data of the virtual core and the preset over-provisioning ratio, so as to minimize the difference between the actual load of the physical core and the load mean data, and bind multiple virtual cores to each physical core respectively. In this way, each physical core can be in a load-balanced state, improve the utilization rate of physical core resources, and improve the performance of the cloud host. In addition, this solution also binds the virtual cores belonging to the same virtual machine to the physical core of the same NUMA node, so that when the virtual machine processes user tasks, even if the process switches back and forth between different virtual cores, the process still accesses local data, which can improve the cache hit rate of the NUMA system, thereby improving the performance of the cloud host.
[0062] In one embodiment, Figure 3 As shown, S300 includes:
[0063] S310 , sorting the virtual cores according to the load data of the multiple virtual cores to obtain a sorting result.
[0064] S320 , with the goal of minimizing the difference between the actual load of the physical core and the load mean data, bind the multiple virtual cores to the physical cores according to the sorting result.
[0065] Specifically, the virtual cores can be sorted in order of load, and the virtual cores with relatively high loads can be bound to the physical cores first. In this way, the high-load virtual cores can be first allocated to the physical cores with relatively low loads, so that a large number of high-load virtual cores will not be concentrated on certain physical cores in the future, resulting in physical core overload and other physical cores being underloaded.
[0066] In addition, for high-load virtual cores, appropriate physical cores are allocated to them first, so that these high-load virtual cores have sufficient system resources to perform tasks, reducing virtual core task processing delays or performance degradation caused by insufficient system resources. Moreover, for some virtual cores with high real-time processing and high task priority, appropriate physical cores can also be allocated to them first. It should be noted that when binding virtual cores in order of load size, it is still necessary to bind the virtual cores of the same virtual machine to the physical cores on the same NUMA node.
[0067] In this embodiment, the virtual cores are sorted according to the load size, and the physical cores can be bound to the high-load virtual cores first, thereby reducing the situation where the high-load virtual cores can only be bound to the same physical core due to insufficient selectable physical cores. The load borne by each physical core can be relatively uniform and closer to the load average data, thereby improving the performance and resource utilization of the cloud host.
[0068] In one embodiment, Figure 4 As shown, after S300, the virtual core binding method further includes:
[0069] S410, when a preset timed binding swap task is triggered, obtaining load data of multiple virtual cores in a non-uniform memory access architecture.
[0070] S420: Update the load average data of the physical cores in the non-uniform memory access architecture according to the load data of the multiple virtual cores.
[0071] S430 , adjusting the physical cores bound to the virtual cores with the goal of minimizing the difference between the actual load of the adjusted physical core and the updated load mean data and minimizing the number of virtual cores to be bound.
[0072] Among them, after adjustment, the physical cores bound to the virtual cores belonging to the same virtual machine are in the same NUMA node. Scheduled binding tasks refer to periodically rebinding virtual cores to physical cores, that is, using other physical core resources and memory to process tasks and processes on virtual cores. This is because the load of virtual cores is constantly changing. If the virtual core remains unchanged after being bound to the physical core, as the running time increases, it may cause load imbalance, that is, the total load of virtual cores bound to a physical core is much higher than the load average data, while the total load of other physical cores is lower. Therefore, it is necessary to regularly rebind virtual cores so that the actual load of each physical core is as close to the load average data as possible.
[0073] Specifically, a collection cycle can be pre-set, for example, one minute. One minute after the virtual core is bound to the physical core, the load data of each virtual core in the current NUMA system architecture is recollected, the load mean data of the physical core in the NUMA architecture is recalculated based on the load data of each virtual core, and the virtual core is re-bound. The goal of the rebinding is also to make the difference between the actual load of the physical core after the rebinding and the updated load mean data as small as possible. At the same time, in order to reduce the system resources used to perform the rebinding task, the number of virtual cores that are re-bound needs to be reduced as much as possible. For example, some virtual cores with smaller loads are re-bound to other physical cores, and virtual cores with larger loads are not re-bound as much as possible. This is because if the virtual cores with larger loads change, it will cause a larger fluctuation in the overall load balance, which may result in more virtual cores that need to be re-bound.
[0074] It should be noted that in order to reduce the system resource overhead of the cloud host, the above-mentioned periodic rebinding process can only last for a period of time, or the number of rebindings can be limited. For example, if the resource overhead of the tasks or processes processed by the virtual core does not change much, the number of rebindings can be reduced, or the rebinding cycle can be lengthened. Alternatively, when the resource overhead occupied by the tasks or processes processed by the virtual core as a whole is relatively small, even if there is a load imbalance, the impact on the processing speed of the virtual core is relatively small. At this time, the number of rebindings can be reduced, or the rebinding cycle can be lengthened.
[0075] In this embodiment, by regularly rebinding the virtual cores, the NUMA architecture of the cloud host is continuously in a dynamic load balancing process. As the cloud host runs, the load situation may change. Through regular and continuous rebinding operations, the binding relationship between the virtual core and the physical core can be continuously optimized to adapt to the load changes of the cloud host and improve the performance of the cloud host.
[0076] In one embodiment, the virtual core replacement method further includes: dividing the multiple virtual cores into first-type virtual cores and second-type virtual cores according to the load data of the multiple virtual cores, the load data of the first-type virtual cores being higher than the load data of the second-type virtual cores. S430 includes: adjusting the physical core bound to the second-type virtual core, and the physical core bound to the first-type virtual core remains unchanged.
[0077] The first type of virtual core refers to a high-load virtual core, and the second type of virtual core refers to a low-load virtual core. Exemplarily, a load data threshold can be pre-set, and a virtual core whose load data is greater than the preset load data threshold is classified as a first type of virtual core, and a virtual core whose load data is less than or equal to the preset load data threshold is classified as a second type of virtual core.
[0078] Specifically, a high-load first-type virtual core means that it is executing a complex or important task or process, which often has high requirements for processing continuity and virtual core performance. For example, a high-load virtual core is processing a real-time data analysis task. If the virtual core is re-bound at this time, it may cause cache data loss, task interruption, etc. Therefore, during the re-binding process, only the low-load second-type virtual core can be re-bound, while the binding relationship of the first-type virtual core remains unchanged.
[0079] It should be noted that when performing the rebinding operation, the virtual cores can also be classified in a more complex way, such as dividing the virtual cores into high-load virtual cores, medium-load virtual cores and low-load virtual cores, setting different rebinding priorities for virtual cores with different loads, and in the event of load imbalance, try not to rebind the high-load virtual core as much as possible, but adjust the binding relationship of the medium-load virtual core and the low-load virtual core. For example, the medium-load virtual core among the high-load virtual core and the medium-load virtual core bound to the same physical core can be rebinded to another physical core, and the low-load virtual core can be bound to the physical core where the high-load virtual core is located, thereby reducing the load of the physical core.
[0080] In this embodiment, the virtual cores are divided into high-load virtual cores and low-load virtual cores according to their load data, and when performing a binding swap operation, the low-load virtual cores are operated as much as possible to reduce data loss, task processing delays, etc. that may be caused by switching to a high-load virtual core, thereby improving the performance of the cloud host.
[0081] In one embodiment, Figure 5 As shown, S100 includes:
[0082] S110, for each virtual core, obtain the initial load data of the virtual core in different preset time periods, and based on the initial load data and preset time weight factors corresponding to different preset time periods, perform weighted summation on the initial load data in different preset time periods to obtain the load data of the virtual core.
[0083] The initial load data refers to the load data of the virtual core that is directly collected and not processed. The preset time weight factor is used to characterize the importance of different preset time periods.
[0084] Specifically, the self-monitoring module structure in each NUMA node can be called, and the server obtains the cloud host resource information, the physical machine resource information on the NUMA node, the virtual machine resource information, etc. Taking the resource utilization rate of the virtual core as an example of the initial load data, the resource utilization rate of the virtual core in the last 1 minute, 5 minutes, and 10 minutes can be obtained, assuming that they are 60%, 40%, and 50% respectively. The preset time weight factor can be set to 6:3:1, and then the weighted average method is used to determine the load data of multiple virtual cores: average utilization rate = (60%*6+40%*3+50%*1) / (6+3+1)=53%. Finally, the load data of each virtual core in the cloud host can be summarized, and the load data of each physical core can also be summarized to provide a richer basis for the subsequent virtual core binding link.
[0085] In this embodiment, by collecting the initial load data of each virtual core in different time periods and calculating the load data of each virtual core by weighted average, the accuracy and reliability of the load data can be improved, providing more accurate and reliable data for virtual core binding, which is beneficial to improving the performance of the cloud host.
[0086] In one embodiment, Figure 5 As shown, S200 includes:
[0087] S210 , determining load mean data of the virtual cores according to load data of the plurality of virtual cores.
[0088] S220, determining the load average data of the physical core based on the load average data of the virtual core and the preset over-provisioning ratio.
[0089] Continuing with the above embodiment, taking the case where there are two NUMA nodes in the NUMA architecture of the cloud host as an example, there are 14 physical cores on each NUMA node, and two physical cores are reserved, that is, there are 12 physical cores available for scheduling in the cloud host, and the over-provisioning ratio is preset to 3. Each node can be bound to 36 virtual cores, and the cloud host can be bound to 72 virtual cores. The specification of the virtual machine is 4C8G, which means that one virtual machine can have 4 virtual cores, and 18 virtual machines can be created.
[0090] Based on the load data of the virtual core, the load mean data of a single virtual core can be calculated. The calculation formula is shown in formula (1):
[0091] (1)
[0092] In formula (1), Represents the load average data of a single virtual core in a virtual machine. Represents the load data of the virtual core in the virtual machine, Indicates the number of virtual cores. In this embodiment, the number of virtual cores in a single virtual machine is 4, that is, is 4.
[0093] Furthermore, the load average data of the physical core is equal to the load average data of the virtual core multiplied by the over-provisioning ratio. Therefore, the load average data of the physical core can be calculated based on formula (2):
[0094] (2)
[0095] In formula (2), represents the average load data of the virtual cores in the virtual machine, n represents the number of virtual machines, and in this embodiment, the number of virtual machines is 18, that is, n is 18, Indicates the average load data of each physical core in each NUMA node. When subsequently binding virtual cores, the sum of the virtual core load data bound to each physical core needs to be as close as possible to the average load data to achieve load balancing in the cloud host.
[0096] For example, assuming that there are 18 virtual machines, each of which is configured with 4 virtual cores, one physical core can be bound to 3 virtual cores, and there are 2 NUMA nodes in the NUMA architecture of the cloud host. The virtual cores belonging to the same virtual machine are bound to the same physical core. The virtual machines bound to the NUMA node, the average load data of the virtual cores in the virtual machine, and the average load data of each physical core in each NUMA node can be shown in Table 1:
[0097] Table 1 Comparison table of virtual machines and NUMA nodes
[0098]
[0099] In Table 1, the average load data of the physical cores in the NUMA0 node and the NUMA1 node are 0.75 and 0.753333 respectively, which are close to each other and close to the average load data of all physical cores in the entire NUMA architecture. Therefore, the cloud host can be in a load-balanced state, and the cloud host can show good performance in resource allocation, task processing and other aspects.
[0100] In this embodiment, the average load data of the virtual core is calculated by taking the average value, and then combined with the preset over-allocation ratio, the average load data of the physical core can be quickly determined, so that when the virtual core is bound to the physical core, the load of each physical core can be as close to the average load as possible, thereby achieving load balancing of the cloud host and improving the performance of the cloud host.
[0101] In order to make a clearer description of the virtual core binding method based on NUMA architecture provided by the present application, Figure 6 and one A detailed embodiment is provided to explain the invention, and the detailed embodiment comprises the following steps:
[0102] S601, for each virtual core, obtain the initial load data of the virtual core in different preset time periods, and based on the initial load data and the preset time weight factors corresponding to the different preset time periods, perform weighted summation on the initial load data in different preset time periods to obtain the load data of the virtual core.
[0103] S602, determining load mean data of the virtual cores according to load data of the plurality of virtual cores, and determining load mean data of the physical cores based on the load mean data of the virtual cores and a preset over-provisioning ratio.
[0104] S603, sorting the virtual cores according to the load data of the multiple virtual cores to obtain a sorting result, with the goal of minimizing the difference between the actual load of the physical core and the load mean data, and binding the multiple virtual cores to each physical core according to the sorting result.
[0105] S604, when the preset timed rebinding task is triggered, obtain the load data of multiple virtual cores in the non-uniform memory access architecture, update the load mean data of the physical cores in the non-uniform memory access architecture according to the load data of the multiple virtual cores, and divide the virtual cores into first type virtual cores and second type virtual cores according to the load data of the multiple virtual cores.
[0106] S605, with the goal of minimizing the difference between the actual load of the adjusted physical core and the updated load mean data and minimizing the number of adjusted virtual cores, the physical cores bound to the second type virtual cores are adjusted, and the physical cores bound to the first type virtual cores remain unchanged.
[0107] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments 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 does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these 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 part of the steps or stages in other steps.
[0108] Based on the same inventive concept, the embodiment of the present application also provides a virtual core binding device for implementing the virtual core binding method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more virtual core binding device embodiments provided below can refer to the limitations of the virtual core binding method above, and will not be repeated here.
[0109] In one embodiment, Figure 7 As shown, a virtual core binding device 700 is provided, comprising: a data acquisition module 710, a load average determination module 720 and a virtual core binding module 730, wherein:
[0110] The data acquisition module 710 is used to acquire the load data of multiple virtual cores in the non-uniform memory access architecture of the cloud host.
[0111] The load average determination module 720 is used to determine the load average data of the physical cores in the non-uniform memory access architecture according to the load data of the multiple virtual cores and the preset over-provisioning ratio.
[0112] The virtual core binding module 730 is used to bind multiple virtual cores to each physical core respectively with the goal of minimizing the difference between the actual load of the physical core and the load mean data.
[0113] The physical cores bound to the virtual cores belonging to the same virtual machine are located in the same node of the non-uniform memory access architecture.
[0114] In one embodiment, the virtual core binding module 730 is also used to sort the virtual cores according to the load data of the multiple virtual cores to obtain a sorting result, with the goal of minimizing the difference between the actual load of the physical core and the load mean data. According to the sorting result, the multiple virtual cores are respectively bound to each physical core.
[0115] In one embodiment, the virtual core binding device 700 is also used to obtain load data of multiple virtual cores in the non-consistent memory access architecture when a preset timed rebinding task is triggered, and update the load mean data of the physical cores in the non-consistent memory access architecture based on the load data of the multiple virtual cores, so as to adjust the physical cores bound to the virtual cores with the goal of minimizing the difference between the actual load of the adjusted physical core and the updated load mean data, and minimizing the number of adjusted virtual cores, wherein the physical cores bound to the virtual cores belonging to the same virtual machine after adjustment are located in the same node of the non-consistent memory access architecture.
[0116] In one embodiment, the virtual core binding device 700 is also used to divide multiple virtual cores into first type virtual cores and second type virtual cores according to the load data of the multiple virtual cores, the load data of the first virtual core is higher than the load data of the second virtual core, and the physical core bound to the second type virtual core is adjusted, and the physical core bound to the first type virtual core remains unchanged.
[0117] In one embodiment, the data acquisition module 710 is also used to obtain the initial load data of the virtual core within different preset time periods for each virtual core, and perform weighted summation on the initial load data within different preset time periods based on the preset time weight factors corresponding to the different preset time periods to obtain the load data of the virtual core.
[0118] In one embodiment, the load average determination module 720 is further used to determine the load average data of the virtual core according to the load data of multiple virtual cores, and determine the load average data of the physical core based on the load average data of the virtual core and a preset over-allocation ratio.
[0119] Each module in the above virtual core binding device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0120] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as load data of multiple virtual cores. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a virtual core binding method is implemented.
[0121] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0122] In one embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor implements the steps in the above virtual core binding method embodiment when executing the computer program.
[0123] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned virtual core binding method embodiment are implemented.
[0124] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above-mentioned virtual core binding method embodiment when executed by a processor.
[0125] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0127] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are 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.
[0128] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A virtual core binding method, characterized in that: The method comprises: Obtain load data for multiple virtual cores in the cloud host's non-uniform memory access architecture; Determining load mean data of physical cores in a non-uniform memory access architecture according to the load data of the plurality of virtual cores and a preset over-provisioning ratio; With the goal of minimizing the difference between the actual load of the physical core and the load mean data, the plurality of virtual cores are respectively bound to each physical core; The physical cores bound to the virtual cores belonging to the same virtual machine are located in the same node of the non-uniform memory access architecture.
2. The method according to claim 1, characterized in that: The step of binding the plurality of virtual cores to the physical cores respectively with the goal of minimizing the difference between the actual load of the physical core and the load mean data comprises: sorting the virtual cores according to the load data of the plurality of virtual cores to obtain a sorting result; With the goal of minimizing the difference between the actual load of the physical core and the load mean data, the plurality of virtual cores are respectively bound to each physical core according to the sorting result.
3. The method according to claim 1, characterized in that After the plurality of virtual cores are respectively bound to the physical cores, the method further comprises: When a preset timed swap task is triggered, load data of multiple virtual cores in a non-uniform memory access architecture is obtained; According to the load data of the multiple virtual cores, updating the load mean data of the physical cores in the non-uniform memory access architecture; With the goal of minimizing the difference between the actual load of the physical core after adjustment and the updated load mean data, and minimizing the number of adjusted virtual cores, the physical cores bound to the virtual cores are adjusted, wherein the physical cores bound to the virtual cores belonging to the same virtual machine after adjustment are in the same node of the non-uniform memory access architecture.
4. The method according to claim 3, characterized in that The method further comprises: According to the load data of the plurality of virtual cores, the plurality of virtual cores are divided into a first type of virtual cores and a second type of virtual cores, the load data of the first virtual cores being higher than the load data of the second virtual cores; The adjusting the physical core bound to the virtual core includes: The physical cores bound to the second-type virtual cores are adjusted, and the physical cores bound to the first-type virtual cores remain unchanged.
5. The method according to any one of claims 1 to 4, characterized in that: The step of obtaining load data of multiple virtual cores in the non-uniform memory access architecture of the cloud host includes: For each virtual core, initial load data of the virtual core in different preset time periods is obtained, and based on preset time weight factors corresponding to different preset time periods, weighted summation is performed on the initial load data in different preset time periods to obtain the load data of the virtual core.
6. The method according to any one of claims 1 to 4, characterized in that: The step of determining the load mean data of the physical cores in the non-uniform memory access architecture according to the load data of the plurality of virtual cores and the preset over-provisioning ratio comprises: Determining load mean data of the virtual core according to the load data of the plurality of virtual cores; Based on the load mean data of the virtual core and the preset over-provisioning ratio, the load mean data of the physical core is determined.
7. A virtual core binding device, characterized in that: The device comprises: A data acquisition module, used to acquire load data of multiple virtual cores in a non-uniform memory access architecture of a cloud host; A load average determination module, configured to determine load average data of physical cores in a non-uniform memory access architecture according to load data of the plurality of virtual cores and a preset over-provisioning ratio; A virtual core binding module, configured to bind the plurality of virtual cores to the physical cores respectively with the goal of minimizing the difference between the actual load of the physical core and the load mean data; The physical cores bound to the virtual cores belonging to the same virtual machine are located in the same node of the non-uniform memory access architecture.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Virtual machine configuration method and device based on C86 architecture
CN120872491A
Virtual core binding method and apparatus, computer device, and storage medium
WO2026118899A1