Method and apparatus for dynamically adjusting server power consumption, and storage medium

By dynamically adjusting the server's load threshold and CPU frequency drop latency, the performance loss problem of the server in short-task scenarios is solved, and efficient power consumption management and performance utilization under different loads are achieved.

CN120723481BActive Publication Date: 2025-11-11BLUECORE COMPUTING POWER (SHENZHEN) TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511225242.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-08-29
Publication Date
2025-11-11
Estimated Expiration
2045-08-29

AI Technical Summary

Technical Problem

In dynamic frequency adjustment mode, when faced with frequent 'idle-busy-idle-busy' short task scenarios, the server cannot effectively exert its maximum performance, resulting in performance loss and increased power consumption.

Method used

By obtaining the current load value of the server, the fluctuation of the load status is judged, the preset load threshold and CPU frequency drop latency are adjusted, and the CPU frequency is dynamically adjusted to adapt to load changes, including judging the number of frequent fluctuations within a preset time period and adjusting the frequency.

Benefits of technology

It effectively reduces server power consumption while maximizing performance under various load scenarios, reduces frequent CPU frequency switching, and improves system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120723481B_ABST
    Figure CN120723481B_ABST
Patent Text Reader

Abstract

This invention relates to the field of computer technology, and particularly to a method, apparatus, and storage medium for dynamically adjusting server power consumption. The dynamic adjustment method includes: acquiring the current load value of the server within the current sampling period; determining whether fluctuations in the server's operating state occur a preset number of times within a preset time period based on the current load value, and adjusting a preset load threshold and CPU frequency drop-off latency of the server; determining whether the current load value is greater than the preset load threshold: if so, setting the server's CPU frequency to its maximum value; if not, calculating the target CPU frequency of the server in the next sampling period and adjusting the server's CPU frequency to the target CPU frequency. Compared with existing technologies, this invention can capture short-periodic task characteristics, automatically change the CPU frequency drop-off latency and preset load threshold, and by dynamically adjusting the CPU frequency, it can reduce power consumption while maximizing server performance under various load scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus and storage medium for dynamically adjusting server power consumption. Background Technology

[0002] With the development of the computer industry, servers are widely used. However, servers are characterized by high power consumption and the need for long-term online operation. Therefore, unlike personal computers or mobile devices, they cannot be powered by setting standby or hibernation states when not in use to save energy. Secondly, since servers are mostly used in commercial applications and are expensive, their performance resources should be maximized when processing tasks. While ensuring performance, it is also necessary to focus on reducing power consumption and addressing energy conservation and emission reduction issues. Reducing the average power consumption of a single server can save considerable electricity costs in scenarios such as data centers.

[0003] To meet the low-power requirements of servers, the CPUFreq framework is often used. The CPUFreq framework allows for the selection of a frequency strategy for the CPU, dynamically adjusting its frequency and voltage. It provides a unified interface across various platforms for setting hardware status and obtaining hardware information. The specific frequency adjustment method is determined by the different strategies employed by CPUFreq.

[0004] The CPUFreq policy includes the following five policies:

[0005] 1) Performance strategy (cpufreq_performance): The CPU runs at the highest frequency, i.e., the maximum frequency (scaling_max_freq).

[0006] 2) On-demand strategy (cpufreq_ondemand): The CPU runs at a low frequency under normal circumstances, and increases the frequency as needed when the system load increases.

[0007] 3) Conservative strategy (cpufreq_conservative): Similar to the on-demand strategy, the difference is that it adopts a gradual approach when the dynamic frequency changes.

[0008] 4) Power saving strategy (cpufreq_powersave): The CPU runs at the lowest frequency, i.e., the minimum frequency (scaling_min_freq).

[0009] 5) User space policy (cpufreq_userspace): Allows the root user to set the frequency (scaling_setspeed) through the sys node.

[0010] The on-demand strategy includes parameters such as ignore_nice_load, powersave_bias, sampling_down_factor, sampling_rate, and up_threshold. ignore_nice_load is used to treat process loads with a nice value greater than 0 as idle. powersave_bias is a parameter that influences frequency decisions. sampling_down_factor determines how many cycles after which the CPU frequency should be reduced when the system load falls below a threshold. sampling_rate is the sampling interval. up_threshold is the load threshold for increasing the CPU frequency.

[0011] By employing an on-demand strategy, to extend the CPU's high-frequency operation time, the `sampling_down_factor` value can be increased; conversely, to make it easier for the CPU to operate at high frequencies, the `up_threshold` value can be decreased. However, adjusting these parameters requires finding a balanced value, as excessive settings can increase power consumption in the idle state. This is because some periodically woken system processes periodically increase the frequency.

[0012] However, even without considering standby and hibernation scenarios, the Linux kernel has existing frameworks like CPUidle and CPUFreq to reduce power consumption during continuous system operation. Even when dealing with high load, it can dynamically adjust CPU voltage and frequency to adapt to different CPU utilization rates (e.g., CPUFreq's on-demand strategy). Based on the ondemand strategy, when the server's operating state frequently exhibits a "idle (T1)-busy (T2)-idle (T3)-busy (T4)" scenario within a short period, it will frequently trigger CPU frequency changes, impacting program performance in this scenario. This is because during T1, the CPU frequency is low due to idle load. When T2 arrives, the increased load requires a frequency increase, but this frequency increase is a process, including the latency of software calculations for load-based frequency adjustments and the latency of the CPU frequency hardware changes themselves. Therefore, during the busy period of T2, programs do not continuously run at the highest CPU frequency, inevitably causing performance loss. In T3 and T4, a new frequency adjustment cycle will re-enter, further impacting server performance.

[0013] Therefore, there is an urgent need for a new method, device, and storage medium for dynamically adjusting server power consumption to solve the above-mentioned technical problems. Summary of the Invention

[0014] This invention provides a method, device, and storage medium for dynamically adjusting server power consumption, aiming to solve the contradiction that servers cannot achieve maximum performance in dynamic frequency adjustment mode for short task scenarios such as frequent "idle-busy-idle-busy".

[0015] In a first aspect, the present invention provides a method for dynamically adjusting server power consumption, the method comprising the following steps:

[0016] S1. Obtain the current load value of the server within the current sampling period;

[0017] S2. Determine whether the fluctuation of the server's working state occurs within a preset time period and a preset number of fluctuations based on the current load value, and obtain a determination result; and adjust the preset load threshold and CPU frequency drop delay of the server based on the determination result;

[0018] S3. Determine whether the current load value is greater than the preset load threshold: if yes, set the CPU frequency of the server to the maximum value; if no, calculate the target CPU frequency of the server in the next sampling period and adjust the CPU frequency of the server to the target CPU frequency.

[0019] Preferably, step S2 includes the following sub-steps:

[0020] S21. Determine whether the current load value and the server load value in the previous sampling period produce a preset fluctuation value: if so, record the number of times the preset fluctuation value is produced within the preset time period to obtain the fluctuation count value.

[0021] S22. Determine whether the number of fluctuations is greater than the preset number: if yes, adjust the preset load threshold and the CPU frequency drop delay; if no, restore the preset load threshold and the CPU frequency drop delay to the preset value.

[0022] Preferably, the target CPU frequency is calculated based on the following conditions:

[0023] ;

[0024] Where freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU utilization rate.

[0025] Preferably, the preset time period is 1 second.

[0026] Secondly, the present invention also provides a dynamic power consumption adjustment device for a server, comprising:

[0027] The load acquisition module is used to obtain the current load value of the server within the current sampling period.

[0028] The adjustment module is used to determine whether the fluctuation of the server's working state occurs a preset number of times within a preset time period based on the current load value, and to obtain a judgment result; and to adjust the preset load threshold and CPU frequency drop latency of the server based on the judgment result.

[0029] The frequency adjustment module is used to determine whether the current load value is greater than the preset load threshold: if yes, the CPU frequency of the server is set to the maximum value; if no, the target CPU frequency of the server in the next sampling period is calculated and the CPU frequency of the server is adjusted to the target CPU frequency.

[0030] Preferably, the adjustment module includes the following sub-units:

[0031] The judgment unit is used to determine whether the current load value and the load value of the server in the previous sampling period produce a preset fluctuation value; if so, it records the number of times the preset fluctuation value is produced within the preset time period to obtain the fluctuation count value.

[0032] An adjustment unit is used to determine whether the number of fluctuations is greater than the preset number: if yes; if no, then the preset load threshold and the CPU frequency drop delay are restored to the preset value, and the preset load threshold and the CPU frequency drop delay are adjusted.

[0033] Preferably, the target CPU frequency is calculated based on the following conditions:

[0034] ;

[0035] Where freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU utilization rate.

[0036] Preferably, the preset time period is 1 second.

[0037] Thirdly, the present invention also provides a dynamic adjustment device for server power consumption, comprising: a memory, a processor, and a dynamic adjustment program for server power consumption stored in the memory and executable on the processor, wherein when the processor executes the dynamic adjustment program for server power consumption, it implements the steps in the dynamic adjustment method for server power consumption as described in any of the above embodiments.

[0038] Fourthly, the present invention also provides a storage medium storing a dynamic adjustment program for server power consumption, wherein when the dynamic adjustment program for server power consumption is executed by a processor, the steps in the dynamic adjustment method for server power consumption as described in any of the above embodiments are implemented.

[0039] Compared with existing technologies, this invention obtains the current load value of the server within the current sampling period; determines whether the fluctuation of the server's working state occurs a preset number of times within a preset time period based on the current load value, and obtains a judgment result; and adjusts the preset load threshold and CPU frequency drop latency of the server based on the judgment result; determines whether the current load value is greater than the preset load threshold: if so, the server's CPU frequency is set to the maximum value; if not, the target CPU frequency of the server in the next sampling period is calculated, and the server's CPU frequency is adjusted to the target CPU frequency. This invention can capture short-periodic task characteristics, automatically change the CPU frequency drop latency and preset load threshold, and through dynamic CPU frequency adjustment, can reduce power consumption while maximizing server performance under various load scenarios. Attached Figure Description

[0040] The present invention will now be described in detail with reference to the accompanying drawings. The above and other aspects of the present invention will become clearer and more readily understood through the detailed description following the accompanying drawings. In the drawings:

[0041] Figure 1 This is a flowchart of a method for dynamically adjusting server power consumption provided in an embodiment of the present invention;

[0042] Figure 2 This is a schematic diagram of the structure of the server power consumption dynamic adjustment device provided in an embodiment of the present invention;

[0043] Figure 3 This is a schematic diagram of another server power consumption dynamic adjustment device provided in an embodiment of the present invention. Detailed Implementation

[0044] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0045] Example 1

[0046] Please refer to Figure 1 This invention provides a method for dynamically adjusting server power consumption, the method comprising the following steps:

[0047] S1. Obtain the current load value of the server within the current sampling period.

[0048] In this embodiment of the invention, based on the ondemand strategy, the current load value of the server is obtained, and the corresponding parameters are dynamically adjusted. The server parameter settings can be found in Table 1.

[0049] Table 1: Server Parameter Settings Table

[0050]

[0051] Specifically, this invention uses the frequency adjustment decision function od_update in the ondemand strategy to calculate the time percentage of the CPU in user mode, kernel mode, and idle mode, and then updates the current load value to obtain the current load value.

[0052] S2. By determining whether the fluctuation of the server's working state occurs a preset number of times within a preset time period based on the current load value, a judgment result is obtained; and the preset load threshold and CPU frequency drop delay of the server are adjusted according to the judgment result.

[0053] In this embodiment of the invention, the specific method for determining whether the server's working state changes frequently within a short period is as follows:

[0054] S21. Determine whether the current load value and the server's load value in the previous sampling period produce a preset fluctuation value. If so, record the number of times the preset fluctuation value is generated within the preset time period to obtain the fluctuation count value. The preset time period is 1 second, and the preset time period and the preset fluctuation value can be set according to the situation, and are not limited to 1 second.

[0055] Specifically, the preset fluctuation value refers to the difference between the current load value and the load value of the previous sampling period at a certain time interval. If it exceeds the preset fluctuation value, it indicates that the server load has increased significantly in the current period, and it is necessary to determine whether the CPU frequency needs to be adjusted.

[0056] S22. Determine whether the fluctuation count value is greater than the preset count, and obtain the determination result: If the determination result is yes, it means that the working state of the server fluctuates frequently within the preset time period (that is, the fluctuation count value exceeds the preset count, which means frequent fluctuation), and its working state is "idle (T1)-busy (T2)-idle (T3)-busy (T4)". Adjust the preset load threshold and the CPU frequency drop delay; If the determination result is no, restore the preset load threshold and the CPU frequency drop delay to the preset value (that is, the default value, such as the CPU frequency drop delay of 1 and the preset load threshold of 95 in Table 1).

[0057] Specifically, when updating the current load value using the `dbs_update` function, the system counts whether load fluctuations occur within a preset time period. If the number of fluctuations within one second exceeds the preset fluctuation count, the CPU frequency drop delay and the preset load threshold used to determine whether to downclock the CPU are adjusted. By adjusting the preset load threshold and CPU frequency drop delay, it is possible to make it difficult for the CPU to meet the downclocking conditions in the short term once it has increased its frequency. As long as the idle time during the T3 period is very short, the average load of the server system will decrease, but it will still be greater than the "adjusted" threshold. When the server's working state ends from frequent fluctuations, the fluctuation count will be used to determine the cause, and the CPU frequency drop delay and preset load threshold will be restored to their preset values ​​(e.g., the preset load threshold is 95).

[0058] By determining whether the number of fluctuations exceeds a preset number, temporary load changes and sustained load trends can be effectively distinguished, preventing frequent frequency switching. When the number of fluctuations exceeds the preset number, it indicates that the server's CPU frequency needs to be adjusted to its maximum value as soon as possible. Therefore, the preset load threshold and the CPU frequency drop delay are adjusted simultaneously (i.e., the preset load threshold is lowered, and the CPU frequency drop delay is increased, making it easier for the CPU frequency to run at high frequencies and for longer periods at high frequencies, avoiding frequent adjustments), so that the CPU frequency quickly reaches its maximum frequency. The adjustment value can be adjusted according to the actual situation. The CPU frequency adjustment is based on the CPU frequency adjustment driver (cpufreq_driver). For example, when the server is running, the frequency is quickly increased during sudden high loads, and the frequency adjustment overhead is reduced during sustained stable loads. The load value of the current sampling period (i.e., the current load value) is recorded and compared with the load value of the next sampling period.

[0059] For example, server load scenarios can be categorized into three types: sudden high load, sustained medium load, and drastic load fluctuations. During a sudden high load, if the sampling period detects a current load value of 98% (exceeding the preset load threshold of 95%), the CPU frequency is immediately increased to 3.0GHz to ensure rapid task completion. If the load remains high in the next cycle, the maximum frequency is maintained; if the load decreases, frequency reduction logic is implemented. During sustained medium load, if the load stabilizes at 60%, a target frequency (e.g., 1.26GHz) is calculated proportionally and gradually reduced to that value. If there are no significant fluctuations, default parameters are maintained to avoid frequent adjustments and reduce power consumption. During drastic load fluctuations, if the load fluctuates between 30% and 90% 10 times within a preset time period (i.e., 1 second), the preset load threshold and the CPU frequency reduction delay are adjusted simultaneously. If the load remains high in the next cycle, the maximum frequency is maintained; if the load decreases, frequency reduction logic is implemented.

[0060] S3. Determine whether the current load value is greater than the preset load threshold: if yes, set the CPU frequency of the server to the maximum value; if no, calculate the target CPU frequency of the server in the next sampling period and adjust the CPU frequency of the server to the target CPU frequency.

[0061] In this embodiment of the invention, by judging the current load value, the CPU frequency can always change accordingly with the load situation, effectively maximizing the server's system performance in short task scenarios with frequent "idle-busy-idle-busy" cycles. It should be noted that steps S1-S3 proposed in this invention are cyclical, meaning that steps S1-S3 can be performed again in the next sampling period, allowing the server's CPU frequency to be dynamically adjusted according to the actual situation, achieving server load self-adaptation.

[0062] The target CPU frequency is calculated based on the following conditions:

[0063] ;

[0064] Where freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU utilization. Load is calculated based on the following conditions:

[0065] ;

[0066] Here, `time_elapsed` is the time difference between two samples calculated from the wall time obtained by the `get_cpu_idle_time` function. `Idle_time` is the total CPU idle time within the `time_elapsed` period calculated by the `get_cpu_idle_time` function.

[0067] Compared to existing technologies, this invention obtains the current load value of the server within the current sampling period; determines whether fluctuations in the server's operating state occur a preset number of times within a preset time period based on the current load value, and obtains a judgment result; then adjusts the server's preset load threshold and CPU frequency drop latency based on the judgment result; and determines whether the current load value is greater than the preset load threshold: if so, the server's CPU frequency is set to the maximum value; if not, the target CPU frequency for the server in the next sampling period is calculated, and the server's CPU frequency is adjusted to the target CPU frequency. This invention can capture short-periodic task characteristics, automatically change the CPU frequency drop latency and preset load threshold, and through dynamic CPU frequency adjustment, reduce power consumption while maximizing server performance under various load scenarios.

[0068] Example 2

[0069] This invention also provides a dynamic power consumption adjustment device for servers, please refer to... Figure 2 , Figure 2 This is a schematic diagram of the structure of the server power consumption dynamic adjustment device 200 provided in an embodiment of the present invention, which includes:

[0070] 201. Load Acquisition Module: Used to obtain the current load value of the server within the current sampling period.

[0071] Specifically, this invention uses the frequency adjustment decision function od_update in the ondemand strategy to calculate the time percentage of the CPU in user mode, kernel mode, and idle mode, and then updates the current load value to obtain the current load value.

[0072] 202. An adjustment module is used to determine whether the fluctuation of the server's working state occurs a preset number of times within a preset time period based on the current load value, and to obtain a judgment result; and to adjust the preset load threshold and CPU frequency drop delay of the server based on the judgment result;

[0073] In this embodiment of the invention, the adjustment module 202 includes the following sub-units:

[0074] 2021. A judgment unit is used to determine whether the current load value and the server's load value in the previous sampling period produce a preset fluctuation value, and to record the number of times the preset fluctuation value is generated within a preset time period to obtain a fluctuation count value. The preset time period is 1 second, and the preset time period and the preset fluctuation value can be set according to the situation, and are not limited to 1 second.

[0075] Specifically, the preset fluctuation value refers to the difference between the current load value and the load value of the previous sampling period at a certain time interval. If it exceeds the preset fluctuation value, it indicates that the server load has increased significantly in the current period, and it is necessary to determine whether the CPU frequency needs to be adjusted.

[0076] 2022. Adjustment unit, used to determine whether the fluctuation count value is greater than the preset count: if yes, the preset load threshold and the CPU frequency drop delay are adjusted; if no, the preset load threshold and the CPU frequency drop delay are restored to the preset value (i.e. the default value, such as the CPU frequency drop delay of 1 and the preset load threshold of 95 in Table 1).

[0077] Specifically, by determining whether the number of fluctuations exceeds a preset number, temporary load changes and continuous load trends can be effectively distinguished, preventing frequent frequency switching. When the number of fluctuations exceeds the preset number, it indicates that the server's CPU frequency needs to be adjusted to its maximum value as soon as possible. Therefore, the preset load threshold and the CPU frequency drop delay are adjusted simultaneously (i.e., the preset load threshold is lowered, and the CPU frequency drop delay is increased, making it easier for the CPU frequency to run at a high frequency and for a longer period at that frequency), so that the CPU frequency can quickly reach its maximum frequency. The adjusted values ​​can be adjusted according to the actual situation, for example, rapidly increasing the frequency during sudden high loads and reducing frequency adjustment overhead during continuous stable loads. Simultaneously, the load value of the current sampling period (i.e., the current load value) is recorded and compared with the load value of the next sampling period.

[0078] For example, server load scenarios can be categorized into three types: sudden high load, sustained medium load, and drastic load fluctuations. During a sudden high load, if the sampling period detects a current load value of 98% (exceeding the preset load threshold of 95%), the CPU frequency is immediately increased to 3.0GHz to ensure rapid task completion. If the load remains high in the next cycle, the maximum frequency is maintained; if the load decreases, frequency reduction logic is implemented. During sustained medium load, if the load stabilizes at 60%, a target frequency (e.g., 1.26GHz) is calculated proportionally and gradually reduced to that value. If there are no significant fluctuations, default parameters are maintained to avoid frequent adjustments and reduce power consumption. During drastic load fluctuations, if the load fluctuates between 30% and 90% 10 times within a preset time period (i.e., 1 second), the preset load threshold and the CPU frequency reduction delay are adjusted simultaneously. If the load remains high in the next cycle, the maximum frequency is maintained; if the load decreases, frequency reduction logic is implemented.

[0079] 203. Frequency adjustment module, used to determine whether the current load value is greater than the preset load threshold: if yes, then set the CPU frequency of the server to the maximum value; if no, then calculate the target CPU frequency of the server in the next sampling period and adjust the CPU frequency of the server to the target CPU frequency.

[0080] In this embodiment of the invention, by judging the current load value, the CPU frequency can always change accordingly with the load situation, effectively maximizing the server's system performance in short task scenarios with frequent "idle-busy-idle-busy" cycles.

[0081] The target CPU frequency is calculated based on the following conditions:

[0082] ;

[0083] Where freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU utilization. Load is calculated based on the following conditions:

[0084] ;

[0085] Here, `time_elapsed` is the time difference between two samples calculated from the wall time obtained by the `get_cpu_idle_time` function. `Idle_time` is the total CPU idle time within the `time_elapsed` period calculated by the `get_cpu_idle_time` function.

[0086] The server power consumption dynamic adjustment device 200 can implement the steps in the server power consumption dynamic adjustment method in the above embodiments and achieve the same technical effect. Refer to the description in the above embodiments, which will not be repeated here.

[0087] Example 3

[0088] This invention also provides another dynamic power consumption adjustment device for servers, please refer to... Figure 3 , Figure 3 This is a schematic diagram of another server power consumption dynamic adjustment device provided in an embodiment of the present invention. The server power consumption dynamic adjustment device 300 includes: a memory 302, a processor 301, and a server power consumption dynamic adjustment program stored in the memory 302 and executable on the processor 301.

[0089] The processor 301 calls the server power consumption dynamic adjustment program stored in the memory 302 to execute the steps in the server power consumption dynamic adjustment method provided in this embodiment of the invention. Please refer to... Figure 1 Specifically, it includes the following steps:

[0090] S1. Obtain the current load value of the server within the current sampling period.

[0091] In this embodiment of the invention, the current load value of the server is obtained based on the ondemand strategy, and the corresponding parameters are dynamically adjusted. Specifically, the present invention obtains the current load value by calculating the proportion of CPU time spent in user mode, kernel mode, and idle mode through the frequency adjustment decision function od_update in the ondemand strategy.

[0092] S2. Determine whether the fluctuation of the server's working state occurs a preset number of times within a preset time period based on the current load value, and obtain the determination result; and adjust the preset load threshold and CPU frequency drop delay of the server based on the determination result.

[0093] In this embodiment of the invention, step S2 includes the following sub-steps:

[0094] It is determined whether the current load value and the server's load value in the previous sampling period produce a preset fluctuation value, and the number of times the preset fluctuation value is generated within a preset time period is recorded to obtain the fluctuation count value. The preset time period is 1 second, and the preset time period and the preset fluctuation value can be set according to the situation, and are not limited to 1 second.

[0095] Specifically, the preset fluctuation value refers to the difference between the current load value and the load value of the previous sampling period at a certain time interval. If it exceeds the preset fluctuation value, it indicates that the server load has increased significantly in the current period, and it is necessary to determine whether the CPU frequency needs to be adjusted.

[0096] Determine whether the number of fluctuations is greater than a preset number: if yes, adjust the preset load threshold and the CPU frequency drop delay; if no, restore the preset load threshold and the CPU frequency drop delay to the preset values ​​(such as the CPU frequency drop delay being 1 and the preset load threshold being 95 in Table 1).

[0097] Specifically, by determining whether the number of fluctuations exceeds a preset number, temporary load changes and continuous load trends can be effectively distinguished, preventing frequent frequency switching. When the number of fluctuations exceeds the preset number, it indicates that the server's CPU frequency needs to be adjusted to its maximum value as soon as possible. Therefore, the preset load threshold and the CPU frequency drop delay are adjusted simultaneously to allow the CPU frequency to quickly reach its maximum frequency. The adjustment values ​​can be adjusted according to actual conditions, such as rapidly increasing the frequency during sudden high loads and reducing frequency adjustment overhead during continuous stable loads. Simultaneously, the load value of the current sampling period (i.e., the current load value) is recorded and compared with the load value of the next sampling period.

[0098] For example, server load scenarios can be categorized into three types: sudden high load, sustained medium load, and drastic load fluctuations. During a sudden high load, if the sampling period detects a current load value of 98% (exceeding the preset load threshold of 95%), the CPU frequency is immediately increased to 3.0GHz to ensure rapid task completion. If the load remains high in the next cycle, the maximum frequency is maintained; if the load decreases, frequency reduction logic is implemented. During sustained medium load, if the load stabilizes at 60%, a target frequency (e.g., 1.26GHz) is calculated proportionally and gradually reduced to that value. If there are no significant fluctuations, default parameters are maintained to avoid frequent adjustments and reduce power consumption. During drastic load fluctuations, if the load fluctuates between 30% and 90% 10 times within a preset time period (i.e., 1 second), the preset load threshold and the CPU frequency reduction delay are adjusted simultaneously. If the load remains high in the next cycle, the maximum frequency is maintained; if the load decreases, frequency reduction logic is implemented.

[0099] S3. Determine whether the current load value is greater than the preset load threshold: if yes, set the CPU frequency of the server to the maximum value; if no, calculate the target CPU frequency of the server in the next sampling period and adjust the CPU frequency of the server to the target CPU frequency.

[0100] In this embodiment of the invention, by judging the current load value, the CPU frequency can always change accordingly with the load situation, effectively maximizing the server's system performance in short task scenarios with frequent "idle-busy-idle-busy" cycles. It should be noted that steps S1-S3 proposed in this invention are cyclical, meaning that steps S1-S3 can be performed again in the next sampling period, allowing the server's CPU frequency to be dynamically adjusted according to the actual situation, achieving server load self-adaptation.

[0101] The target CPU frequency is calculated based on the following conditions:

[0102] ;

[0103] Where freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU utilization. Load is calculated based on the following conditions:

[0104] ;

[0105] Here, `time_elapsed` is the time difference between two samples calculated from the wall time obtained by the `get_cpu_idle_time` function. `Idle_time` is the total CPU idle time within the `time_elapsed` period calculated by the `get_cpu_idle_time` function.

[0106] The server power consumption dynamic adjustment device 300 provided in this embodiment of the invention can realize the steps in the server power consumption dynamic adjustment method in the above embodiment, and can achieve the same technical effect. Refer to the description in the above embodiment, which will not be repeated here.

[0107] Example 4

[0108] This invention also provides a storage medium, which is a computer-readable storage medium, storing a dynamic adjustment program for server power consumption. When the dynamic adjustment program for server power consumption is executed by a processor, it implements the various processes and steps in the dynamic adjustment method for server power consumption provided in this invention and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0109] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The dynamic power consumption adjustment program for the server can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0110] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0111] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0112] The embodiments of the present invention have been described above with reference to the accompanying drawings. The disclosed embodiments are merely preferred embodiments of the present invention. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many equivalent changes in form without departing from the spirit and scope of the claims of the present invention, and all such changes are within the protection scope of the present invention.

Claims

1. A method for dynamically adjusting server power consumption, characterized in that, The dynamic adjustment method includes the following steps: S1. Obtain the current load value of the server within the current sampling period; S2. Determine whether the fluctuation of the server's working state occurs a preset number of times within a preset time period based on the current load value, and obtain the determination result; and adjust the preset load threshold and CPU frequency drop delay of the server based on the determination result; S3. Determine whether the current load value is greater than the preset load threshold: if yes, set the CPU frequency of the server to the maximum value; if no, calculate the target CPU frequency of the server in the next sampling period and adjust the CPU frequency of the server to the target CPU frequency. Step S2 includes the following sub-steps: S21. Determine whether the current load value and the server load value in the previous sampling period produce a preset fluctuation value: if so, record the number of times the preset fluctuation value is produced within the preset time period to obtain the fluctuation count value. S22. Determine whether the number of fluctuations is greater than the preset number: if yes, adjust the preset load threshold and the CPU frequency drop delay; if no, restore the preset load threshold and the CPU frequency drop delay to the preset value.

2. The method for dynamically adjusting server power consumption as described in claim 1, characterized in that, The target CPU frequency is calculated based on the following conditions: ; Where freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU utilization rate.

3. The method for dynamically adjusting server power consumption as described in claim 1, characterized in that, The preset time period is 1 second.

4. A dynamic power consumption adjustment device for a server, characterized in that, include: The load acquisition module is used to obtain the current load value of the server within the current sampling period. The adjustment module is used to determine whether the fluctuation of the server's working status occurs a preset number of times within a preset time period based on the current load value, and to obtain the determination result; And based on the judgment result, the preset load threshold of the server and the CPU frequency drop latency are adjusted; The frequency adjustment module is used to determine whether the current load value is greater than the preset load threshold: if yes, the CPU frequency of the server is set to the maximum value; if no, the target CPU frequency of the server in the next sampling period is calculated and the CPU frequency of the server is adjusted to the target CPU frequency. The adjustment module includes the following sub-units: The judgment unit is used to determine whether the current load value and the load value of the server in the previous sampling period produce a preset fluctuation value; if so, it records the number of times the preset fluctuation value is produced within the preset time period to obtain the fluctuation count value. An adjustment unit is used to determine whether the number of fluctuations is greater than the preset number: if yes, the preset load threshold and the CPU frequency drop delay are adjusted; if no, the preset load threshold and the CPU frequency drop delay are restored to the preset value.

5. The server power consumption dynamic adjustment device as described in claim 4, characterized in that, The target CPU frequency is calculated based on the following conditions: ; Where freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU utilization rate.

6. The server power consumption dynamic adjustment device as described in claim 4, characterized in that, The preset time period is 1 second.

7. A dynamic power consumption adjustment device for a server, characterized in that, include: The system includes a memory, a processor, and a server power consumption dynamic adjustment program stored in the memory and executable on the processor. When the processor executes the server power consumption dynamic adjustment program, it implements the steps of the server power consumption dynamic adjustment method as described in any one of claims 1-3.

8. A storage medium, characterized in that, The storage medium stores a dynamic adjustment program for server power consumption, which, when executed by a processor, implements the steps in the dynamic adjustment method for server power consumption as described in any one of claims 1-3.

Citation Information

Patent Citations

  • Server power consumption management and control method and system and storage medium

    CN114880192A

  • Flexible power supply MCU dynamic frequency modulation control method and device

    CN119916921B