Cloud host CPU frequency setting method, system, electronic device and storage medium

By obtaining the host's physical CPU frequency range and current frequency, determining the virtual CPU frequency range of the cloud host and setting limit values, the problem of cloud hosts competing for physical CPU resources in the cloud platform is solved, and the stability of the cloud platform is improved.

CN112162853BActive Publication Date: 2025-02-14BEIJING INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010989095.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-09-18
Publication Date
2025-02-14
Estimated Expiration
2040-09-18

AI Technical Summary

Technical Problem

In the cloud platform, multiple cloud hosts on the host compete for physical CPU resources, which affects the stability of the cloud platform.

Method used

By obtaining the host's physical CPU frequency range and current frequency, determine the virtual CPU frequency range of the cloud host and set the virtual CPU frequency limit value. Use the current frequency of the physical CPU and the virtual CPU frequency limit value to calculate the time parameters, and update the cloud host XML file through the OpenStack API interface to set the maximum frequency of the virtual CPU.

Benefits of technology

It effectively limits the virtual CPU frequency of cloud hosts, avoids resource competition, and improves the stability of the cloud platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112162853B_ABST
    Figure CN112162853B_ABST
Patent Text Reader

Abstract

The present application discloses a method for setting the CPU frequency of a cloud host, which includes: obtaining the physical CPU frequency range and the current frequency of the physical CPU of the host; determining the virtual CPU frequency range of the cloud host according to the physical CPU frequency range; setting the virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range, and calculating the time parameter using the current frequency of the physical CPU and the virtual CPU frequency limit value; updating the time parameter to the cloud host XML file through the API interface of OpenStack, so as to use the time parameter to set the maximum frequency of each virtual CPU in the cloud host. The present application can limit the virtual CPU frequency of the cloud host and improve the stability of the cloud platform. The present application also discloses a cloud host CPU frequency setting system, an electronic device and a storage medium, which have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a cloud host CPU frequency setting method and system, an electronic device and a storage medium. Background Art

[0002] With the rapid development of science and technology, cloud computing technology plays an important role in the development of society and science and technology. Cloud computing technology is the result of the hybrid evolution and leap of computer technologies such as distributed computing, utility computing, load balancing, parallel computing, network storage, hot backup redundancy and virtualization.

[0003] The allocation of physical CPU resources on a cloud platform is a key factor affecting the stability of the cloud platform. In related technologies, physical CPU resources on a host machine are usually allocated based on the resource requirements of the cloud host. However, when multiple cloud hosts on a host machine have high physical CPU resource requirements, competition for physical CPU resources will occur between the original hosts, affecting the stability of the cloud platform.

[0004] Therefore, how to limit the virtual CPU frequency of the cloud host and improve the stability of the cloud platform is a technical problem that technical personnel in this field currently need to solve. Summary of the invention

[0005] The purpose of this application is to provide a cloud host CPU frequency setting method, system, electronic device and storage medium, which can limit the virtual CPU frequency of the cloud host and improve the stability of the cloud platform.

[0006] In order to solve the above technical problems, the present application provides a cloud host CPU frequency setting method, the cloud host CPU frequency setting method comprising:

[0007] Get the physical CPU frequency range and current physical CPU frequency of the host machine;

[0008] Determine the virtual CPU frequency range of the cloud host according to the physical CPU frequency range;

[0009] The virtual CPU frequency limit value of the cloud host is set according to the virtual CPU frequency range, and a time parameter is calculated using the current frequency of the physical CPU and the virtual CPU frequency limit value; wherein the time parameter includes the time that the cloud host occupies the physical CPU of the host machine per unit time;

[0010] The time parameters are updated to the cloud host XML file through the API interface of OpenStack, so as to use the time parameters to set the maximum frequency of each virtual CPU in the cloud host.

[0011] Optionally, determining the virtual CPU frequency range of the cloud host according to the physical CPU frequency range includes:

[0012] Determine a physical CPU maximum frequency and a physical CPU minimum frequency according to the physical CPU frequency range;

[0013] The product of the number of virtual CPUs of the cloud host and the maximum frequency of the physical CPU is used as the maximum frequency of the virtual CPU of the cloud host;

[0014] The product of the number of virtual CPUs of the cloud host and the minimum frequency of the physical CPU is used as the minimum frequency of the virtual CPU of the cloud host;

[0015] The virtual CPU frequency range of the cloud host is determined according to the virtual CPU maximum frequency and the virtual CPU minimum frequency.

[0016] Optionally, setting a virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range includes:

[0017] Returning the virtual CPU frequency range to a parameter configuration interface through the OpenStack API interface;

[0018] Receiving a target CPU frequency limit value input by a user on the parameter configuration interface;

[0019] Determine whether the target CPU frequency limit value is within the virtual CPU frequency range;

[0020] If yes, setting the target CPU frequency limit value to the virtual CPU frequency limit value of the cloud host;

[0021] If not, a prompt message indicating that the parameter input is incorrect is generated.

[0022] Optionally, calculating the time parameter using the current frequency of the physical CPU and the frequency limit value of the virtual CPU includes:

[0023] Calculate the time parameter T using a preset formula;

[0024] Among them, the preset formula is A is the virtual CPU frequency limit value, B is the unit time, C is the number of virtual CPUs of the cloud host, and D is the current frequency of the physical CPU.

[0025] Optionally, the unit time is the unit time of process scheduling of the host machine.

[0026] Optionally, after updating the time parameter to the cloud host XML file through the OpenStack API interface, the method further includes:

[0027] Perform a hard reboot operation on the cloud host to make the time parameter effective.

[0028] Optionally, also include:

[0029] If a restriction parameter deletion instruction is received, the time parameter in the cloud host XML file is deleted;

[0030] If a restriction parameter query instruction is received, the time parameter in the cloud host XML file is displayed on a parameter configuration interface through the API interface of the OpenStack.

[0031] The present application also provides a cloud host CPU frequency setting system, which includes:

[0032] The frequency acquisition module is used to obtain the physical CPU frequency range and current physical CPU frequency of the host machine;

[0033] A frequency range setting module, used to determine the virtual CPU frequency range of the cloud host according to the physical CPU frequency range;

[0034] A parameter configuration module, used to set the virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range, and calculate the time parameter using the current frequency of the physical CPU and the virtual CPU frequency limit value; wherein the time parameter includes the time that the cloud host occupies the physical CPU of the host machine per unit time;

[0035] The frequency setting module is used to update the time parameter to the cloud host XML file through the API interface of OpenStack, so as to use the time parameter to set the maximum frequency of each virtual CPU in the cloud host.

[0036] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps of the above-mentioned cloud host CPU frequency setting method are implemented.

[0037] The present application also provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of the above-mentioned cloud host CPU frequency setting method are implemented.

[0038] The present application provides a method for setting the CPU frequency of a cloud host, comprising obtaining a physical CPU frequency range and a current physical CPU frequency of a host machine; determining a virtual CPU frequency range of a cloud host according to the physical CPU frequency range; setting a virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range, and calculating a time parameter using the physical CPU current frequency and the virtual CPU frequency limit value; wherein the time parameter includes the time that the cloud host occupies the physical CPU of the host machine per unit time; and updating the time parameter to a cloud host XML file through an OpenStack API interface, so as to use the time parameter to set the maximum frequency of each virtual CPU in the cloud host.

[0039] After obtaining the physical CPU frequency range and the current frequency of the physical CPU of the host machine, the present application determines the virtual CPU frequency range in the cloud host based on the physical CPU frequency, so that the user can set the virtual CPU frequency limit value within the virtual CPU frequency range, so that the virtual CPU frequency of the cloud host is not higher than the virtual CPU frequency limit value during operation. Specifically, the present application calculates the time parameter by using the current frequency of the physical CPU and the virtual CPU frequency limit value to obtain the time parameter, and the time parameter includes the maximum time that the cloud host occupies the physical CPU of the host machine per unit time. The maximum frequency of each virtual CPU in the cloud host can be set by updating the time parameter to the cloud host XML file and making the time parameter effective. The present application can limit the virtual CPU frequency of the cloud host by setting the maximum time that the cloud host occupies the physical CPU of the host machine, thereby improving the stability of the cloud platform. The present application also provides a cloud host CPU frequency setting system, an electronic device and a storage medium, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A flowchart of a method for setting the CPU frequency of a cloud host provided in an embodiment of the present application;

[0042] Figure 2 A flowchart of a method for limiting the CPU frequency of a cloud host based on OpenStack provided in an embodiment of the present application;

[0043] Figure 3A schematic diagram of the structure of a cloud host CPU frequency setting system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] See below Figure 1 , Figure 1 A flowchart of a cloud host CPU frequency setting method provided in an embodiment of the present application.

[0046] Specific steps may include:

[0047] S101: Obtain the physical CPU frequency range and current physical CPU frequency of the host machine;

[0048] Among them, this embodiment can be applied to cloud platforms of X86, ARM and other architectures, and the cloud platform can provide computing, network and storage services based on hardware resources and software resources. A cloud host can be deployed on the cloud platform, and the cloud platform can run on a host machine. The physical CPU of the host machine allocates computing resources to the virtual CPU (Central Processing Unit) of the cloud host, and the host machine can allocate computing resources to any number of cloud hosts.

[0049] In this step, you can use OpenStack to run a shell script to obtain the physical CPU frequency range and physical CPU current frequency of the host. The physical CPU frequency range is the frequency range of the host's physical CPU in working state, and the physical CPU current frequency is the frequency value of the host's physical CPU at the current moment. The CPU frequency mentioned above, that is, the CPU clock frequency, refers to the working frequency of the CPU during operation, and the unit is Hz.

[0050] S102: Determine a virtual CPU frequency range of the cloud host according to the physical CPU frequency range;

[0051] Among them, the physical CPU frequency range may include the physical CPU maximum frequency and the physical CPU minimum frequency, and the virtual CPU frequency range may include the virtual CPU maximum frequency and the virtual CPU minimum frequency. Therefore, the process of determining the virtual CPU frequency range of the cloud host in this embodiment may include: determining the physical CPU maximum frequency and the physical CPU minimum frequency according to the physical CPU frequency range; taking the product of the number of virtual CPUs of the cloud host and the maximum frequency of the physical CPU as the virtual CPU maximum frequency of the cloud host; taking the product of the number of virtual CPUs of the cloud host and the minimum frequency of the physical CPU as the virtual CPU minimum frequency of the cloud host; determining the virtual CPU frequency range of the cloud host according to the virtual CPU maximum frequency and the virtual CPU minimum frequency. The virtual CPU frequency range finally determined is the frequency interval between the virtual CPU maximum frequency and the virtual CPU minimum frequency.

[0052] Furthermore, the cloud host may include any number of virtual CPUs, and the virtual CPU frequency range obtained in this step may be the total frequency range of all virtual CPUs in the cloud host.

[0053] S103: setting a virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range, and calculating a time parameter using the current frequency of the physical CPU and the virtual CPU frequency limit value;

[0054] Among them, this embodiment can display the virtual CPU frequency range to the user, so that the user can input the virtual CPU frequency limit value according to the virtual CPU frequency range. In addition, this embodiment can also select any value in the virtual CPU frequency range as the virtual CPU frequency limit value.

[0055] As a feasible implementation method, the process of calculating the time parameter using the current frequency of the physical CPU and the frequency limit value of the virtual CPU in this step can be: using a preset formula to calculate the time parameter T; wherein the preset formula is A is the virtual CPU frequency limit value, B is the unit time, C is the number of virtual CPUs of the cloud host, and D is the current frequency of the physical CPU. The above unit time is the unit time of the process scheduling of the host machine (for example, 100000 microseconds).

[0056] The time parameter calculated in this step includes the time that the cloud host occupies the physical CPU of the host machine per unit time; the longer the cloud host occupies the physical CPU of the host machine per unit time, the more physical CPU resources are allocated to the cloud host.

[0057] S104: updating the time parameter to the cloud host XML file through the API interface of OpenStack, so as to set the maximum frequency of each virtual CPU in the cloud host by using the time parameter.

[0058] Among them, OpenStack is an open source cloud computing management platform project. In this step, the original time parameters in the cloud host XML file can be deleted through the API interface of OpenStack, and the time parameters obtained in S103 can be written into the cloud host XML file, so as to use the time parameters to set the maximum frequency of each virtual CPU in the cloud host. In this embodiment, the frequency limit value of the virtual CPU in the cloud host can be set at any time using the API interface of OpenStack, which improves the flexibility of setting the virtual CPU frequency of the cloud host.

[0059] Furthermore, after the time parameter is updated to the cloud host XML file through the API interface of OpenStack, a hard restart operation may be performed on the cloud host to make the time parameter take effect.

[0060] After obtaining the physical CPU frequency range and the current frequency of the physical CPU of the host machine, this embodiment determines the virtual CPU frequency range in the cloud host based on the physical CPU frequency, so that the user can set the virtual CPU frequency limit value within the virtual CPU frequency range, so that the virtual CPU frequency of the cloud host is not higher than the virtual CPU frequency limit value during operation. Specifically, this embodiment calculates the time parameter by using the current frequency of the physical CPU and the virtual CPU frequency limit value to obtain the time parameter, and the time parameter includes the maximum time that the cloud host occupies the physical CPU of the host machine per unit time. The maximum frequency of each virtual CPU in the cloud host can be set by updating the time parameter to the cloud host XML file and making the time parameter effective. This embodiment can limit the virtual CPU frequency of the cloud host by setting the maximum time that the cloud host occupies the physical CPU of the host machine, thereby improving the stability of the cloud platform.

[0061] As for Figure 1 For further description of the corresponding embodiment, the specific process of setting the virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range may include the following steps:

[0062] Step 1: Return the virtual CPU frequency range to the parameter configuration interface through the OpenStack API interface;

[0063] Step 2: receiving a target CPU frequency limit value input by a user in the parameter configuration interface;

[0064] Step 3: Determine whether the target CPU frequency limit value is within the virtual CPU frequency range; if so, proceed to step 4; if not, proceed to step 5;

[0065] Step 4: Setting the target CPU frequency limit value as the virtual CPU frequency limit value of the cloud host;

[0066] Step 5: Generate a prompt message for parameter input errors.

[0067] The above embodiment returns the virtual CPU frequency range to the parameter configuration interface through the API interface of OpenStack, so that the user can set the virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range. Since the user may set the virtual CPU frequency limit value incorrectly, this embodiment judges the target CPU frequency limit value input by the user based on the virtual CPU frequency range. If the target CPU frequency limit value is within the virtual CPU frequency range, the target CPU frequency limit value is set as the virtual CPU frequency limit value of the cloud host; if the target CPU frequency limit value is not within the virtual CPU frequency range, a prompt message indicating that the parameter input is incorrect is generated to prompt the user to re-enter the parameter.

[0068] As for Figure 1 For further introduction to the corresponding embodiment, if a restriction parameter deletion instruction is received, the time parameter in the cloud host XML file is deleted; if a restriction parameter query instruction is received, the time parameter in the cloud host XML file is displayed to the parameter configuration interface through the OpenStack API interface.

[0069] See also Figure 2 , Figure 2 A flowchart of a method for limiting the CPU frequency of a cloud host based on OpenStack provided in an embodiment of the present application. In this embodiment, the operator can set the virtual CPU frequency limit value of the cloud host on the cloud platform to implement the cloud host CPU frequency limit operation, thereby realizing the reasonable allocation of the CPU resources of the cloud platform and avoiding the cloud host from competing for the physical CPU resources of the host machine. The larger the virtual CPU frequency limit value is set, the longer the cloud host occupies the physical CPU. This embodiment can be applied to cloud hosts of X86 and ARM architecture cloud platforms.

[0070] First, the user can start OpenStack and use the shell script to obtain the host's physical CPU current frequency CPU_HZ, physical CPU maximum frequency CPU_MAX_HZ, and physical CPU minimum frequency CPU_MIN_HZ.

[0071] According to formula 1 and formula 2, the minimum cloud host CPU limit value (i.e., the minimum frequency of the virtual CPU) and the maximum cloud host CPU limit value (i.e., the maximum frequency of the virtual CPU) of the cloud host can be determined, and then the virtual CPU frequency range can be determined according to the minimum cloud host CPU limit value and the maximum cloud host CPU limit value. Among them, formula 1 is: minimum cloud host CPU limit value = number of cloud host VCPUs * minimum frequency of host physical CPU; formula 2 is: maximum cloud host CPU limit value = number of cloud host VCPUs * maximum frequency of host physical CPU. VCPU is virtual CPU.

[0072] Operators can determine the virtual CPU frequency limit value based on the virtual CPU frequency range, and can also use the OpenStack API interface to set the virtual CPU frequency limit value of the cloud host in the cloud platform. In addition, the API interface can also implement operations such as deleting the virtual CPU frequency limit value and querying the virtual CPU frequency limit value.

[0073] After receiving the virtual CPU frequency limit value input by the operator according to the virtual CPU frequency range, this embodiment can use Formula 3 to calculate the time (i.e., time parameter) that the cloud host occupies the physical CPU of the host. Formula 3 can be: cloud host CPU cloud host occupies physical CPU time = virtual CPU frequency limit value / number of cloud host VCPUs / current physical CPU frequency * host process scheduling unit time. The unit time cpu_period of host process scheduling can be 100000 microseconds.

[0074] After the cloud host occupies the host CPU time through formula 3, the time can be updated to the cloud host XML file, and the cloud host can be hard restarted to make the ratio effective, so that the cloud host will not occupy the physical CPU time exceeding the limit, and will not participate in the competition for physical CPU resources. Specifically, in this embodiment, the cloud host can update the time cpu_quota that the cloud host occupies the host CPU to the XML file that defines the cloud host, and hard restart the cloud host to make the cloud host CPU resource limit function effective.

[0075] In addition, the operator can view the virtual CPU frequency limit value of the current cloud host through the OpenStack API interface, view the minimum and maximum cloud host CPU limits through the OpenStack API interface, delete the cloud host CPU limit value through the OpenStack API interface, and configure or modify the virtual CPU frequency limit value through the OpenStack API interface.

[0076] This embodiment proposes a method for limiting the CPU frequency of a cloud host based on OpenStack. The operator can implement the cloud host CPU frequency limiting operation by setting the virtual CPU frequency limit value on the cloud platform, thereby realizing the reasonable allocation of the cloud platform CPU resources and avoiding the cloud host from competing for the physical CPU resources of the host machine. If the limit value is not set, the time the cloud host occupies the physical CPU is determined by the process scheduling strategy of the host operating system. The larger the value is set, the longer the cloud host occupies the physical CPU. In this embodiment, the operator can set the limit on the cloud host occupying physical CPU resources through the cloud platform. The method calculates the maximum and minimum frequencies that the cloud host CPU can reach based on the maximum and minimum frequencies of the physical CPU, and reasonably configures the CPU frequency limit value of the cloud host based on this range. The method is not limited by the physical host CPU architecture and is compatible with X86, arm and other architectures. It can be seen that this embodiment can limit the virtual CPU frequency of the cloud host and improve the stability of the cloud platform.

[0077] See also Figure 3 , Figure 3 A schematic diagram of the structure of a cloud host CPU frequency setting system provided in an embodiment of the present application;

[0078] The system may include:

[0079] The frequency acquisition module 100 is used to obtain the physical CPU frequency range and the current physical CPU frequency of the host machine;

[0080] A frequency range setting module 200, used to determine a virtual CPU frequency range of a cloud host according to the physical CPU frequency range;

[0081] The parameter configuration module 300 is used to set the virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range, and calculate the time parameter using the current frequency of the physical CPU and the virtual CPU frequency limit value; wherein the time parameter includes the time that the cloud host occupies the physical CPU of the host machine per unit time;

[0082] The frequency setting module 400 is used to update the time parameter to the cloud host XML file through the API interface of OpenStack, so as to use the time parameter to set the maximum frequency of each virtual CPU in the cloud host.

[0083] After obtaining the physical CPU frequency range and the current frequency of the physical CPU of the host machine, this embodiment determines the virtual CPU frequency range in the cloud host based on the physical CPU frequency, so that the user can set the virtual CPU frequency limit value within the virtual CPU frequency range, so that the virtual CPU frequency of the cloud host is not higher than the virtual CPU frequency limit value during operation. Specifically, this embodiment calculates the time parameter by using the current frequency of the physical CPU and the virtual CPU frequency limit value to obtain the time parameter, and the time parameter includes the maximum time that the cloud host occupies the physical CPU of the host machine per unit time. The maximum frequency of each virtual CPU in the cloud host can be set by updating the time parameter to the cloud host XML file and making the time parameter effective. This embodiment can limit the virtual CPU frequency of the cloud host by setting the maximum time that the cloud host occupies the physical CPU of the host machine, thereby improving the stability of the cloud platform.

[0084] Further, the frequency range setting module 200 includes:

[0085] A physical CPU extreme frequency determination unit, used to determine a physical CPU maximum frequency and a physical CPU minimum frequency according to the physical CPU frequency range;

[0086] a virtual CPU maximum frequency determination unit, configured to use the product of the number of virtual CPUs of the cloud host and the maximum frequency of the physical CPU as the maximum frequency of the virtual CPU of the cloud host;

[0087] a virtual CPU minimum frequency determination unit, configured to use the product of the number of virtual CPUs of the cloud host and the minimum frequency of the physical CPU as the minimum frequency of the virtual CPU of the cloud host;

[0088] The virtual CPU frequency range determining unit is used to determine the virtual CPU frequency range of the cloud host according to the virtual CPU maximum frequency and the virtual CPU minimum frequency.

[0089] Furthermore, the parameter configuration module 300 includes:

[0090] A frequency parameter receiving unit is used to return the virtual CPU frequency range to the parameter configuration interface through the API interface of the OpenStack; it is also used to receive the target CPU frequency limit value input by the user in the parameter configuration interface; it is also used to determine whether the target CPU frequency limit value is within the virtual CPU frequency range; if so, the target CPU frequency limit value is set to the virtual CPU frequency limit value of the cloud host; if not, a prompt message of parameter input error is generated.

[0091] A time parameter calculation unit, used to calculate the time parameter T using a preset formula;

[0092] Among them, the preset formula is A is the virtual CPU frequency limit value, B is the unit time, C is the number of virtual CPUs of the cloud host, and D is the current frequency of the physical CPU.

[0093] Furthermore, the unit time is the unit time of the process scheduling of the host machine.

[0094] Furthermore, it also includes:

[0095] The restart module is used to perform a hard restart operation on the cloud host after updating the time parameter to the cloud host XML file through the API interface of OpenStack, so as to make the time parameter take effect.

[0096] Furthermore, it also includes:

[0097] The time parameter management module is used to delete the time parameters in the cloud host XML file if a restriction parameter deletion instruction is received; and is also used to display the time parameters in the cloud host XML file to the parameter configuration interface through the OpenStack API interface if a restriction parameter query instruction is received.

[0098] Since the embodiments of the system part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the system part, which will not be repeated here.

[0099] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0100] The present application also provides an electronic device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the electronic device may also include various network interfaces, power supplies and other components.

[0101] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. For the system disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

[0102] It should also be noted that, in this specification, 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 "comprises", "comprising" 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, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A method for setting the CPU frequency of a cloud host, characterized in that: include: Get the physical CPU frequency range and current physical CPU frequency of the host machine; Determine the virtual CPU frequency range of the cloud host according to the physical CPU frequency range; The virtual CPU frequency limit value of the cloud host is set according to the virtual CPU frequency range, and a time parameter is calculated using the current frequency of the physical CPU and the virtual CPU frequency limit value; wherein the time parameter includes the time that the cloud host occupies the physical CPU of the host machine per unit time; The time parameter is updated to the cloud host XML file through the OpenStack API interface, so as to set the maximum frequency of each virtual CPU in the cloud host using the time parameter; The time parameter is calculated by using the current frequency of the physical CPU and the frequency limit value of the virtual CPU, including: Calculate the time parameter T using a preset formula; Among them, the preset formula is A is the virtual CPU frequency limit value, B is the unit time, C is the number of virtual CPUs of the cloud host, and D is the current frequency of the physical CPU; the unit time is the unit time of the process scheduling of the host machine.

2. The method for setting the CPU frequency of a cloud host according to claim 1, characterized in that: Determining a virtual CPU frequency range of a cloud host according to the physical CPU frequency range includes: Determine a physical CPU maximum frequency and a physical CPU minimum frequency according to the physical CPU frequency range; The product of the number of virtual CPUs of the cloud host and the maximum frequency of the physical CPU is used as the maximum frequency of the virtual CPU of the cloud host; The product of the number of virtual CPUs of the cloud host and the minimum frequency of the physical CPU is used as the minimum frequency of the virtual CPU of the cloud host; The virtual CPU frequency range of the cloud host is determined according to the virtual CPU maximum frequency and the virtual CPU minimum frequency.

3. The method for setting the CPU frequency of a cloud host according to claim 1, characterized in that: Setting the virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range includes: Returning the virtual CPU frequency range to a parameter configuration interface through the OpenStack API interface; Receiving a target CPU frequency limit value input by a user on the parameter configuration interface; Determine whether the target CPU frequency limit value is within the virtual CPU frequency range; If yes, setting the target CPU frequency limit value to the virtual CPU frequency limit value of the cloud host; If not, a prompt message indicating that the parameter input is incorrect is generated.

4. The method for setting the CPU frequency of a cloud host according to claim 1, characterized in that: After updating the time parameter to the cloud host XML file through the OpenStack API interface, the following steps are also included: Perform a hard reboot operation on the cloud host to make the time parameter effective.

5. The method for setting the CPU frequency of a cloud host according to any one of claims 1 to 4, characterized in that: Also includes: If a restriction parameter deletion instruction is received, the time parameter in the cloud host XML file is deleted; If a restriction parameter query instruction is received, the time parameter in the cloud host XML file is displayed on a parameter configuration interface through the API interface of the OpenStack.

6. A cloud host CPU frequency setting system, characterized in that: include: The frequency acquisition module is used to obtain the physical CPU frequency range and current physical CPU frequency of the host machine; A frequency range setting module, used to determine the virtual CPU frequency range of the cloud host according to the physical CPU frequency range; A parameter configuration module, used to set the virtual CPU frequency limit value of the cloud host according to the virtual CPU frequency range, and calculate the time parameter using the current frequency of the physical CPU and the virtual CPU frequency limit value; wherein the time parameter includes the time that the cloud host occupies the physical CPU of the host machine per unit time; A frequency setting module, used to update the time parameter to the cloud host XML file through the OpenStack API interface, so as to set the maximum frequency of each virtual CPU in the cloud host using the time parameter; Wherein, the parameter configuration module is used to calculate the time parameter T using a preset formula; Among them, the preset formula is A is the virtual CPU frequency limit value, B is the unit time, C is the number of virtual CPUs of the cloud host, and D is the current frequency of the physical CPU; the unit time is the unit time of the process scheduling of the host machine.

7. An electronic device, characterized in that: It includes a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps of the cloud host CPU frequency setting method as described in any one of claims 1 to 5 are implemented.

8. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the cloud host CPU frequency setting method as described in any one of claims 1 to 5 above are implemented.

Citation Information

Patent Citations

  • Data center energy saving method based on central processing unit (CPU) dynamic frequency modulation technology

    CN103488539A

  • A cloud computing resource cost optimization method

    CN109710401A