Disclosure of Invention
In view of the above, the present invention provides a method, a system and related components for power capping of a server. The specific scheme is as follows:
a method of power capping of a server, comprising:
acquiring a power capping target value through a client instruction;
acquiring a current complete machine power consumption value of a server;
and comparing the power capping target value with the current complete machine power consumption value, and determining the current target level in the p-state table so that the operating system OS adjusts the current complete machine power consumption value according to the current target level.
Preferably, the step of comparing the power capping target value with the current power consumption value of the whole machine and determining the current target level in the p-state table includes:
comparing the power capping target value with the current complete machine power consumption value;
if the current power consumption value of the whole machine is smaller than the power capping target value, the current target level in the p-state table is increased by one level;
if the current power consumption value of the whole machine is larger than the power capping target value, the current target level is reduced by one level;
the higher the power level number in the p-state table is, the larger the power value corresponding to the two ends of the power level is.
Preferably, if the current power consumption value of the whole machine is smaller than the power capping target value, the process of increasing the current target level in the p-state table by one level includes:
if the current power consumption value of the whole machine is smaller than the power capping target value, a first level adjusting signal is sent to the CPU through a first signal end so as to increase the current target level in the p-state table by one level;
correspondingly, if the current power consumption value of the whole machine is greater than the power capping target value, the process of lowering the current target level by one level comprises the following steps:
and if the current power consumption value of the whole machine is larger than the power capping target value, sending a second level adjusting signal to the CPU through a second signal end so as to lower the current target level by one level.
Preferably, the first signal terminal and the second signal terminal are both GPIO signal terminals.
Preferably, the step of comparing the power capping target value with the current power consumption value of the whole machine and determining the current target level in the p-state table includes:
calculating the difference between the power capping target value and the current complete machine power consumption value;
determining the number of stages to be adjusted and the direction to be adjusted according to the difference;
and adjusting the current target level in the p-state table according to the stage number to be adjusted and the direction to be adjusted.
Preferably, the step of comparing the power capping target value with the current power consumption value of the whole machine and determining the current target level in the p-state table includes:
and comparing the power capping target value with the current complete machine power consumption value through the CPU, and determining the current target level in the p-state table.
Preferably, the process of obtaining the current overall power consumption value of the server includes:
and acquiring the current complete machine power consumption value of the server according to the preset frequency.
Correspondingly, this application still discloses a power capping system of server, includes:
the first data module is used for acquiring a power capping target value through a client instruction;
the second data module is used for acquiring the current overall power consumption value of the server;
and the action module is used for comparing the power capping target value with the current complete machine power consumption value and determining the current target level in the p-state table so as to enable the operating system OS to adjust the current complete machine power consumption value according to the current target level.
Correspondingly, this application still discloses a power capping device of server, includes:
a memory for storing a computer program;
a processor for implementing the steps of the power capping method of the server as claimed in any one of the above when executing the computer program.
Accordingly, the present application also discloses a readable storage medium having stored thereon a computer program which, when being executed by a processor, realizes the steps of the power capping method of the server according to any of the above.
The application discloses a power capping method of a server, which comprises the following steps: acquiring a power capping target value through a client instruction; acquiring a current complete machine power consumption value of a server; and comparing the power capping target value with the current complete machine power consumption value, and determining the current target level in the p-state table so that the operating system OS adjusts the current complete machine power consumption value according to the current target level. The method and the device determine the current target level through the comparison relationship between the power capping target value and the current power consumption value of the whole machine, and achieve the effect of adjusting the power consumption value of the whole machine by utilizing the characteristic that the operating system OS operates according to the target level. The scheme realizes the power capping of the server through dynamic adjustment, and the method is simple and rapid and has high adjusting efficiency.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The public version design of the domestic CPU is simple, a specific algorithm related to power control is not provided, and the problem of power capping function loss exists. The method and the device determine the current target level through the comparison relationship between the power capping target value and the current power consumption value of the whole machine, and achieve the effect of adjusting the power consumption value of the whole machine by utilizing the characteristic that the operating system OS operates according to the target level. The scheme realizes the power capping of the server through dynamic adjustment, and the method is simple and rapid and has high adjusting efficiency.
The embodiment of the invention discloses a power capping method of a server, which is shown in a figure 1 and comprises the following steps:
s1: acquiring a power capping target value through a client instruction;
that is, the power capping target value does not change frequently, and is updated only when a client command is received.
S2: acquiring a current complete machine power consumption value of a server;
s3: and comparing the power capping target value with the current complete machine power consumption value, and determining the current target level in the p-state table so that the operating system OS adjusts the current complete machine power consumption value according to the current target level.
It is understood that the execution subject of this embodiment is typically BMC, wherein the client instruction is specifically power policy, which includes the power capping target value, and the current overall power consumption value of the server is typically sent to BMC by PSU through PMBUS.
It can be understood that the p-state table comprises a plurality of power levels, and the higher the number of the power levels is, the larger the corresponding power value at the two ends of the power meter is. A certain power level in a p-state table can be selected as a target level in the CPU, and based on the working characteristics of an Operating System (OS), the OS can adjust the overall power consumption of the server according to the target level. If the power capping target value is not the upper limit value of the target level, the adjusted power consumption value of the whole machine still does not correspond to the power capping target value, and in general, the BMC continuously executes steps S1-S3 of the power capping method, especially step S2, and the process of obtaining the current power consumption value of the whole machine of the server includes obtaining the current power consumption value of the whole machine of the server according to a preset frequency, and step S3 is executed after step S2, where the power consumption value of the whole machine of the server is in dynamic fluctuation in the whole adjustment process, and the average power consumption of the server can achieve the effect of approximating the power capping target value.
The embodiment of the application discloses a power capping method for a server, which comprises the following steps: acquiring a power capping target value through a client instruction; acquiring a current complete machine power consumption value of a server; and comparing the power capping target value with the current complete machine power consumption value, and determining the current target level in the p-state table so that the operating system OS adjusts the current complete machine power consumption value according to the current target level. The method and the device determine the current target level through the comparison relationship between the power capping target value and the current power consumption value of the whole machine, and achieve the effect of adjusting the power consumption value of the whole machine by utilizing the characteristic that the operating system OS operates according to the target level. The scheme realizes the power capping of the server through dynamic adjustment, and the method is simple and rapid and has high adjusting efficiency.
The embodiment of the invention discloses a specific power capping method for a server, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme.
Specifically, the process of comparing the power capping target value with the current power consumption value of the whole machine and determining the current target level in the p-state table includes:
comparing the power capping target value with the current complete machine power consumption value;
if the current power consumption value of the whole machine is smaller than the power capping target value, the current target level in the p-state table is increased by one level;
if the current power consumption value of the whole machine is larger than the power capping target value, the current target level is reduced by one level;
wherein, the higher the power level number in the p-state table is, the larger the power value corresponding to the two ends of the power level is.
Furthermore, if the current power consumption value of the whole machine is smaller than the power capping target value, the process of increasing the current target level in the p-state table by one level comprises the following steps:
if the current power consumption value of the whole machine is smaller than the power capping target value, a first level adjusting signal is sent to the CPU through a first signal end so as to increase the current target level in the p-state table by one level;
correspondingly, if the current power consumption value of the whole machine is greater than the power capping target value, the current target level is reduced by one level, and the process comprises the following steps:
and if the current power consumption value of the whole machine is larger than the power capping target value, sending a second level adjusting signal to the CPU through a second signal end so as to lower the current target level by one level.
Generally, the first signal terminal and the second signal terminal are both GPIO signal terminals.
That is to say, the embodiment is still executed by the BMC, two paths exist between the BMC and the CPU, when the target level is to be adjusted higher, the first signal end sends the first level adjustment signal to the CPU, and the current target level of the p-state table in the CPU is adjusted higher by one level, and when the target level is to be adjusted lower, the second signal end sends the second level adjustment signal to the CPU, and the current target level of the p-state table in the CPU is adjusted lower by one level. The adjustment adopts simpler judgment basis and adjustment mode, the process is quick, but the adjustment can not be carried out at one time, and the ideal effect can be achieved only by multiple times of adjustment.
The embodiment of the invention discloses a specific power capping method for a server, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme.
Specifically, the process of comparing the power capping target value with the current power consumption value of the whole machine and determining the current target level in the p-state table includes:
calculating the difference between the power capping target value and the current complete machine power consumption value;
determining the number of stages to be adjusted and the direction to be adjusted according to the difference;
and adjusting the current target level in the p-state table according to the number of the levels to be adjusted and the direction to be adjusted.
It can be understood that, in this embodiment, the actions of determining the number of stages to be tuned, the direction to be tuned, and adjusting the current target stage may be all implemented by the BMC, and only an instruction for updating the current target stage is sent to the CPU, or all implemented by the CPU, that is, the CPU compares the power capping target value with the current power consumption value of the overall device, and determines the current target stage in the p-state table, or may be partially implemented by the BMC, or partially implemented by the CPU, and the specific execution main body allocation may be determined according to the processing capability and the communication cheapness of the BMC and the CPU.
Correspondingly, the embodiment of the present application further discloses a power capping system of a server, as shown in fig. 2, including:
the first data module 01 is used for acquiring a power capping target value through a client instruction;
the second data module 02 is used for acquiring the current overall power consumption value of the server;
and the action module 03 is configured to compare the power capping target value with a current complete machine power consumption value, and determine a current target level in the p-state table, so that the operating system OS adjusts the current complete machine power consumption value according to the current target level.
According to the embodiment of the application, the current target level is determined through the comparison relation between the power capping target value and the current power consumption value of the whole machine, and the effect of adjusting the power consumption value of the whole machine is achieved by utilizing the characteristic that the operating system OS operates according to the target level. The scheme realizes the power capping of the server through dynamic adjustment, and the method is simple and rapid and has high adjusting efficiency.
In some specific embodiments, the action module 03 is specifically configured to:
comparing the power capping target value with the current complete machine power consumption value;
if the current power consumption value of the whole machine is smaller than the power capping target value, the current target level in the p-state table is increased by one level;
if the current power consumption value of the whole machine is larger than the power capping target value, the current target level is reduced by one level;
the higher the power level number in the p-state table is, the larger the power value corresponding to the two ends of the power level is.
In some specific embodiments, the action module 03 is specifically configured to:
if the current power consumption value of the whole machine is smaller than the power capping target value, a first level adjusting signal is sent to the CPU through a first signal end so as to increase the current target level in the p-state table by one level;
in some specific embodiments, the action module 03 is further specifically configured to:
and if the current power consumption value of the whole machine is larger than the power capping target value, sending a second level adjusting signal to the CPU through a second signal end so as to lower the current target level by one level.
In some specific embodiments, the first signal terminal and the second signal terminal are both GPIO signal terminals.
In some specific embodiments, the action module 03 is specifically configured to:
calculating the difference between the power capping target value and the current complete machine power consumption value;
determining the number of stages to be adjusted and the direction to be adjusted according to the difference;
and adjusting the current target level in the p-state table according to the stage number to be adjusted and the direction to be adjusted.
In some specific embodiments, the action module 03 is specifically configured to:
and comparing the power capping target value with the current complete machine power consumption value through the CPU, and determining the current target level in the p-state table.
In some specific embodiments, the second data module 02 is specifically configured to:
and acquiring the current complete machine power consumption value of the server according to the preset frequency.
Correspondingly, the embodiment of the application also discloses a power capping device of the server, which is shown in fig. 3 and includes a processor 11 and a memory 12; wherein the processing 11 implements the following steps when executing the computer program stored in the memory 12:
acquiring a power capping target value through a client instruction;
acquiring a current complete machine power consumption value of a server;
and comparing the power capping target value with the current complete machine power consumption value, and determining the current target level in the p-state table so that the operating system OS adjusts the current complete machine power consumption value according to the current target level.
According to the embodiment of the application, the current target level is determined through the comparison relation between the power capping target value and the current power consumption value of the whole machine, and the effect of adjusting the power consumption value of the whole machine is achieved by utilizing the characteristic that the operating system OS operates according to the target level. The scheme realizes the power capping of the server through dynamic adjustment, and the method is simple and rapid and has high adjusting efficiency.
In some specific embodiments, when the processor 11 executes the computer subprogram stored in the memory 12, the following steps may be specifically implemented:
comparing the power capping target value with the current complete machine power consumption value;
if the current power consumption value of the whole machine is smaller than the power capping target value, the current target level in the p-state table is increased by one level;
if the current power consumption value of the whole machine is larger than the power capping target value, the current target level is reduced by one level;
the higher the power level number in the p-state table is, the larger the power value corresponding to the two ends of the power level is.
In some specific embodiments, when the processor 11 executes the computer subprogram stored in the memory 12, the following steps may be specifically implemented:
if the current power consumption value of the whole machine is smaller than the power capping target value, a first level adjusting signal is sent to the CPU through a first signal end so as to increase the current target level in the p-state table by one level;
in some specific embodiments, when the processor 11 executes the computer subprogram stored in the memory 12, the following steps may be specifically implemented:
and if the current power consumption value of the whole machine is larger than the power capping target value, sending a second level adjusting signal to the CPU through a second signal end so as to lower the current target level by one level.
In some specific embodiments, the first signal terminal and the second signal terminal are both GPIO signal terminals.
In some specific embodiments, when the processor 11 executes the computer subprogram stored in the memory 12, the following steps may be specifically implemented:
calculating the difference between the power capping target value and the current complete machine power consumption value;
determining the number of stages to be adjusted and the direction to be adjusted according to the difference;
and adjusting the current target level in the p-state table according to the stage number to be adjusted and the direction to be adjusted.
In some specific embodiments, when the processor 11 executes the computer subprogram stored in the memory 12, the following steps may be specifically implemented:
and comparing the power capping target value with the current complete machine power consumption value through the CPU, and determining the current target level in the p-state table.
In some specific embodiments, when the processor 11 executes the computer subprogram stored in the memory 12, the following steps may be specifically implemented:
and acquiring the current complete machine power consumption value of the server according to the preset frequency.
Further, the power capping device of the server in this embodiment may further include:
the input interface 13 is configured to obtain a computer program imported from the outside, store the obtained computer program in the memory 12, and also be configured to obtain various instructions and parameters transmitted by an external terminal device, and transmit the instructions and parameters to the processor 11, so that the processor 11 performs corresponding processing by using the instructions and parameters. In this embodiment, the input interface 13 may specifically include, but is not limited to, a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, and the like.
And an output interface 14, configured to output various data generated by the processor 11 to a terminal device connected thereto, so that other terminal devices connected to the output interface 14 can acquire various data generated by the processor 11. In this embodiment, the output interface 14 may specifically include, but is not limited to, a USB interface, a serial interface, and the like.
And the communication unit 15 is used for establishing a remote communication connection between the power capping device of the server and the external server so that the power capping device of the server can mount the image file into the external server. In this embodiment, the communication unit 15 may specifically include, but is not limited to, a remote communication unit based on a wireless communication technology or a wired communication technology.
And the keyboard 16 is used for acquiring various parameter data or instructions input by a user through real-time key cap knocking.
And the display 17 is used for displaying relevant information of the power capping process of the server in real time so as to facilitate a user to know the power capping condition in time.
The mouse 18 may be used to assist the user in entering data and to simplify the user's operation.
Further, embodiments of the present application also disclose a readable storage medium, where the readable storage medium includes Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable hard disk, CD-ROM, or any other form of storage medium known in the art. The readable storage medium has stored therein a computer program which, when executed by a processor, performs the steps of:
according to the embodiment of the application, the current target level is determined through the comparison relation between the power capping target value and the current power consumption value of the whole machine, and the effect of adjusting the power consumption value of the whole machine is achieved by utilizing the characteristic that the operating system OS operates according to the target level. The scheme realizes the power capping of the server through dynamic adjustment, and the method is simple and rapid and has high adjusting efficiency.
In some specific embodiments, when executed by a processor, the computer sub-program stored in the readable storage medium may specifically implement the following steps:
comparing the power capping target value with the current complete machine power consumption value;
if the current power consumption value of the whole machine is smaller than the power capping target value, the current target level in the p-state table is increased by one level;
if the current power consumption value of the whole machine is larger than the power capping target value, the current target level is reduced by one level;
the higher the power level number in the p-state table is, the larger the power value corresponding to the two ends of the power level is.
In some specific embodiments, when executed by a processor, the computer sub-program stored in the readable storage medium may specifically implement the following steps:
if the current power consumption value of the whole machine is smaller than the power capping target value, a first level adjusting signal is sent to the CPU through a first signal end so as to increase the current target level in the p-state table by one level;
in some specific embodiments, when executed by a processor, the computer sub-program stored in the readable storage medium may specifically implement the following steps:
and if the current power consumption value of the whole machine is larger than the power capping target value, sending a second level adjusting signal to the CPU through a second signal end so as to lower the current target level by one level.
In some specific embodiments, the first signal terminal and the second signal terminal are both GPIO signal terminals.
In some specific embodiments, when executed by a processor, the computer sub-program stored in the readable storage medium may specifically implement the following steps:
calculating the difference between the power capping target value and the current complete machine power consumption value;
determining the number of stages to be adjusted and the direction to be adjusted according to the difference;
and adjusting the current target level in the p-state table according to the stage number to be adjusted and the direction to be adjusted.
In some specific embodiments, when executed by a processor, the computer sub-program stored in the readable storage medium may specifically implement the following steps:
and comparing the power capping target value with the current complete machine power consumption value through the CPU, and determining the current target level in the p-state table.
In some specific embodiments, when executed by a processor, the computer sub-program stored in the readable storage medium may specifically implement the following steps:
and acquiring the current complete machine power consumption value of the server according to the preset frequency.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above detailed description is provided for the power capping method, system and related components of the server, and the specific examples are applied herein to explain the principles and embodiments of the present invention, and the descriptions of the above embodiments are only used to help understand the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.