A server energy consumption control method, device, server and medium
By dynamically adjusting the frequency of non-core components of the server processor, the problem of reducing server energy consumption in the prior art affects performance, and the effect of effectively reducing server energy consumption without reducing performance is achieved.
Patent Information
- Application Number
- CN202412000414.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-01
AI Technical Summary
When reducing server energy consumption, the prior art mainly relies on adjusting the frequency of the core components of the processor, resulting in a degradation of computing performance and it is difficult to effectively reduce energy consumption without affecting performance.
By obtaining the current utilization rate of the processor and the preset frequency range of non-core components, when the server is detected to be idle, the target frequency value of the processor's non-core components is determined according to the preset frequency range, and its frequency range is controlled between the minimum value of the preset frequency range and the target frequency value to reduce the server's energy consumption.
Without significantly affecting the processor performance, the energy consumption of the server is reduced, especially when the server is idle, effectively reduces the energy consumption and ensures performance in a busy state.
Smart Images

Figure CN119739532A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of server energy consumption control, and in particular to a server energy consumption control method, device, server and medium. Background Art
[0002] With the rapid development of information technology, the energy consumption of servers has become an increasingly prominent challenge. As the core component equipment for data storage and processing, servers consume a lot of energy in the computer room, and energy saving has become crucial.
[0003] Related energy consumption reduction methods mainly focus on adjusting the frequency of the core components of the processor. However, reducing the frequency of the core components of the processor will directly affect the computing performance. In some high-performance computing scenarios, this may lead to unacceptable performance degradation.
[0004] It can be seen that how to reduce the energy consumption of the server without significantly affecting the processor performance is a technical problem that people in this field urgently need to solve. Summary of the invention
[0005] The purpose of the present invention is to provide a server energy consumption control method, device, server and medium to solve the technical problem that related energy consumption reduction methods mainly focus on adjusting the frequency of processor core components, resulting in that reducing the frequency of processor core components will directly affect computing performance.
[0006] In order to solve the above technical problems, the present invention provides a server energy consumption control method, comprising:
[0007] Acquire a current utilization rate of a processor and a preset frequency range of a non-core component of the processor; wherein the processor includes a core component and a non-core component;
[0008] When it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, determine the target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range; wherein the target frequency value is greater than the minimum value of the preset frequency range and less than the maximum value of the preset frequency range;
[0009] The frequency range of the non-core components of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value, so as to control the energy consumption of the server.
[0010] On the one hand, determining the target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range includes:
[0011] Get the frequency setting coefficient of the non-core component of the processor;
[0012] Obtaining a difference between a maximum value of the preset frequency range and a minimum value of the preset frequency range;
[0013] Obtaining a product result of the difference and the frequency setting coefficient;
[0014] The target frequency value of the non-core component of the processor when the server is idle is determined according to the result of adding the minimum value of the preset frequency range and the product result.
[0015] On the other hand, before the frequency range of the non-core component of the control processor is between the minimum value of the preset frequency range and the target frequency value, the method further includes:
[0016] Starting from detecting that the current utilization is less than or equal to a preset utilization of the processor when the server is idle, determining whether the duration for which the current utilization is less than or equal to the preset utilization of the processor when the server is idle reaches a preset idle duration;
[0017] If yes, entering the step of controlling the frequency range of the non-core component of the processor to be between the minimum value of the preset frequency range and the target frequency value;
[0018] If not, then wait for a preset detection period and then return to the step of obtaining the current utilization of the processor.
[0019] On the other hand, before determining whether the duration of the current utilization being less than or equal to the preset utilization of the processor when the server is idle reaches a preset idle duration, the method further includes:
[0020] Obtaining a maximum value of a current frequency range of a non-core component of the processor;
[0021] Determining whether the maximum value of the current frequency range is the target frequency value;
[0022] If yes, then wait for a preset detection period and then return to the step of obtaining the current utilization of the processor;
[0023] If not, set the time variable;
[0024] In the case where it is detected that the value of the time variable is not empty, the initial value of the time variable is obtained, and the current time is used as the final value of the time variable, and the step of determining whether the duration of the current utilization being less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle duration;
[0025] When it is detected that the value of the time variable is empty, the current time is used as the starting value of the time variable, and after waiting for a preset detection period, the step of obtaining the current utilization of the processor is returned;
[0026] The determining whether the duration during which the current utilization is less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle duration includes:
[0027] Obtaining a time difference between the final value and the starting value;
[0028] Determining whether the time difference reaches the preset idle time length;
[0029] After the frequency range of the non-core component of the control processor is between the minimum value of the preset frequency range and the target frequency value, the method further includes:
[0030] The initial value of the time variable is adjusted to be empty, and after waiting for a preset detection period, the step of returning to the step of obtaining the current utilization of the processor is performed.
[0031] In another aspect, the method further comprises:
[0032] In the case where it is detected that the current utilization is greater than the preset utilization of the processor when the server is idle, determining whether the duration for which the current utilization is greater than the preset utilization of the processor when the server is idle is greater than a preset duration;
[0033] If so, controlling the frequency range of the non-core component of the processor to be between the target frequency value and the maximum value of the preset frequency range;
[0034] If not, the frequency range of the non-core component of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value.
[0035] On the other hand, before the frequency range of the non-core component of the control processor is between the target frequency value and the maximum value of the preset frequency range, the method further includes:
[0036] Obtaining a maximum value of a current frequency range of a non-core component of the processor;
[0037] Determining whether the maximum value of the current frequency range is the target frequency value;
[0038] If so, controlling the frequency range of the non-core component of the processor to be between the target frequency value and the maximum value of the preset frequency range;
[0039] If not, then wait for a preset detection period and then return to the step of obtaining the current utilization of the processor.
[0040] On the other hand, before obtaining the current utilization rate of the processor and the preset frequency range of the non-core component of the processor, the method further includes:
[0041] Obtaining the preset utilization rate of the processor when the server is idle, the frequency setting coefficient of the non-core components of the processor, and the preset detection cycle;
[0042] The preset utilization rate of the processor when the server is idle, the frequency setting coefficient of the non-core component of the processor and the preset detection cycle are stored in the configuration file.
[0043] In order to solve the above technical problems, the present invention further provides a server energy consumption control device, comprising:
[0044] An acquisition module, used to acquire a current utilization rate of a processor and a preset frequency range of a non-core component of the processor; wherein the processor includes a core component and a non-core component;
[0045] A determination module, configured to determine, when detecting that the current utilization is less than or equal to a preset utilization of the processor when the server is idle, a target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range; wherein the target frequency value is greater than a minimum value of the preset frequency range and less than a maximum value of the preset frequency range;
[0046] The control module is used to control the frequency range of the non-core components of the processor to be between the minimum value of the preset frequency range and the target frequency value, so as to control the energy consumption of the server.
[0047] In order to solve the above technical problem, the present invention further provides a server, comprising:
[0048] Memory for storing computer programs;
[0049] The processor is used to implement the steps of the above-mentioned server energy consumption control method when executing the computer program.
[0050] In order to solve the above technical problem, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the above server energy consumption control method are implemented.
[0051] The beneficial effect of the present invention lies in that, in the method, the current utilization of the processor and the preset frequency range of the non-core components of the processor are first obtained; then, when it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, the target frequency value of the non-core components of the processor when the server is idle is determined according to the preset frequency range; finally, the frequency range of the non-core components of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value. Compared with the method of directly reducing the frequency of the core components of the processor to reduce the energy consumption of the server, in the method provided by the present invention, the frequency of the non-core components of the processor is reduced from the maximum value of the preset frequency range to between the target frequency values, that is, the frequency of the non-core components of the processor is reduced instead of the frequency of the core components of the processor, so that the purpose of reducing the energy consumption of the server is achieved without significantly affecting the performance of the processor; moreover, in this method, the frequency of the non-core components of the processor is reduced only when it is determined that the server is idle, rather than reducing the frequency of the non-core components of the processor when the server is busy, so that the energy consumption of the server when it is idle is reduced and the performance of the server when it is busy is guaranteed as much as possible; in addition, the frequency range of the non-core components of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value, rather than controlling the frequency of the non-core components of the processor to be a fixed value, so that the frequency of the non-core components of the processor is ensured to be flexible. Adjustment.
[0052] In addition, when determining the target frequency value of the non-core component of the processor when the server is idle, the difference between the maximum value of the preset frequency range and the minimum value of the preset frequency range is obtained; the product result of the difference and the frequency setting coefficient is obtained; and the target frequency value of the non-core component of the processor when the server is idle is determined according to the result after adding the minimum value of the preset frequency range and the product result. The target frequency value of the non-core component of the processor when the server is idle is quantitatively and accurately obtained.
[0053] Before controlling the frequency range of the non-core components of the processor to be between the minimum value of the preset frequency range and the target frequency value, it is first determined whether the duration of the processor utilization when the current utilization is less than or equal to the preset server idle time has reached the preset idle time. Only when it is reached, the frequency range of the non-core components of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value, thereby achieving effective frequency reduction of the non-core components of the processor.
[0054] Before determining whether the duration during which the current utilization is less than or equal to the preset utilization of the processor when the server is idle has reached the preset idle duration, first determine whether the maximum value of the current frequency range is the target frequency value, that is, determine whether the frequency reduction operation has been performed. If the frequency has not been reduced, then further determine based on the value of the time variable and the current time whether the duration during which the current utilization is less than or equal to the preset utilization of the processor when the server is idle has reached the preset idle duration. Only when it has reached the preset idle duration is the frequency range of the non-core components of the processor controlled to be between the minimum value of the preset frequency range and the target frequency value, thereby further achieving effective frequency reduction of the non-core components of the processor.
[0055] When it is detected that the current utilization is greater than the preset utilization of the processor when the server is idle, and when it is determined that the duration of the current utilization being greater than the preset utilization of the processor when the server is idle is greater than the preset duration, the frequency range of the non-core components of the processor is controlled to be between the target frequency value and the maximum value of the preset frequency range. On the one hand, by increasing the maximum value of the frequency of the non-core components of the processor, the performance of the server when it is busy is guaranteed; on the other hand, the effective frequency increase of the non-core components of the processor is achieved.
[0056] Before controlling the frequency range of the non-core components of the processor to be between the target frequency value and the maximum value of the preset frequency range, it is first determined whether the maximum value of the current frequency range of the non-core components of the processor is the target frequency value. If so, the frequency range of the non-core components of the processor is controlled to be between the target frequency value and the maximum value of the preset frequency range, thereby further realizing effective frequency increase of the non-core components of the processor when the server is busy, thereby ensuring the performance of the server.
[0057] Before obtaining the current utilization of the processor and the preset frequency range of the processor's non-core components, the preset processor utilization when the server is idle, the frequency setting coefficient of the processor's non-core components and the preset detection period are first stored in the configuration file, thereby realizing the recording of data during server energy consumption control, which is convenient for users to view.
[0058] In addition, the present invention also provides a server energy consumption control device, a server, and a computer-readable storage medium, which have the same or corresponding technical features as the above-mentioned server energy consumption control method and have the same effects as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0060] Figure 1 A flow chart of a server energy consumption control method provided by an embodiment of the present invention;
[0061] Figure 2 A flowchart of a method for dynamically adjusting the frequency of a non-core component of a processor provided by an embodiment of the present invention;
[0062] Figure 3 A flowchart of a complete method for dynamically adjusting the frequency of a non-core component of a processor provided by an embodiment of the present invention;
[0063] Figure 4 A structural diagram of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0064] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0065] The core component of the present invention is to provide a server energy consumption control method, device, server and medium to solve the technical problem that related energy consumption reduction methods mainly focus on adjusting the frequency of processor core components, resulting in that reducing the frequency of processor core components will directly affect computing performance.
[0066] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 1 A flow chart of a server energy consumption control method provided by an embodiment of the present invention, such as Figure 1 As shown, the method includes:
[0067] S10: obtaining a current utilization rate of the processor and a preset frequency range of a non-core component of the processor;
[0068] S11: when it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, determining the target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range;
[0069] The target frequency value is greater than the minimum value of the preset frequency range and less than the maximum value of the preset frequency range;
[0070] S12: Control the frequency range of the non-core components of the processor to be between a minimum value of a preset frequency range and a target frequency value, so as to control the energy consumption of the server.
[0071] The processor includes the processor core components and the processor non-core components. The "non-core components" of the processor generally refer to other components besides the core components (Core) of the processor. These non-core components include but are not limited to: cache, integrated memory controller, fast path interconnect bus, power consumption and clock control unit and other peripheral modules. In general, non-core components refer to those components that are not directly involved in instruction execution and data processing, but are critical to the overall performance and functionality of the processor. Together, they support the operation of the core components and enable the processor to interact more efficiently with external devices and other parts of the system.
[0072] Considering that directly reducing the frequency of the processor to reduce the energy consumption of the server will directly affect the performance of the processor, and through experiments, it is known that the frequency of the non-core components of the server processor is a major factor affecting the energy consumption of the server, therefore, in the embodiments of the present invention, the purpose of reducing the energy consumption of the server is achieved by reducing the frequency of the non-core components of the processor.
[0073] The minimum value corresponding to the preset frequency range of the non-core component of the processor can be recorded as the minimum settable non-core component frequency value, and the maximum value can be recorded as the maximum settable non-core component frequency value. In order to obtain the preset frequency range of the non-core component of the processor, you can first check the non-core component module of the server and check the directory related to the non-core component frequency, such as checking the files in the / sys / devices / uncore_* / * / cpufreq / directory. The asterisk here represents the specific device and core component identifier. Here, you only need to check one directory, and then read the file that records the minimum settable non-core component frequency value (such as the scaling_min_freq file) and the file that records the maximum settable non-core component frequency value (such as the scaling_max_freq file) to obtain the preset frequency range of the non-core component of the processor.
[0074] Determine the target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range. There is no limitation on the target frequency value of the non-core component of the processor when the server is idle, as long as the target frequency value is greater than the minimum value of the preset frequency range and less than the maximum value of the preset frequency range. In order to accurately determine the target frequency value of the non-core component of the processor when the server is idle, in implementation, determining the target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range includes:
[0075] Get the frequency setting coefficient of the non-core component of the processor;
[0076] Obtaining a difference between a maximum value of a preset frequency range and a minimum value of the preset frequency range;
[0077] Get the product of the difference and the frequency setting coefficient;
[0078] The target frequency value of the non-core component of the processor when the server is idle is determined according to the result of adding the minimum value of the preset frequency range and the product result.
[0079] The value of the frequency setting coefficient of the non-core component of the processor is between 0 and 1. The frequency setting coefficient is used to calculate the target frequency value of the non-core component of the processor when the server is idle and needs to be set when the server is identified to be in an idle state. The frequency setting coefficient can be adjusted according to actual conditions.
[0080] The target frequency value of the non-core components of the processor when the server is idle is calculated as follows:
[0081] When the server is idle, the target frequency value of the non-core component of the processor = the minimum settable non-core component frequency value + (the maximum settable non-core component frequency value - the minimum settable non-core component frequency value) × the frequency setting coefficient of the non-core component of the processor.
[0082] When obtaining the preset processor utilization when the server is idle, that is, the processor utilization when the server is not running any business applications. A specific example is that you can view the processor utilization through the top command. In the output of the top command, grab the "%Cpu(s)" line, parse the idle rate (id) as the percentage of the processor's idle time, and configure the value of id as the preset processor utilization when the server is idle. In addition to obtaining the above-mentioned processor utilization when the server is idle and the frequency setting coefficient of the processor's non-core components, in practice, parameters such as the detection cycle and preset idle time can also be preset. In order to facilitate users to view and use parameters, before obtaining the current processor utilization and the preset frequency range of the processor's non-core components, it also includes: obtaining the preset processor utilization when the server is idle, the frequency setting coefficient of the processor's non-core components, and the preset detection cycle;
[0083] The preset utilization rate of the processor when the server is idle, the frequency setting coefficient of the non-core component of the processor and the preset detection cycle are stored in the configuration file.
[0084] Since the preset server idle processor utilization, processor non-core component frequency setting coefficient and preset detection cycle are stored in the configuration file in advance, the values of these parameters can be obtained from the configuration file when performing server energy consumption control.
[0085] When obtaining the current utilization of the processor, you can use the top command to view the current processor idle rate of the server. In the output of the top command, grab the "%Cpu(s)" line and parse the idle rate (id) to obtain the percentage of the processor's idle time.
[0086] The current utilization of the processor is calculated as:
[0087] The current utilization of the processor = (100 - the current idle rate of the server's processor) / 100.
[0088] After obtaining the current utilization of the processor, the current utilization is compared with the preset utilization of the processor when the server is idle. When it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, the target frequency value of the non-core component of the processor when the server is idle is determined according to the preset frequency range; the frequency range of the non-core component of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value. Since the maximum value of the frequency range of the non-core component of the processor is reduced from the maximum value of the preset frequency range to the target frequency value, the energy consumption of the server is reduced.
[0089] In the method provided by an embodiment of the present invention, the current utilization of the processor and the preset frequency range of the non-core components of the processor are first obtained; then, when it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, the target frequency value of the non-core components of the processor when the server is idle is determined according to the preset frequency range; finally, the frequency range of the non-core components of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value. Compared with the method of directly reducing the frequency of the core components of the processor to reduce the energy consumption of the server, in the method provided by the present invention, the frequency of the non-core components of the processor is reduced from the maximum value of the preset frequency range to between the target frequency values, that is, the frequency of the non-core components of the processor is reduced instead of the frequency of the core components of the processor, so that the purpose of reducing the energy consumption of the server is achieved without significantly affecting the performance of the processor; moreover, in this method, the frequency of the non-core components of the processor is reduced only when it is determined that the server is idle, rather than reducing the frequency of the non-core components of the processor when the server is busy, so that the energy consumption of the server when it is idle is reduced and the performance of the server when it is busy is guaranteed as much as possible; in addition, the frequency range of the non-core components of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value, rather than controlling the frequency of the non-core components of the processor to be a fixed value, so that the frequency of the non-core components of the processor is ensured to be flexible. Adjustment.
[0090] In some embodiments, in order to effectively reduce the frequency of the non-core component of the processor, before controlling the frequency range of the non-core component of the processor to be between the minimum value of the preset frequency range and the target frequency value, the method further includes:
[0091] Starting from detecting that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, determining whether the duration of the current utilization being less than or equal to the preset utilization of the processor when the server is idle reaches a preset idle duration;
[0092] If yes, then enter the step of controlling the frequency range of the non-core component of the processor to be between the minimum value of the preset frequency range and the target frequency value;
[0093] If not, then the process returns to the step of obtaining the current utilization of the processor after waiting for a preset detection period.
[0094] There is no limit on the preset idle time and the preset detection cycle, which are determined according to the actual situation. For example, the preset idle time is set to 1 minute, and the preset detection cycle is set to 15 seconds.
[0095] In the method provided in this embodiment, before controlling the frequency range of the non-core components of the processor to be between the minimum value of the preset frequency range and the target frequency value, it is first determined whether the duration of the current utilization being less than or equal to the preset processor utilization when the server is idle reaches the preset idle duration. Only when it reaches the preset idle duration is the frequency range of the non-core components of the processor controlled to be between the minimum value of the preset frequency range and the target frequency value, thereby achieving effective frequency reduction of the non-core components of the processor.
[0096] In an implementation, after controlling the frequency range of the non-core component of the processor to be between the minimum value of the preset frequency range and the target frequency value, the method further includes:
[0097] After the self-detection shows that the frequency range of the non-core component of the control processor is within the minimum value of the preset frequency range and the target frequency value, the energy consumption of the server within the preset time is obtained;
[0098] Determine whether the energy consumption of the server within a preset time is less than a preset energy consumption;
[0099] If yes, return to the step of obtaining the current utilization of the processor and the preset frequency range of the non-core component of the processor;
[0100] If not, the frequency setting coefficient of the non-core component of the processor is adjusted, and the process returns to the step of obtaining the current utilization rate of the processor and the preset frequency range of the non-core component of the processor.
[0101] There is no limit on the preset time, which is determined according to the actual situation. In the method provided in this embodiment, after controlling the frequency range of the non-core components of the processor to be within the minimum value of the preset frequency range and the target frequency value, it is verified whether the energy consumption of the server is reduced. If the energy consumption is reduced, the current utilization rate of the processor is continuously monitored, so as to dynamically adjust the frequency of the non-core components of the processor according to the current utilization rate of the processor in real time; if the energy consumption is not reduced, the target frequency value of the non-core components of the processor when the server is idle is adjusted by adjusting the frequency setting coefficient of the non-core components of the processor, and the current utilization rate of the processor is continuously monitored, so as to ensure that the energy consumption of the server can be reduced as much as possible.
[0102] When it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, it is determined that the non-core components of the processor need to be frequency-reduced. However, in practice, the frequency may have been over-reduced. In order to effectively reduce the frequency of the non-core components of the processor, before determining whether the duration of the current utilization being less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle time, it also includes:
[0103] Get the maximum value of the current frequency range of the non-core component of the processor;
[0104] Determine whether the maximum value of the current frequency range is the target frequency value;
[0105] If yes, then wait for a preset detection period and then return to the step of obtaining the current utilization of the processor;
[0106] If not, set the time variable;
[0107] When it is detected that the value of the time variable is not empty, the initial value of the time variable is obtained, and the current time is used as the final value of the time variable, and the step of determining whether the duration of the current utilization being less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle duration;
[0108] When it is detected that the value of the time variable is empty, the current time is used as the starting value of the time variable, and after waiting for a preset detection period, the step of returning to obtain the current utilization of the processor is performed;
[0109] Determining whether the duration during which the current utilization is less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle duration includes:
[0110] Get the time difference between the final value and the starting value;
[0111] Determine whether the time difference reaches the preset idle time;
[0112] After controlling the frequency range of the non-core component of the processor to be between the minimum value of the preset frequency range and the target frequency value, the method further includes:
[0113] The initial value of the time variable is adjusted to be empty, and after waiting for a preset detection period, the step of returning to obtain the current utilization of the processor is performed.
[0114] In the method provided in this embodiment, before determining whether the duration during which the current utilization rate is less than or equal to the preset utilization rate of the processor when the server is idle has reached the preset idle time, it is first determined whether the maximum value of the current frequency range is the target frequency value, that is, whether the frequency reduction operation has been performed. If the frequency has not been reduced, it is further determined based on the value of the time variable and the current time whether the duration during which the current utilization rate is less than or equal to the preset utilization rate of the processor when the server is idle has reached the preset idle time. Only when it has reached the preset idle time is the frequency range of the non-core components of the processor controlled to be between the minimum value of the preset frequency range and the target frequency value, thereby further achieving effective frequency reduction of the non-core components of the processor.
[0115] The above describes the processing process when it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle. In practice, it may also be detected that the current utilization is greater than the preset utilization of the processor when the server is idle. The following describes the processing method when it is detected that the current utilization is greater than the preset utilization of the processor when the server is idle.
[0116] Specifically, when it is detected that the current utilization is greater than the preset utilization of the processor when the server is idle, it is determined whether the duration for which the current utilization is greater than the preset utilization of the processor when the server is idle is greater than a preset duration;
[0117] If so, the frequency range of the non-core component of the control processor is between the target frequency value and the maximum value of the preset frequency range;
[0118] If not, the frequency range of the non-core component of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value.
[0119] There is no limit on the preset duration, which is determined according to actual conditions. If it is detected that the current utilization is greater than the preset utilization of the processor when the server is idle, it is determined that the server is in a busy state. In this case, in order to ensure the performance of the server, the frequency range of the non-core component of the processor is controlled to be between the target frequency value and the maximum value of the preset frequency range, that is, the non-core component of the processor is frequency-upgraded.
[0120] Before the frequency increase process, if the maximum value of the current frequency range of the non-core component of the processor is already the maximum value of the preset frequency range, if the frequency increase operation is continued, it is an invalid frequency increase. Therefore, before controlling the frequency range of the non-core component of the processor to be between the target frequency value and the maximum value of the preset frequency range, it also includes:
[0121] Get the maximum value of the current frequency range of the non-core component of the processor;
[0122] Determine whether the maximum value of the current frequency range is the target frequency value;
[0123] If so, the frequency range of the non-core component of the control processor is between the target frequency value and the maximum value of the preset frequency range;
[0124] If not, then the process returns to the step of obtaining the current utilization of the processor after waiting for a preset detection period.
[0125] In the method provided in this embodiment, before controlling the frequency range of the non-core component of the processor to be between the target frequency value and the maximum value of the preset frequency range, it is first determined whether the maximum value of the current frequency range of the non-core component of the processor is the target frequency value. If so, the frequency range of the non-core component of the processor is controlled to be between the target frequency value and the maximum value of the preset frequency range, thereby further realizing effective frequency upgrading of the non-core component of the processor when the server is busy, thereby ensuring the performance of the server.
[0126] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Figure 2 A flowchart of a method for dynamically adjusting the frequency of a non-core component of a processor provided by an embodiment of the present invention, such as Figure 2 As shown, the method includes:
[0127] S13: Read the configuration file and obtain the preset parameters;
[0128] S14: Obtain the minimum and maximum values that can be set for the frequency of the non-core component of the processor, and record them as the minimum and maximum values that can be set for the frequency of the non-core component of the processor;
[0129] S15: Obtain a target frequency value of a non-core component of a processor when the server is idle;
[0130] S16: Obtain the current utilization of the processor;
[0131] S17: Determine whether the current utilization is less than or equal to the utilization of the processor when the server is idle; if so, proceed to step S18; if not, proceed to step S20;
[0132] S18: Determine whether the server is in an idle state for more than a preset idle time; if so, proceed to step S19; if not, proceed to step S21;
[0133] S19: Setting the dynamic adjustment range of the non-core component frequency to the minimum settable non-core component frequency value to the target frequency value;
[0134] S20: Restoring the frequency adjustment range of the non-core component to the target frequency value to the maximum settable non-core component frequency value;
[0135] S21: Wait for a preset detection cycle time.
[0136] Among them, the preset parameters recorded in the configuration file in step S13 include parameters such as the utilization rate of the processor when the server is idle, the frequency setting coefficient of the non-core components of the processor, and the preset detection cycle.
[0137] Figure 3 A flowchart of a complete method for dynamically adjusting the frequency of a non-core component of a processor provided by an embodiment of the present invention, such as Figure 3 As shown, the method includes:
[0138] S22: Read the configuration file and obtain the preset parameters;
[0139] S23: Obtain the minimum and maximum values that can be set for the frequency of the non-core component of the processor, and record them as the minimum and maximum values that can be set for the frequency of the non-core component of the processor;
[0140] S24: Obtain a target frequency value of a non-core component of a processor when the server is idle;
[0141] S25: obtaining the current utilization of the processor;
[0142] S26: Determine whether the current utilization is less than or equal to the utilization of the processor when the server is idle; if so, proceed to step S27; if not, proceed to step S34;
[0143] S27: Determine whether the maximum value of the dynamic adjustment range of the frequency of the non-core component is the target frequency value; if so, proceed to step S37; if not, proceed to step S28;
[0144] S28: Determine whether the start time variable is empty; if so, proceed to step S29; if not, proceed to step S30;
[0145] S29: Set the start time variable to the current time;
[0146] S30: Update the current time variable to the current time;
[0147] S31: Determine whether the time difference is greater than or equal to the preset idle time; if so, proceed to step S32; if not, proceed to step S37;
[0148] S32: Setting the dynamic adjustment range of the non-core component frequency to the minimum settable non-core component frequency value to the target frequency value;
[0149] S33: reset the start time variable to empty;
[0150] S34: reset the value of the start time variable to be empty;
[0151] S35: Determine whether the maximum value of the dynamic adjustment range of the frequency of the non-core component is the target frequency value; if so, proceed to step S36; if not, proceed to step S37;
[0152] S36: Setting the dynamic adjustment range of the non-core component frequency to the target frequency value to the maximum settable non-core component frequency value;
[0153] S37: Wait for a preset detection cycle time.
[0154] If the start time variable is not empty, it is recorded as T1; the current time is recorded as T2, and the time difference in step S31 is T2-T1.
[0155] In the method provided by the embodiment of the present invention, by real-time monitoring of the processor utilization of the server, the frequency of the non-core components of the processor is dynamically adjusted, so as to achieve the purpose of energy saving when the server is idle and setting it to high performance when it is not idle. Specifically, the server processor utilization is monitored in real time. If it is monitored that the processor utilization of the server is in a certain low range for a long time, it is judged that the server is in an idle state, and the frequency of the non-core components of the processor is reduced, thereby reducing the power consumption of the server; if it is monitored that the processor utilization of the server is higher than a certain preset utilization range, it is judged that the server is no longer in an idle state, and the frequency of the non-core components of the processor is restored at this time, thereby achieving the purpose of improving the performance of the server.
[0156] In the above embodiments, the server energy consumption control method is described in detail, and the present invention also provides a server energy consumption control device and a server corresponding embodiment. It should be noted that the present invention describes the embodiment of the device part from two perspectives, one is based on the functional module perspective, and the other is based on the hardware perspective.
[0157] The server energy consumption control device provided in the embodiment of the present invention includes, based on the perspective of functional modules:
[0158] An acquisition module, used to acquire the current utilization rate of the processor and the preset frequency range of the non-core components of the processor; wherein the processor includes core components and non-core components;
[0159] A determination module, configured to determine a target frequency value of a non-core component of the processor when the server is idle according to a preset frequency range when it is detected that the current utilization rate is less than or equal to a preset utilization rate of the processor when the server is idle; wherein the target frequency value is greater than a minimum value of the preset frequency range and less than a maximum value of the preset frequency range;
[0160] The control module is used to control the frequency range of the non-core components of the processor to be between the minimum value of the preset frequency range and the target frequency value, so as to control the energy consumption of the server.
[0161] In some embodiments, the server energy consumption control device further includes:
[0162] The first judgment module is used to, starting from detecting that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, determine whether the duration of the current utilization being less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle duration; if so, trigger the control module; if not, trigger the waiting module, and after the waiting module is triggered, trigger the acquisition module;
[0163] The waiting module is used to wait for a preset detection cycle.
[0164] In some embodiments, the server energy consumption control device further includes:
[0165] A first acquisition module, used to acquire a maximum value of a current frequency range of a non-core component of a processor;
[0166] The second judgment module is used to judge whether the maximum value of the current frequency range is the target frequency value; if not, the setting module is triggered; if yes, the waiting module is triggered; after the waiting module is triggered, the acquisition module is triggered;
[0167] A waiting module is used to wait for a preset detection cycle;
[0168] Setting module, used to set time variables;
[0169] A second acquisition module is used to acquire an initial value of the time variable and use the current time as the final value of the time variable to trigger the first judgment module when detecting that the value of the time variable is not empty;
[0170] As a module, when it is detected that the value of the time variable is empty, the current time is used as the starting value of the time variable, and the trigger acquisition module is returned after waiting for a preset detection period;
[0171] In some embodiments, the server energy consumption control device further includes:
[0172] The adjustment and waiting module is used to adjust the initial value of the time variable to empty and wait for the preset detection cycle; and return to the trigger acquisition module.
[0173] In some embodiments, the server energy consumption control device further includes:
[0174] The third judgment module is used to determine whether the duration of the current utilization rate being greater than the preset utilization rate of the processor when the server is idle is greater than the preset duration when the current utilization rate is detected to be greater than the preset utilization rate of the processor when the server is idle; if so, trigger the first control module; if not, trigger the control module;
[0175] The first control module is used to control the frequency range of the non-core component of the processor to be between the target frequency value and the maximum value of the preset frequency range.
[0176] In some embodiments, the server energy consumption control device further includes:
[0177] A third acquisition module is used to acquire a maximum value of a current frequency range of a non-core component of the processor;
[0178] The fourth judgment module is used to judge whether the maximum value of the current frequency range is the target frequency value; if so, the first control module is triggered; if not, the waiting module is triggered; after the waiting module is triggered, the acquisition module is triggered.
[0179] In some embodiments, the server energy consumption control device further includes:
[0180] A fourth acquisition module, used to acquire a preset utilization rate of a processor when the server is idle, a frequency setting coefficient of a non-core component of the processor, and a preset detection cycle;
[0181] The storage module is used to store the preset utilization rate of the processor when the server is idle, the frequency setting coefficient of the non-core component of the processor and the preset detection cycle in the configuration file.
[0182] Since the embodiments of the apparatus 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 apparatus part, which will not be repeated here.
[0183] Figure 4 This is a structural diagram of a server provided in an embodiment of the present invention. This embodiment is based on the hardware perspective, such as Figure 4 As shown, the server includes:
[0184] A memory 20, used for storing computer programs;
[0185] The processor 21 is used to implement the steps of the method for controlling server energy consumption mentioned in the above embodiment when executing a computer program.
[0186] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array. The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0187] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 20 is at least used to store the following computer program 201, wherein, after the computer program is loaded and executed by the processor 21, it can implement the relevant steps of the server energy consumption control method disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the above-mentioned server energy consumption control method, etc.
[0188] In some embodiments, the server may further include a display screen 22 , an input / output interface 23 , a communication interface 24 , a power supply 25 , and a communication bus 26 .
[0189] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the server, and may include more or fewer components than shown in the figure.
[0190] The server provided by the embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: a server energy consumption control method, and the effect is the same as above.
[0191] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned server energy consumption control method when executed by a processor.
[0192] Finally, the present invention also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps recorded in the above method embodiment are implemented.
[0193] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc. Various media that can store program codes.
[0194] The computer-readable storage medium provided by the present invention includes the above-mentioned server energy consumption control method, and the effect is the same as above.
[0195] The above is a detailed introduction to a server energy consumption control method, device, server and medium provided by the present invention. 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 embodiments can be referenced to each other. For the device 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 principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the present invention.
[0196] 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 "comprise", "include" 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 "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A server energy consumption control method, characterized in that: include: Acquire a current utilization rate of a processor and a preset frequency range of a non-core component of the processor; wherein the processor includes a core component and a non-core component; When it is detected that the current utilization is less than or equal to the preset utilization of the processor when the server is idle, determine the target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range; wherein the target frequency value is greater than the minimum value of the preset frequency range and less than the maximum value of the preset frequency range; The frequency range of the non-core components of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value, so as to control the energy consumption of the server.
2. The server energy consumption control method according to claim 1, characterized in that: Determining the target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range includes: Get the frequency setting coefficient of the non-core component of the processor; Obtaining a difference between a maximum value of the preset frequency range and a minimum value of the preset frequency range; Obtaining a product result of the difference and the frequency setting coefficient; The target frequency value of the non-core component of the processor when the server is idle is determined according to the result of adding the minimum value of the preset frequency range and the product result.
3. The server energy consumption control method according to claim 2, characterized in that: Before the frequency range of the non-core component of the control processor is between the minimum value of the preset frequency range and the target frequency value, the method further includes: Starting from detecting that the current utilization is less than or equal to a preset utilization of the processor when the server is idle, determining whether the duration for which the current utilization is less than or equal to the preset utilization of the processor when the server is idle reaches a preset idle duration; If yes, entering the step of controlling the frequency range of the non-core component of the processor to be between the minimum value of the preset frequency range and the target frequency value; If not, then wait for a preset detection period and then return to the step of obtaining the current utilization of the processor.
4. The server energy consumption control method according to claim 3, characterized in that: Before determining whether the duration during which the current utilization is less than or equal to the preset utilization of the processor when the server is idle reaches a preset idle duration, the method further includes: Obtaining a maximum value of a current frequency range of a non-core component of the processor; Determining whether the maximum value of the current frequency range is the target frequency value; If yes, then wait for a preset detection period and then return to the step of obtaining the current utilization of the processor; If not, set the time variable; In the case where it is detected that the value of the time variable is not empty, the initial value of the time variable is obtained, and the current time is used as the final value of the time variable, and the step of determining whether the duration of the current utilization being less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle duration; When it is detected that the value of the time variable is empty, the current time is used as the starting value of the time variable, and after waiting for a preset detection period, the step of obtaining the current utilization of the processor is returned; The determining whether the duration during which the current utilization is less than or equal to the preset utilization of the processor when the server is idle reaches the preset idle duration includes: Obtaining a time difference between the final value and the starting value; Determining whether the time difference reaches the preset idle time length; After the frequency range of the non-core component of the control processor is between the minimum value of the preset frequency range and the target frequency value, the method further includes: The initial value of the time variable is adjusted to be empty, and after waiting for a preset detection period, the step of returning to the step of obtaining the current utilization of the processor is performed.
5. The server energy consumption control method according to claim 2, characterized in that: The method further comprises: In the case where it is detected that the current utilization is greater than the preset utilization of the processor when the server is idle, determining whether the duration for which the current utilization is greater than the preset utilization of the processor when the server is idle is greater than a preset duration; If so, controlling the frequency range of the non-core component of the processor to be between the target frequency value and the maximum value of the preset frequency range; If not, the frequency range of the non-core component of the processor is controlled to be between the minimum value of the preset frequency range and the target frequency value.
6. The server energy consumption control method according to claim 5, characterized in that: Before the frequency range of the non-core component of the control processor is between the target frequency value and the maximum value of the preset frequency range, the method further includes: Obtaining a maximum value of a current frequency range of a non-core component of the processor; Determining whether the maximum value of the current frequency range is the target frequency value; If so, controlling the frequency range of the non-core component of the processor to be between the target frequency value and the maximum value of the preset frequency range; If not, then wait for a preset detection period and then return to the step of obtaining the current utilization of the processor.
7. The server energy consumption control method according to any one of claims 3, 4 and 6, characterized in that: Before obtaining the current utilization rate of the processor and the preset frequency range of the non-core component of the processor, the method further includes: Obtaining the preset utilization rate of the processor when the server is idle, the frequency setting coefficient of the non-core components of the processor, and the preset detection cycle; The preset utilization rate of the processor when the server is idle, the frequency setting coefficient of the non-core component of the processor and the preset detection cycle are stored in the configuration file.
8. A server energy consumption control device, characterized in that: include: An acquisition module, used to acquire a current utilization rate of a processor and a preset frequency range of a non-core component of the processor; wherein the processor includes a core component and a non-core component; A determination module, configured to determine, when detecting that the current utilization is less than or equal to a preset utilization of the processor when the server is idle, a target frequency value of the non-core component of the processor when the server is idle according to the preset frequency range; wherein the target frequency value is greater than a minimum value of the preset frequency range and less than a maximum value of the preset frequency range; The control module is used to control the frequency range of the non-core components of the processor to be between the minimum value of the preset frequency range and the target frequency value, so as to control the energy consumption of the server.
9. A server, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the server energy consumption control method as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the server energy consumption control method according to any one of claims 1 to 7 are implemented.