Resource allocation method and device, equipment, computer storage medium and program product

By obtaining the CPU load information of the virtual switch OVS process and using the CPU core elastic allocation algorithm to calculate the target CPU core number, the problem of lag and waste in virtual switch resource allocation is solved, and reasonable allocation and timeliness of resources are achieved.

CN118819810APending Publication Date: 2024-10-22CHINA MOBILE COMM GRP CHONGQING CO LTD +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410192077.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-21
Publication Date
2024-10-22

AI Technical Summary

Technical Problem

In the existing technology, virtual switch (OVS) resource allocation relies on manual experience, resulting in a waste or shortage of CPU resources and hysteresis, making it impossible to adjust in real time according to load changes.

Method used

By obtaining the CPU load information of the OVS process of the virtual switch, the CPU core elastic allocation algorithm is used to calculate the target number of CPU cores, and the CPU core resources are reallocated to achieve elastic allocation of CPU resources and avoid resource waste and lag problems caused by manual allocation.

Benefits of technology

It achieves reasonable allocation of CPU resources, reduces the probability of resource waste or shortage, improves the timeliness and efficiency of resource allocation, and can make dynamic adjustments based on real-time load information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118819810A_ABST
    Figure CN118819810A_ABST
Patent Text Reader

Abstract

The invention discloses a resource allocation method and device, equipment, a computer storage medium and a program product. The method comprises the following steps: acquiring CPU load information of a virtual switch OVS process acquired in N acquisition periods within D target durations and allocated CPU core information allocated to the OVS process; d and N are positive integers greater than or equal to 1; processing the CPU load information through a CPU core elastic allocation algorithm to obtain target CPU core information expected to be allocated to the OVS process; the target CPU core information at least comprises a target CPU core number, and the target CPU core number is the minimum core number when the CPU full load probability of the OVS process running on the allocated CPU core is smaller than a preset probability; and reallocating CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information. According to the embodiment of the invention, the CPU resources can be flexibly allocated to the OVS process, reasonable allocation of the CPU resources is realized, and the probability of waste or insufficiency of the CPU resources is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of cloud computing and big data technology, and in particular, relates to a resource allocation method, device, equipment, computer storage medium and program product. Background Art

[0002] At present, cloud computing technology is developing rapidly. The foundation of cloud computing is virtualization technology, which abstracts physical resources such as central processing unit (CPU) and memory into a virtual resource for allocation. On computing servers, virtual resources mainly include virtual machines and virtual machine networks. A virtual machine is a complete computer system with complete hardware functions and running in a completely isolated environment that is simulated by software through virtualization technology, that is, another computer system virtualized in the computer; a virtual machine network refers to the need for information transmission between virtual machines and between virtual machines and external devices in cloud computing, but it is impossible to use physical network devices to build a network for virtual machines to exchange information inside a single physical machine, and communication between virtual machines and external devices can only be achieved through software. That is, a virtual machine network refers to a network platform constructed by a complete computer system with complete hardware system functions and running in an isolated environment simulated by software.

[0003] The virtual switch (Open vSwitch, referred to as OVS), as a switch in the form of software that exists in the virtual network, is used to complete the information exchange and transmission of virtual machines. It has now become the default virtual switch used in mainstream virtual networks. Usually, in order to achieve performance optimization and security isolation on the server, it is necessary to allocate resources to OVS, that is, to bind the core to OVS. Binding the core means binding the process of OVS during runtime to a specified number of CPU cores, and OVS can only run on these allocated CPU cores. The prior art party sets the configuration file on the server in advance through manual experience to determine the number of CPU cores allocated to OVS. After the system starts, the configuration file is read and the OVS process is bound to the CPU core according to the allocation strategy. The binding relationship between OVS and the CPU core is fixed. If the binding relationship between OVS and the CPU core is changed during operation, it can only be reset manually.

[0004] The existing technology mainly relies on the manual experience of operation and maintenance personnel to allocate resources for virtual switches. However, due to the differences in CPU performance and core numbers of servers, as well as the experience gap between different operation and maintenance personnel, the above allocation method is prone to waste or shortage of resources. In addition, the existing resource allocation method has lag. Summary of the invention

[0005] The embodiments of the present application provide a resource allocation method, apparatus, device, computer storage medium, and program product, which can flexibly allocate CPU resources to OVS processes, achieve reasonable allocation of CPU resources, and reduce the probability of CPU resource waste or shortage.

[0006] In a first aspect, an embodiment of the present application provides a resource allocation method, the method comprising:

[0007] Obtain the CPU load information of the virtual switch OVS process collected in N collection cycles within D target durations and the allocated CPU core information allocated to the OVS process; D and N are positive integers greater than or equal to 1;

[0008] The CPU load information is processed by the CPU core elastic allocation algorithm to obtain the target CPU core information expected to be allocated to the OVS process; the target CPU core information includes at least the target number of CPU cores, which is the minimum number of cores when the probability of CPU full load running on the allocated CPU core of the OVS process is less than the preset probability;

[0009] Reallocate the CPU core resources of the OVS process based on the allocated CPU core information and the target CPU core information.

[0010] In a second aspect, an embodiment of the present application provides a resource allocation device, the device comprising:

[0011] An acquisition module is used to acquire CPU load information of the virtual switch OVS process collected in N collection cycles within D target durations and information of allocated CPU cores allocated to the OVS process; D and N are positive integers greater than or equal to 1;

[0012] A processing module is used to process the CPU load information through a CPU core elastic allocation algorithm to obtain target CPU core information expected to be allocated to the OVS process; the target CPU core information includes at least a target number of CPU cores, which is the minimum number of cores when the probability of the CPU being fully loaded when the OVS process runs on the allocated CPU core is less than a preset probability;

[0013] The allocation module is used to reallocate the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information.

[0014] In a third aspect, an embodiment of the present application provides a resource allocation device, the device comprising:

[0015] a processor and a memory storing computer program instructions;

[0016] When the processor executes the computer program instructions, any one of the above resource allocation methods is implemented.

[0017] In a fourth aspect, an embodiment of the present application provides a computer storage medium, on which computer readable storage medium is stored computer program instructions, and when the computer program instructions are executed by a processor, any one of the above-mentioned resource allocation methods is implemented.

[0018] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes any one of the above-mentioned resource allocation methods.

[0019] The resource allocation method, device, equipment, computer storage medium and program product of the embodiment of the present application can obtain the CPU load information of the virtual switch OVS process collected within N collection cycles within D target durations, and then process the CPU load information through the CPU core elastic allocation algorithm to obtain the target CPU core information expected to be allocated to the OVS process, and finally reallocate the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information. In this way, the embodiment of the present application can allocate CPU cores to the OVS process according to the CPU load information of the OVS process. And the allocation of CPU cores is achieved through the CPU core elastic allocation algorithm, so the embodiment of the present application avoids problems such as waste or insufficient resource allocation caused by artificial allocation of CPU cores. Moreover, the embodiment of the present application can allocate resources according to the real-time load information of the CPU, without waiting until the CPU is fully loaded before allocation, so the embodiment of the present application solves the hysteresis problem of existing resource allocation and improves the timeliness of resource allocation. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0021] Figure 1 This is a system architecture diagram of a method for executing resource allocation provided by an embodiment of the present application;

[0022] Figure 2 is a flowchart of a resource allocation method 200 provided in one embodiment of the present application;

[0023] Figure 3 It is a flowchart of a specific implementation method of S202 provided in an embodiment of the present application;

[0024] Figure 4 It is a flowchart of a specific implementation method of S203 provided in an embodiment of the present application;

[0025] Figure 5is a flowchart of another specific implementation method of S203 provided in an embodiment of the present application;

[0026] Figure 6 It is a structural diagram of a resource allocation device provided by an embodiment of the present application.

[0027] Figure 7 It is a structural diagram of a resource allocation device provided by an embodiment of the present application.

[0028] The above drawings include the following reference numerals:

[0029] 101. Configuration module; 102. Status collection module; 103. Load collection module; 104. Database; 105. Resource allocation device; 106. Operation management platform. DETAILED DESCRIPTION

[0030] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.

[0031] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0032] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0033] Virtual Machine (VM): refers to a complete computer system with complete hardware functions that runs in a completely isolated environment and is simulated by software through virtualization technology. In layman's terms, it is another computer system virtualized in the computer.

[0034] Virtual switch (Open vSwitch, referred to as OVS): In cloud computing, information needs to be transmitted between virtual machines and between virtual machines and external devices. It is impossible to use physical network devices to build a network for virtual machines to exchange information inside a single physical machine. Communication between virtual machines and between virtual machines and external devices can only be achieved through software. A virtual machine network refers to a network platform constructed by a complete computer system with complete hardware system functions running in an isolated environment simulated by software. OVS is a high-quality virtual switch that supports multi-layer data forwarding. As a switch in the virtual network in the form of software, it completes the information exchange and transmission of virtual machines. OVS has now become the default virtual machine used in mainstream virtual networks.

[0035] In order to effectively solve the problems encountered in the prior art, resources are allocated to virtual switches mainly relying on the manual experience of operation and maintenance personnel. However, due to the differences in CPU performance and number of cores of servers, as well as the experience gap between different operation and maintenance personnel, the above allocation method is prone to waste or shortage of resources and lag problems. The embodiments of the present application provide a resource allocation method, device, equipment, computer storage medium and program product. The resource allocation method provided in the embodiments of the present application is first introduced below.

[0036] Figure 1 FIG. 1 shows a system architecture diagram of a method for executing resource allocation provided by an embodiment of the present application. Figure 1As shown, in an embodiment of the present invention, the configuration module 101 can be used to configure basic information, and the basic information can be set based on application scenarios, usage requirements or data characteristics. Exemplarily, the basic information may include the maximum preset number of CPU cores that can be allocated to the OVS process, the minimum preset number of CPU cores, the preset probability of OVS running at full load on the allocated CPU cores, etc.; the status acquisition module 102 can be used to collect CPU core information allocated to the OVS process. Exemplarily, the CPU core information may include the number of CPU cores, the nodes where the CPU cores are located, etc.; the load acquisition module 103 can be used to collect CPU load information of the OVS process running, and the CPU load information indicates the degree to which the CPU running the OVS process is executing tasks; the database 104 can be used to persistently store data from the above-mentioned configuration module 101, the status acquisition module 102 and the load acquisition module 103; the resource allocation device 105 can be used to obtain The CPU load information of the virtual switch OVS process collected within N collection cycles within D target time lengths and the allocated CPU core information allocated to the OVS process are obtained; the resource allocation device 105 can also process the CPU load information through the CPU core elastic allocation algorithm to obtain the target CPU core information expected to be allocated to the OVS process; then, the resource allocation device 105 can reallocate the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information, and in the event of an abnormality in OVS, can promptly send warning information to the operation management platform 106; the operation management platform 106 can be a remote processing platform, which can be used to receive the warning information sent by the resource allocation device 105, and notify the operation and maintenance personnel to intervene in the processing according to the actual situation.

[0037] Based on the above Figure 1 In the system architecture, this application provides a specific implementation of a resource allocation method. It should be noted that the action execution subject of the resource allocation method is Figure 1 The resource allocation device 105 in.

[0038] Figure 2 FIG. 2 is a flow chart of a resource allocation method 200 provided in an embodiment of the present application. Figure 2 As shown, the resource allocation method may include S201 to S203:

[0039] S201: Obtain CPU load information of the virtual switch OVS process collected in N collection cycles within D target time lengths and information on allocated CPU cores allocated to the OVS process;

[0040] S202: Process the CPU load information through a CPU core elastic allocation algorithm to obtain target CPU core information expected to be allocated to the OVS process;

[0041] S203: Reallocate the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information.

[0042] The resource allocation method provided in the embodiment of the present invention innovatively obtains the CPU load information of the virtual switch OVS process collected within N collection cycles within D target time lengths, and then processes the CPU load information through the CPU core elastic allocation algorithm to obtain the target CPU core information expected to be allocated to the OVS process, and finally reallocates the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information. In this way, the embodiment of the present application can allocate CPU cores to the OVS process according to the CPU load information of the OVS process. And the allocation of CPU cores is achieved through the CPU core elastic allocation algorithm, so the embodiment of the present application avoids problems such as waste or insufficient resource allocation caused by artificial allocation of CPU cores. Moreover, the embodiment of the present application can allocate resources according to the real-time load information of the CPU, without waiting until the CPU is fully loaded before allocation, so the embodiment of the present application solves the hysteresis problem of existing resource allocation and improves the timeliness of resource allocation.

[0043] Next, the specific implementation of each step in the above resource allocation method will be introduced in detail.

[0044] In some embodiments, in S201, D and N are positive integers greater than or equal to 1, and the N collection cycles can be the first N cycles closest to the current moment. For example, a cycle can be 10 minutes, 30 minutes, and 1 hour, etc. The cycles can be continuous or separated by a period of time. In this way, the CPU load activity level of OVS in the recent period can be collected. Among the D target durations, the target duration can be one day, the D target durations can be D days before the current moment, the D days can be continuous D days, or they can be D days with intervals. The CPU load information indicates the degree to which the CPU running the OVS process is executing tasks. In this way, the CPU load activity level of OVS in the recent period can be collected more accurately, reducing the impact of certain abnormal changes on the target number of CPU cores that should be allocated to the OVS process for subsequent calculation and analysis.

[0045] In some embodiments, the CPU core information allocated to the OVS process can be first collected through the aforementioned state collection module, and the load collection module can collect the CPU load information of the OVS process. Then, the data from the aforementioned configuration module, the state collection module and the load collection module can be persistently stored in the database. Finally, the calculation and analysis module periodically obtains the corresponding data from the database and performs calculation and analysis. For example, the collection and calculation and analysis period can be 1 minute, 5 minutes, etc., which can be set based on the actual application situation and calculation accuracy. When the collection and calculation and analysis period needs to be adjusted, it can be automatically adjusted through the correction coefficient. The correction coefficient can be pre-set through the aforementioned configuration device. For example, the value of the correction coefficient of the collection and calculation and analysis period can be set to 0.97. In this way, the CPU load information of the OVS process in the recent period and the allocated CPU core information are accurately obtained.

[0046] In some embodiments, in S202, the target CPU core information includes at least the target CPU core number, which is the minimum number of cores when the probability of the CPU full load of the OVS process running on the allocated CPU core is less than the preset probability. The target CPU core number can be calculated by the CPU core elastic allocation algorithm, that is, firstly, the average load of the CPU of the OVS process in N acquisition cycles is calculated by a related average calculation method, for example, the arithmetic average formula. Then, the average load of the CPU in N acquisition cycles in each target duration is calculated by a related average calculation method, for example, the arithmetic average formula. Finally, the minimum number of cores that meets the preset conditions is calculated by Poisson distribution, and the above preset conditions are that the probability of the CPU full load of the OVS process running on the allocated CPU core is less than the preset probability. When the minimum number of cores is an integer, the minimum number of cores is the target number of CPU cores; when the minimum number of cores is not an integer, the minimum number of cores is rounded up to obtain the target number of CPU cores. In this way, the number of CPU cores required for the normal operation of the OVS process is obtained more accurately.

[0047] In some embodiments, the preset probability may represent the probability that the OVS process runs at full load on the allocated CPU core. The value range of the preset probability may be between 0 and 1. Exemplarily, the preset probability is set to 5%, and the number of CPU cores currently allocated to the OVS process is 3, indicating that the CPU load of OVS is 300%, that is, the probability of full load operation is 5%. When the preset probability needs to be adjusted, it can be automatically adjusted by the correction coefficient, and the correction coefficient can be pre-set by the aforementioned configuration device. Exemplarily, the value of the correction coefficient of the preset probability can be set to 0.95.

[0048] In some embodiments, in S203, the core information in the allocated CPU core information and the target CPU core information includes at least the number of CPU cores and the node where the CPU core is located. The specific content about the number of cores has been explained in the aforementioned S202 and will not be repeated here. For the node where the CPU core is located, it can be understood that for a complete CPU, it can be divided into several memory groups with the same storage space size in a NUMA distribution structure, that is, divided into several points, numbered from 1 according to the node, node 1, node 2, node 3 and so on. The number of CPU cores included in each node and the size of each CPU core are the same. On the basis of obtaining the number of CPU cores required for the normal operation of the OVS process, combined with the node information where the CPU core is located in the allocated CPU core information, it is possible to determine which node the OVS process is specifically allocated to, so as to reasonably reallocate CPU core resources for the OVS process.

[0049] In order to more accurately obtain the number of CPU cores expected to be allocated to the OVS process, such as Figure 3 As shown, the aforementioned S202 may include the following steps: S2021 to S2022.

[0050] S2021: Calculate the average load based on the CPU load information in N collection cycles within the D target durations;

[0051] S2022: According to the Poisson distribution, the average load and the preset probability, the minimum number of cores when the probability of full load of the CPU running on the average load of the OVS process is less than the preset probability is calculated to obtain the target number of CPU cores.

[0052] The specific contents of the D target durations, the N collection cycles and the CPU load information have been described in the aforementioned S201 and will not be repeated here.

[0053] In some embodiments, in order to more clearly determine the CPU load information within N acquisition cycles, the size of the CPU load occupied by OVS in the i-th cycle is defined as C i ; The size of the CPU load occupied by OVS in multiple cycles can be calculated using the set {C1, C2, ..., C i , …, C N}, where N is the number of acquisition cycles and N is a positive integer.

[0054] In one embodiment, the average CPU load X in N acquisition cycles can be calculated by calculating its arithmetic mean, that is, formula (1):

[0055]

[0056] In this way, by calculating the average value of the CPU load of the OVS process in the recent period, the activity level of the CPU load of the OVS process in the recent period is accurately represented.

[0057] In order to more accurately represent the activity level of the CPU load of the OVS process in the recent period of time, thereby calculating the average load of the CPU load, the present application also provides another embodiment of the resource allocation method.

[0058] In this embodiment, the aforementioned S2021 may include the following steps:

[0059] For each target duration, the CPU load activity level within the target duration is calculated based on the CPU load information within the N acquisition cycles within the target duration;

[0060] According to the D CPU load activity levels, calculate the average CPU load.

[0061] In some embodiments, in order to more clearly determine the CPU load information within the D target durations, the average load X of the N acquisition cycles included in the i target durations is calculated. i , as the definition of the size of the CPU load occupied by OVS; the size of the CPU load occupied by OVS within multiple target durations can be defined using the set {X1, X2, …, X i , …, X D}, where D is the number of target durations.

[0062] In one embodiment, the average CPU load K within the D target durations can be calculated by calculating its geometric mean, that is, formula (2):

[0063]

[0064] In this way, we first calculate the average value of the CPU load of the OVS process in the recent period, and then use the above average value to calculate the average value of the CPU load of the OVS process for a longer period of time, so as to more accurately determine the activity level of the CPU load of the OVS process in the recent period of time, thereby reducing the impact of certain abnormal changes on the subsequent calculation and analysis of the target number of CPU cores that should be allocated to the OVS process.

[0065] In order to accurately obtain the minimum number of CPU cores that need to be allocated for the normal operation of the OVS process when the cores are not full, so that the OVS process can operate normally, the aforementioned S2022 may include the following steps:

[0066] According to the following formula (3), the average load and the preset probability, the minimum number of cores is calculated, and the minimum number of cores is rounded up to obtain the target number of CPU cores:

[0067]

[0068] Among them, m is the minimum number of cores, P is the preset probability, and K is the average load of the CPU.

[0069] This embodiment introduces a preset probability and combines the above average load to calculate the minimum number of CPU cores required for the OVS process to run normally under non-full core conditions through the Poisson distribution formula. The specific content of the preset probability has been described in the above S202 and will not be repeated here.

[0070] In some embodiments, for some important OVS processes, CPU core allocation redundancy is introduced, and the result of multiplying the above target number of CPU cores by the CPU core allocation redundancy is used as the final target number of CPU cores. The CPU core allocation redundancy can be pre-set by the aforementioned configuration device. For example, the value of the CPU core allocation redundancy can be set to 1.2. When the CPU core allocation redundancy needs to be adjusted, it can be automatically adjusted by the correction coefficient. The correction coefficient can be pre-set by the aforementioned configuration device. For example, the value of the correction coefficient of the CPU core allocation redundancy can be set to 0.96. In this way, it is ensured that important OVS processes have as many CPU cores as possible for processing.

[0071] In order to determine the reasonable number of CPU cores to be allocated for the current OVS process. Figure 4 As shown, the aforementioned S203 may include the following steps: S2031 to S2034.

[0072] S2031: Determine whether the target number of CPU cores is between the maximum preset number of CPU allocated cores and the minimum preset number of CPU allocated cores.

[0073] If the target number of CPU cores is not between the maximum preset number of CPU allocated cores and the minimum preset number of CPU allocated cores, execute S2032 and S2033;

[0074] When the target number of CPU cores is between the maximum preset number of CPU allocated cores and the minimum preset number of CPU allocated cores, S2034 is executed.

[0075] S2032: When the target number of CPU cores is greater than the maximum preset number of CPU allocated cores, determine that the number of CPU cores allocated to the OVS process is the maximum preset number of CPU allocated cores.

[0076] In some embodiments, when the target number of CPU cores is greater than the maximum preset number of CPU allocated cores, the number of CPU cores allocated to the OVS process is determined to be the maximum preset number of CPU allocated cores, and a first warning message is sent to the aforementioned operation management platform. When the number of CPU cores allocated to the current OVS process is equal to the maximum preset number of CPU allocated cores, it indicates that the probability of the current OVS process running at full load on all currently allocated CPU cores is very high, and the operation management platform needs to notify relevant maintenance personnel to intervene, conduct specific analysis, or wait for migration through upper-level business.

[0077] S2033: When the target number of CPU cores is less than the minimum preset number of CPU cores to be allocated, the information of the allocated CPU cores allocated to the OVS process is kept unchanged.

[0078] In some embodiments, when the target number of CPU cores is less than the minimum preset number of CPU allocated cores, the information of the allocated CPU cores allocated to the OVS process is kept unchanged, and a second warning message is sent to the aforementioned operation management platform. When the target number of CPU cores is less than the minimum preset number of CPU allocated cores, that is, the number of CPU cores currently to be allocated to the OVS process is very small, indicating that the current OVS process is almost not running. In this case, the OVS process may be hung or have other problems, and the operation management platform needs to notify relevant maintenance personnel to intervene and conduct specific analysis.

[0079] In some embodiments, the maximum preset number of CPU cores allocated and the minimum preset number of CPU cores allocated can be preset based on system performance through the aforementioned configuration device. When the maximum preset number of CPU cores allocated and the minimum preset number of CPU cores allocated need to be adjusted, they can be automatically adjusted through a correction coefficient, which can be preset through the aforementioned configuration device. For example, the value of the correction coefficient of the maximum preset number of CPU cores allocated and the minimum preset number of CPU cores allocated can be set to 0.96.

[0080] S2034: Determine that the number of CPU cores allocated to the OVS process is the target number of CPU cores.

[0081] When the target number of CPU cores is between the maximum preset number of CPU allocated cores and the minimum preset number of CPU allocated cores, it indicates that the current OVS process is running normally without any abnormality.

[0082] Through this embodiment, it is possible to determine a reasonable number of CPU cores to be allocated for the current OVS process, and to monitor the status of the OVS process in real time, so that abnormal conditions can be discovered and processed in a timely manner.

[0083] In order to allocate the OVS process to a reasonable CPU node so that the OVS process can run normally, the aforementioned S203 may also include the following steps: S2035 to S2039.

[0084] S2035: Determine whether the target number of CPU cores is greater than the number of idle CPU cores on the first node.

[0085] The allocated CPU core information includes the first node where the allocated CPU core is located, and the target CPU core information includes the node where the expected CPU core is located.

[0086] If the target number of CPU cores is not greater than the number of idle CPU cores on the first node, execute S2036;

[0087] When the target number of CPU cores is greater than the number of idle CPU cores on the first node, execute S2037;

[0088] S2036: Determine that the node where the expected CPU core is located is the first node.

[0089] When the target number of CPU cores is not greater than the number of idle CPU cores on the first node, the OVS process is preferentially allocated to the same node as the first node where the allocated CPU core is located. In this case, the OVS process is bound to the target CPU core at the fastest speed, thus reducing the time required to bind the OVS process to the target CPU core.

[0090] S2037: Determine whether there is a second node whose number of idle CPU cores is greater than or equal to the target number of CPU cores.

[0091] If there is a second node where the number of idle CPU cores is greater than or equal to the target number of CPU cores, execute S2038;

[0092] If there is no second node whose number of idle CPU cores is greater than or equal to the target number of CPU cores, execute S2039.

[0093] S2038: Determine that the node where the expected CPU core is located is the second node.

[0094] When the target number of CPU cores is greater than the number of idle CPU cores on the first node, and there is a second node whose idle CPU cores are greater than or equal to the target number of CPU cores, the OVS process is preferentially allocated completely to the second node outside the first node. In this case, the speed at which the OVS process binds to the target CPU core is relatively fast.

[0095] S2039: Determine that the nodes where the expected CPU core is located are multiple third nodes.

[0096] Among them, the number of idle CPU cores on multiple third nodes is greater than or equal to the target number of CPU cores, that is, the OVS process is split and allocated to multiple third nodes outside the first node, so that the OVS process can run normally.

[0097] Through this embodiment, the OVS process is allocated to a reasonable CPU node, so that the OVS process can run normally, and the time for the OVS process to be allocated to the CPU node is reduced as much as possible, thereby improving the efficiency of resource allocation.

[0098] Based on the resource allocation method provided in the above embodiment, the present application also provides a specific implementation of the resource allocation device.

[0099] See the following examples.

[0100] See first Figure 6 , the resource allocation device 600 provided in the embodiment of the present application may include:

[0101] The acquisition module 601 is used to acquire the CPU load information of the virtual switch OVS process collected in N collection cycles within D target time lengths and the allocated CPU core information allocated to the OVS process; D and N are positive integers greater than or equal to 1;

[0102] The processing module 602 is used to process the CPU load information through the CPU core elastic allocation algorithm to obtain the target CPU core information expected to be allocated to the OVS process; the target CPU core information includes at least the target CPU core number, which is the minimum number of cores when the CPU full load probability of the OVS process running on the allocated CPU core is less than the preset probability;

[0103] The allocation module 603 is used to reallocate the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information.

[0104] The information resource allocation device 600 provided in the embodiment of the present application obtains the CPU load information of the virtual switch OVS process collected within N collection cycles within D target durations through the acquisition module 601, and then processes the CPU load information according to the CPU core elastic allocation algorithm through the processing module 602 to obtain the target CPU core information expected to be allocated to the OVS process, and finally through the allocation module 603, the CPU core resources of the OVS process are reallocated according to the allocated CPU core information and the target CPU core information. In this way, the embodiment of the present application can allocate CPU cores to the OVS process according to the CPU load information of the OVS process. And the allocation of CPU cores is achieved through the CPU core elastic allocation algorithm, so the embodiment of the present application avoids problems such as waste or insufficient resource allocation caused by artificial allocation of CPU cores. Moreover, the embodiment of the present application can allocate resources according to the real-time load information of the CPU, without waiting until the CPU is fully loaded before allocation, so the embodiment of the present application solves the hysteresis problem of existing resource allocation and improves the timeliness of resource allocation.

[0105] In order to more accurately obtain the number of CPU cores expected to be allocated to the OVS process, as an implementation of the present application, the aforementioned processing module 602 may include:

[0106] The first calculation submodule is used to calculate the average load according to the CPU load information in N collection cycles within D target durations;

[0107] The second calculation submodule is used to calculate the minimum number of cores when the probability of full load of the CPU running on the average load of the OVS process is less than the preset probability according to the Poisson distribution, the average load and the preset probability, and obtain the target number of CPU cores.

[0108] In order to more accurately represent the activity level of the CPU load of the OVS process in the recent period of time, thereby calculating the average load of the CPU load, as an implementation of the present application, the aforementioned first calculation submodule may include:

[0109] A first calculation unit is used to calculate the CPU load activity level within the target duration for each target duration according to the CPU load information within N acquisition cycles within the target duration;

[0110] The second calculation unit is used to calculate the average load of the CPU load according to the D CPU load activity levels.

[0111] In order to more accurately determine the activity level of the CPU load of the OVS process in the recent period, thereby reducing the impact of certain abnormal changes on the target number of CPU cores that should be allocated to the OVS process in subsequent calculation and analysis, as an implementation of the present application, the aforementioned second calculation unit may include:

[0112] The calculation subunit is used to calculate the average load of the CPU load according to the following formula and the D CPU load activity levels:

[0113]

[0114] Where K is the average load of the CPU load, X i is the average load in the i-th collection cycle, and i is an integer less than or equal to D.

[0115] In order to accurately obtain the minimum number of CPU cores that need to be allocated for the normal operation of the OVS process when the cores are not full, so that the OVS process can operate normally, as an implementation method of the present application, the aforementioned second computing submodule may include:

[0116] The third calculation unit is used to calculate the minimum number of cores according to the following formula, the average load and the preset probability, and round up the minimum number of cores to obtain the target number of CPU cores:

[0117]

[0118] Wherein, m is the minimum number of cores, and P is the preset probability.

[0119] In order to determine a reasonable number of CPU cores to be allocated to the current OVS process, as an implementation of the present application, the aforementioned allocation module 603 may include:

[0120] The first determination submodule is used to determine the number of CPU cores allocated to the OVS process as the maximum preset number of CPU allocated cores when the target number of CPU cores is greater than the maximum preset number of CPU allocated cores;

[0121] The maintenance submodule is used to keep the allocated CPU core information allocated to the OVS process unchanged when the target CPU core number is less than the minimum preset CPU allocation core number;

[0122] The second determination submodule is used to determine the number of CPU cores allocated by the OVS process as the target number of CPU cores when the target number of CPU cores is between the maximum preset number of CPU allocated cores and the minimum preset number of CPU allocated cores.

[0123] In order to allocate the OVS process to a reasonable CPU node so that the OVS process can run normally, as an implementation of the present application, the aforementioned allocation module 603 may also include:

[0124] A third determination submodule is used to determine that the node where the expected CPU core is located is the first node when the target number of CPU cores is not greater than the number of idle CPU cores on the first node;

[0125] A fourth determination submodule is used to determine that the node where the expected CPU core is located is the second node when the target number of CPU cores is greater than the number of idle CPU cores on the first node and there is a second node whose number of idle CPU cores is greater than or equal to the target number of CPU cores;

[0126] The fifth determination submodule is used to determine that the nodes where the expected CPU cores are located are multiple third nodes, and the number of idle CPU cores on the multiple third nodes is greater than or equal to the target number of CPU cores when the target number of CPU cores is greater than the number of idle CPU cores on the first node and there is no second node whose number of idle CPU cores is greater than or equal to the target number of CPU cores.

[0127] Based on the resource allocation method provided in the above embodiment, the present application also provides a specific implementation of the resource allocation device.

[0128] See the following examples.

[0129] See first Figure 7 , the resource allocation device may include a processor 701 and a memory 702 storing computer program instructions.

[0130] Specifically, the processor 701 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0131] Storage 702 may include a large capacity memory for data or instructions. By way of example and not limitation, storage 702 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In appropriate cases, storage 7302 may include removable or non-removable (or fixed) media. In appropriate cases, storage 702 may be inside or outside an integrated gateway disaster recovery device. In a specific embodiment, storage 702 is a non-volatile solid-state memory.

[0132] The memory 702 may include a read-only memory (ROM), a random access memory (RAM), a disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Therefore, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to one aspect of the present disclosure. The processor 701 implements any one of the resource allocation methods in the above-mentioned embodiments by reading and executing the computer program instructions stored in the memory 702.

[0133] In one example, the resource allocation device may further include a communication interface 703 and a bus 710. Figure 7 As shown, the processor 701, the memory 702, and the communication interface 703 are connected via a bus 710 and communicate with each other.

[0134] The communication interface 703 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0135] Bus 710 includes hardware, software or both, and the parts of online data flow billing equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front-end bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (DCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 710 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.

[0136] In addition, in combination with the resource allocation method in the above embodiment, the embodiment of the present application can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the resource allocation methods in the above embodiment is implemented.

[0137] In addition, in combination with the information resource allocation method in the above embodiment, an embodiment of the present invention may provide a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes any one of the resource allocation methods in the above embodiment.

[0138] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.

[0139] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. Programs or code segments can be stored in machine-readable media, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable media" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, RODs, flash memory, erasable RODs (ERODs), floppy disks, CD-RODs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0140] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.

[0141] Aspects of the present disclosure are described above with reference to the flowchart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field programmable logic circuit. It can also be understood that each box in the block diagram and / or flowchart and the combination of boxes in the block diagram and / or flowchart can also be implemented by dedicated hardware that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions.

[0142] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.

Claims

1. A resource allocation method, It is characterized in that The resources include central processing unit (CPU) core resources; including: Obtain the CPU load information of the virtual switch OVS process collected in N collection cycles within D target durations and the allocated CPU core information allocated to the OVS process; D and N are positive integers greater than or equal to 1; The CPU load information is processed by a CPU core elastic allocation algorithm to obtain target CPU core information expected to be allocated to the OVS process; the target CPU core information includes at least a target number of CPU cores, which is the minimum number of cores when the probability of CPU full load of the OVS process running on the allocated CPU core is less than a preset probability; Reallocate the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information.

2. The method according to claim 1, It is characterized in that N is an integer greater than or equal to 2. The CPU load information in the consecutive N collection cycles is processed by the CPU core elastic allocation algorithm to obtain the target CPU core information expected to be allocated to the OVS process, including: Calculate the average load based on the CPU load information in N collection cycles within D target durations; According to the Poisson distribution, the average load and the preset probability, the minimum number of cores when the probability of the CPU full load running on the average load of the OVS process is less than the preset probability is calculated to obtain the target number of CPU cores.

3. The method according to claim 2, It is characterized in that D is an integer greater than or equal to 2, and the calculation of the average load according to the CPU load information in N collection cycles within the D target durations includes: For each target duration, calculating the CPU load activity level within the target duration based on the CPU load information within N acquisition cycles within the target duration; According to the D CPU load activity levels, calculate the average CPU load.

4. The method according to claim 3, It is characterized in that According to the D CPU load activity levels, the average CPU load is calculated, including: The average CPU load is calculated using the following formula and the D CPU load activity levels: Where K is the average load of the CPU load, X i is the average load in the i-th collection cycle, and i is an integer less than or equal to D.

5. The method according to claim 2, It is characterized in that The step of calculating the minimum number of cores when the probability of full load of the CPU running on the average load of the OVS process is less than the preset probability according to the Poisson distribution, the average load and the preset probability, and obtaining the target number of CPU cores includes: The minimum number of cores is calculated according to the following formula, the average load, and the preset probability, and the minimum number of cores is rounded up to obtain the target number of CPU cores: Wherein, m is the minimum number of cores, and P is the preset probability.

6. The method according to claim 1, It is characterized in that Reallocating the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information, including: When the target number of CPU cores is greater than the maximum preset number of CPU allocated cores, determining the number of CPU cores allocated to the OVS process to be the maximum preset number of CPU allocated cores; When the target number of CPU cores is less than the minimum preset number of CPU cores to be allocated, the allocated CPU core information allocated to the OVS process is kept unchanged; When the target number of CPU cores is between the maximum preset number of CPU allocated cores and the minimum preset number of CPU allocated cores, the number of CPU cores allocated by the OVS process is determined to be the target number of CPU cores.

7. The method according to claim 1, It is characterized in that The allocated CPU core information includes the first node where the allocated CPU core is located, and the target CPU core information includes the node where the desired CPU core is located; The reallocating the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information also includes: When the target number of CPU cores is not greater than the number of idle CPU cores on the first node, determining the node where the expected CPU core is located as the first node; When the target number of CPU cores is greater than the number of idle CPU cores on the first node, and there is a second node whose number of idle CPU cores is greater than or equal to the target number of CPU cores, determine the node where the expected CPU core is located as the second node; When the target number of CPU cores is greater than the number of idle CPU cores on the first node, and there is no second node whose number of idle CPU cores is greater than or equal to the target number of CPU cores, the nodes where the expected CPU cores are located are determined to be multiple third nodes, and the number of idle CPU cores on the multiple third nodes is greater than or equal to the target number of CPU cores.

8. A resource allocation device, It is characterized in that The device comprises: An acquisition module is used to acquire CPU load information of a virtual switch OVS process collected within N collection cycles within D target durations and information of allocated CPU cores allocated to the OVS process; D and N are positive integers greater than or equal to 1; A processing module, configured to process the CPU load information through a CPU core elastic allocation algorithm to obtain target CPU core information expected to be allocated to the OVS process; the target CPU core information includes at least a target number of CPU cores, which is a minimum number of cores when the probability of a CPU full load running on the allocated CPU core of the OVS process is less than a preset probability; The allocation module is used to reallocate the CPU core resources of the OVS process according to the allocated CPU core information and the target CPU core information.

9. A resource allocation device, It is characterized in that The device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the resource allocation method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the resource allocation method according to any one of claims 1 to 7 is implemented.

11. A computer program product, It is characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the resource allocation method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Data processing method and device, equipment, medium and program product

    CN120353602A