Dynamic adjustment method and device for server power consumption and storage medium

By dynamically adjusting the server's CPU frequency and adjusting the preset load threshold and frequency reduction delay according to the number of load fluctuations, the performance loss problem of the server in short task scenarios is solved, and low-power and high-performance operation is achieved.

CN120723481AActive Publication Date: 2025-09-30BLUECORE COMPUTING POWER (SHENZHEN) TECHNOLOGY CO LTD

Patent Information

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

AI Technical Summary

Technical Problem

In dynamic frequency scaling mode, when a server faces frequent short-term "idle-busy-idle-busy" tasks, it cannot achieve maximum performance, resulting in performance loss.

Method used

By obtaining the current server load value, determining the number of load fluctuations, adjusting the preset load threshold and CPU frequency reduction delay, and dynamically adjusting the CPU frequency to adapt to load changes.

Benefits of technology

Effectively reduce power consumption while maximizing server performance under various load scenarios, reducing frequent CPU frequency adjustments and improving system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120723481A_ABST
    Figure CN120723481A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of computers, and particularly relates to a dynamic adjustment method and device for server power consumption and a storage medium. The dynamic adjustment method comprises the following steps: acquiring a current load value of a server in a current sampling period; judging whether the fluctuation of the working state of the server generates a preset number of times in a preset time period or not according to the current load value, and adjusting a preset load threshold value of the server and the CPU frequency drop time delay; whether the current load value is larger than a preset load threshold value or not is judged; if yes, the CPU frequency of the server is set to be the maximum value; if not, 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. Compared with the prior art, the method has the advantages that short periodic task characteristics can be captured, the CPU frequency reduction time delay and the preset load threshold value can be automatically changed, and dynamic frequency modulation is performed on the CPU, so that the power consumption can be reduced, and the maximum performance of the server in various load scenes can be exerted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention is applicable to the field of computer technology, and in particular relates to a method, device and storage medium for dynamically adjusting server power consumption. Background Art

[0002] With the development of the computer industry, servers have become widely used. However, servers have high power consumption and require constant online operation. Therefore, unlike personal computers or mobile devices, they cannot be set to standby or hibernation when not in use to achieve energy conservation. Furthermore, since servers are primarily used for commercial purposes and are expensive, their performance resources should be maximized when processing tasks. While ensuring optimal performance, it is also important to focus on reducing power consumption and energy conservation and emissions. Reducing the average power consumption of a single server can significantly save electricity costs in scenarios such as data centers.

[0003] To meet low-power requirements for servers, the CPUFreq framework is often used. The CPUFreq framework selects a frequency policy for the CPU and dynamically adjusts the CPU frequency and voltage. The CPUFreq framework provides a unified interface across platforms for setting hardware status and obtaining hardware information. The specific frequency adjustment method is determined by different CPUFreq policies.

[0004] The CPUFreq policy includes the following five policies: 1) Performance policy (cpufreq_performance): The CPU runs at the highest frequency, that is, the maximum frequency (scaling_max_freq).

[0005] 2) On-demand policy (cpufreq_ondemand): The CPU runs at a low frequency normally and increases the frequency on demand when the system load increases.

[0006] 3) Conservative strategy (cpufreq_conservative): Similar to the on-demand strategy, except that it uses a gradual approach when changing the dynamic frequency.

[0007] 4) Power saving policy (cpufreq_powersave): The CPU runs at the lowest frequency, that is, the minimum frequency (scaling_min_freq).

[0008] 5) Userspace policy (cpufreq_userspace): Allow root users to set the frequency through the sys node (scaling_setspeed).

[0009] The on-demand policy includes the ignore low-priority load parameter (ignore_nice_load), power saving bias parameter (powersave_bias), frequency reduction sampling factor parameter (sampling_down_factor), sampling rate parameter (sampling_rate), and frequency increase threshold parameter (up_threshold); ignore_nice_load is used to count process loads with a nice value greater than 0 as idle, and powersave_bias is a parameter that affects frequency decision-making; sampling_down_factor is used to determine how many cycles the CPU frequency will be reduced after the system load falls below the threshold, sampling_rate is the sampling interval, and up_threshold is used to increase the load threshold for the CPU frequency.

[0010] By using an on-demand policy, if you want the CPU to run at a high frequency for a longer period of time, increase the sampling_down_factor value. If you need to make it easier to run at a high frequency, lower the up_threshold value. However, it's important to find a balance when tuning these parameters. If they are set too high, power consumption in idle mode will increase because some system processes that periodically wake up will periodically increase the frequency.

[0011] However, while not considering scenarios like standby and hibernation, the Linux kernel also uses existing frameworks such as CPUidle and CPUFreq to reduce power consumption when the system is continuously powered on. Even to address current load levels, CPU voltage and operating frequency can be dynamically adjusted to adapt to varying CPU load utilization (e.g., CPUFreq's on-demand policy). Based on the on-demand policy, when a server's operating state frequently experiences a short cycle of "idle (T1)-busy (T2)-idle (T3)-busy (T4)", frequent CPU frequency changes will be triggered, impacting program performance in this scenario. This is because during the T1 period, the CPU frequency is low due to idle load. When the T2 period arrives, the increased load requires a frequency increase. However, CPU frequency increases require a process, including delays in the software's calculation of load-adjusted frequency and the latency of the CPU frequency hardware itself. Therefore, during the busy period of T2, programs do not always run at the highest CPU frequency, inevitably resulting in performance loss. During the T3 and T4 periods, a new frequency adjustment cycle will re-enter, impacting server performance.

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

[0013] The present invention provides a method, device and storage medium for dynamically adjusting server power consumption, aiming to resolve the contradiction that the server cannot maximize its performance in dynamic frequency modulation mode for short task scenarios such as frequent "idle-busy-idle-busy" cycles.

[0014] In a first aspect, the present invention provides a method for dynamically adjusting server power consumption, the method comprising the following steps: S1. Obtain the current load value of the server in the current sampling period; S2. Determine, based on the current load value, whether the fluctuation of the working state of the server occurs a preset number of fluctuations within a preset time period, and obtain a determination result; and adjust a preset load threshold and a CPU frequency reduction delay of the server based on the determination result; S3. Determine whether the current load value is greater than the preset load threshold: if so, set the CPU frequency of the server to the maximum value; if not, 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.

[0015] Preferably, step S2 includes the following sub-steps: S21. Determine whether the current load value and the load value of the server in the previous sampling period generate a preset fluctuation value: if so, record the number of times the preset fluctuation value is generated within the preset time period to obtain a fluctuation number value; S22. Determine whether the number of fluctuations is greater than the preset number: if so, adjust the preset load threshold and the CPU frequency reduction delay; if not, restore the preset load threshold and the CPU frequency reduction delay to the preset value.

[0016] Preferably, the target CPU frequency is calculated according to the following conditions: ; Wherein, freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU usage.

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

[0018] In a second aspect, the present invention further provides a device for dynamically adjusting server power consumption, comprising: The load acquisition module is used to obtain the current load value of the server in the current sampling period; an adjustment module, configured to determine, based on the current load value, whether the fluctuation of the working state of the server occurs a preset number of times within a preset time period, and obtain a determination result; and adjust a preset load threshold and a CPU frequency reduction delay of the server based on the determination result; The frequency adjustment module is used to determine whether the current load value is greater than the preset load threshold: if so, the CPU frequency of the server is set to the maximum value; if not, 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.

[0019] Preferably, the adjustment module includes the following subunits: a determination unit, configured to determine whether the current load value and the load value of the server in the previous sampling period generate a preset fluctuation value; if so, recording the number of times the preset fluctuation value is generated within the preset time period to obtain a fluctuation number value; An adjustment unit is used to determine whether the number of fluctuations is greater than the preset number: if so; if not, the preset load threshold and the CPU frequency reduction delay are restored to the preset value, and the preset load threshold and the CPU frequency reduction delay are adjusted.

[0020] Preferably, the target CPU frequency is calculated according to the following conditions: ; Wherein, freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU usage.

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

[0022] In a third aspect, the present invention also provides a device for dynamically adjusting server power consumption, comprising: a memory, a processor, and a dynamic adjustment program for server power consumption stored on the memory and runnable on the processor, wherein the processor implements the steps of the method for dynamically adjusting server power consumption as described in any one of the above embodiments when executing the dynamic adjustment program for server power consumption.

[0023] In a fourth aspect, the present invention also provides a storage medium, on which a dynamic adjustment program for server power consumption is stored. 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 one of the above embodiments are implemented.

[0024] Compared with the prior art, the present invention obtains the current load value of the server in the current sampling period; determines whether the fluctuation of the working state of the server 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 of the server and the CPU frequency reduction delay based on the judgment result; determines whether the current load value is greater than the preset load threshold: if so, the CPU frequency of the server is set to the maximum value; if not, 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 present invention can capture the characteristics of short-periodic tasks, automatically change the CPU frequency reduction delay and the preset load threshold, and by dynamically adjusting the CPU frequency, it can reduce power consumption and maximize the performance of the server under various load scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] The present invention will be described in detail below with reference to the accompanying drawings. The above and other aspects of the present invention will become clearer and easier to understand through the detailed description made with reference to the following drawings. In the accompanying drawings: Figure 1 This is a flowchart of a method for dynamically adjusting server power consumption provided by an embodiment of the present invention; Figure 2 1 is a schematic structural diagram of a device for dynamically adjusting server power consumption provided by an embodiment of the present invention; Figure 3 It is a structural diagram of another device for dynamically adjusting server power consumption provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present 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 only used to explain the present invention and are not intended to limit the present invention.

[0027] Example 1 Please refer to Figure 1 The present invention provides a method for dynamically adjusting server power consumption, the method comprising the following steps: S1. Obtain the current load value of the server in the current sampling period.

[0028] In the embodiment of the present invention, based on the ondemand strategy, the current load value of the server is obtained and the corresponding parameters are dynamically adjusted. The parameter settings of the server can be referred to Table 1:

Table 1

[0029] Specifically, the present invention uses the frequency modulation decision function od_update function in the ondemand policy to calculate the time proportion of the CPU in the user state, kernel state, and idle state, and updates the current load value, thereby obtaining the current load value.

[0030] S2. Determine whether the fluctuation of the working status of the server occurs a preset number of times within a preset time period based on the current load value, and obtain a judgment result; and adjust the preset load threshold of the server and the CPU frequency reduction delay based on the judgment result.

[0031] In the embodiment of the present invention, whether the working status of the server changes frequently within a short period is determined in the following specific manner: S21. Determine whether the current load value and the server load value in the previous sampling period generate a preset fluctuation value. If so, 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. The preset time period and the preset fluctuation value can be set according to circumstances and are not limited to 1 second.

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

[0033] S22. Determine whether the number of fluctuations is greater than a preset number, and obtain a judgment result: if the judgment result is yes, it indicates that the working state of the server fluctuates frequently within a preset time period (that is, the number of fluctuations exceeding the preset number indicates frequent fluctuations), and its working state is "idle (T1) - busy (T2) - idle (T3) - busy (T4)". The preset load threshold and the CPU frequency reduction delay are adjusted; if the judgment result is no, the preset load threshold and the CPU frequency reduction delay are restored to the preset value (that is, the default value, such as the CPU frequency reduction delay in Table 1 is 1, and the preset load threshold is 95).

[0034] Specifically, when the current load value is updated based on the dbs_update function, a count is performed to determine whether load fluctuations occur within a preset time period. If the number of fluctuations within 1 second is greater than the preset number of fluctuations, the CPU frequency reduction delay and the preset load threshold used to determine whether to reduce the CPU frequency are adjusted. By adjusting the preset load threshold and the CPU frequency reduction delay, it is possible to prevent the CPU from meeting the conditions for reducing the frequency in the short term once the frequency is increased. As long as the idle time in the T3 period is short, the average load of the server system will decrease but will still be greater than the "adjusted" threshold. When the server's working status ends from frequent fluctuations, the number of fluctuations counted will be used to determine, and the CPU frequency reduction delay and the preset load threshold will be restored to the preset values ​​(for example, the preset load threshold is 95).

[0035] 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. If 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 ramp-down delay are simultaneously adjusted (i.e., the preset load threshold is lowered and the CPU frequency ramp-down delay is increased, making it easier for the CPU frequency to operate at high frequency and for longer periods at high frequency, thus avoiding frequent frequency adjustments). This allows the CPU frequency to quickly reach its maximum frequency. The adjustment values ​​can be adjusted based on actual conditions. CPU frequency adjustment is based on the CPU frequency adjustment driver (cpufreq_driver). For example, during server operation, the frequency can be rapidly increased during sudden high loads, while frequency adjustment overhead can be reduced during sustained, stable loads. The load value for the current sampling period (i.e., the current load value) is also recorded and compared with the load value from the next sampling period during the next sampling period.

[0036] For example, server load scenarios are categorized into three types: sudden high load, sustained medium load, and drastically fluctuating load. In the case of sudden high load, if the sampling period detects that the current load value is 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, the frequency reduction logic is activated. In the case of sustained medium load, if the load stabilizes at 60%, the target frequency (e.g., 1.26GHz) is calculated proportionally and gradually reduced to this value. If there are no significant fluctuations, the default parameters are maintained to avoid frequent adjustments and reduce power consumption. In the case of drastically fluctuating load, such as if the load fluctuates between 30% and 90% 10 times within a preset time period within 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, the frequency reduction logic is activated.

[0037] S3. Determine whether the current load value is greater than the preset load threshold: if so, set the CPU frequency of the server to the maximum value; if not, 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.

[0038] In an embodiment of the present invention, by determining 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 the present invention are cyclical steps, meaning that steps S1-S3 can be performed again during the next sampling cycle, allowing the server's CPU frequency to be dynamically adjusted based on actual conditions, thereby achieving server load adaptation.

[0039] 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 usage. Load is calculated using the following conditions: ; Where time_elapsed is the time difference between two samples calculated using 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.

[0040] Compared with the prior art, the present invention obtains the current load value of the server in 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 server's preset load threshold and CPU frequency reduction delay 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 server's target CPU frequency in the next sampling period is calculated and the server's CPU frequency is adjusted to the target CPU frequency. The present invention can capture the characteristics of short-periodic tasks, automatically change the CPU frequency reduction delay and preset load threshold, and by dynamically adjusting the CPU frequency, it can reduce power consumption while maximizing the server's performance under various load scenarios.

[0041] Example 2 The embodiment of the present invention also provides a dynamic adjustment device for server power consumption, please refer to Figure 2 , Figure 2 2 is a schematic structural diagram of a device 200 for dynamically adjusting server power consumption according to an embodiment of the present invention, which includes: 201. A load acquisition module is used to obtain the current load value of the server in the current sampling period.

[0042] Specifically, the present invention uses the frequency modulation decision function od_update function in the ondemand policy to calculate the time proportion of the CPU in the user state, kernel state, and idle state, and updates the current load value, thereby obtaining the current load value.

[0043] 202. An adjustment module, configured to determine, based on the current load value, whether the fluctuation of the working state of the server occurs a preset number of times within a preset time period, and obtain a determination result; and adjust a preset load threshold and a CPU frequency reduction delay of the server based on the determination result; In this embodiment of the present invention, the adjustment module 202 includes the following subunits: 2021. A determination unit, configured to determine whether the current load value and the load value of the server in the previous sampling period generate a preset fluctuation value, and 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 circumstances and are not limited to 1 second.

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

[0045] 2022. An adjustment unit, configured to determine whether the number of fluctuations is greater than a preset number: if so, adjusting the preset load threshold and the CPU frequency reduction delay; if not, restoring the preset load threshold and the CPU frequency reduction delay to a preset value (i.e., a default value, such as 1 for the CPU frequency reduction delay and 95 for the preset load threshold in Table 1).

[0046] Specifically, by judging whether the number of fluctuations is greater than the preset number, temporary load changes and continuous load trends can be effectively distinguished to prevent frequent frequency switching. When the number of fluctuations exceeds the preset number, it means that the CPU frequency of the server needs to be adjusted to the maximum value as soon as possible. Therefore, the preset load threshold and the CPU frequency drop delay are adjusted at the same time (that is, 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 frequency and run at high frequency for a longer period), so that the CPU frequency can quickly enter the maximum frequency. The adjusted value can be adjusted according to actual conditions. For example, when the server is running, the frequency is quickly increased when there is a sudden high load, and the frequency adjustment overhead is reduced when the load is continuously stable. At the same time, the load value of this sampling period (that is, the current load value) is recorded, and compared with the load value of the next sampling period in the next sampling period.

[0047] For example, server load scenarios are categorized into three types: sudden high load, sustained medium load, and drastically fluctuating load. In the case of sudden high load, if the sampling period detects that the current load value is 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, the frequency reduction logic is activated. In the case of sustained medium load, if the load stabilizes at 60%, the target frequency (e.g., 1.26GHz) is calculated proportionally and gradually reduced to this value. If there are no significant fluctuations, the default parameters are maintained to avoid frequent adjustments and reduce power consumption. In the case of drastically fluctuating load, such as if the load fluctuates between 30% and 90% 10 times within a preset time period within 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, the frequency reduction logic is activated.

[0048] 203. A frequency adjustment module, configured to determine whether the current load value is greater than the preset load threshold: if so, setting the CPU frequency of the server to a maximum value; if not, calculating the target CPU frequency of the server in the next sampling period and adjusting the CPU frequency of the server to the target CPU frequency.

[0049] In an embodiment of the present 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 frequent "idle-busy-idle-busy" short task scenarios.

[0050] 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 usage. Load is calculated using the following conditions: ; Where time_elapsed is the time difference between two samples calculated using 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.

[0051] The server power consumption dynamic adjustment device 200 can implement the steps in the server power consumption dynamic adjustment method in the above embodiment and can achieve the same technical effects. Please refer to the description in the above embodiment and will not be repeated here.

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

[0053] The processor 301 calls the dynamic adjustment program of the server power consumption stored in the memory 302 and executes the steps of the dynamic adjustment method of the server power consumption provided by the embodiment of the present invention. Figure 1 , specifically including the following steps: S1. Obtain the current load value of the server in the current sampling period.

[0054] In an embodiment of the present invention, based on the ondemand policy, the current load value of the server is obtained and corresponding parameters are dynamically adjusted. Specifically, the present invention uses the frequency adjustment decision function od_update in the ondemand policy to calculate the proportion of time the CPU spends in user mode, kernel mode, and idle state, and updates the current load value to obtain the current load value.

[0055] S2. Determine, based on the current load value, whether the fluctuation of the working status of the server occurs a preset number of times within a preset time period, and obtain a judgment result; and adjust the preset load threshold of the server and the CPU frequency reduction delay based on the judgment result.

[0056] In this embodiment of the present invention, step S2 includes the following sub-steps: Determine whether the current load value and the server's load value in the previous sampling period generate a preset fluctuation value, and 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 circumstances and are not limited to 1 second.

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

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

[0059] Specifically, by judging whether the number of fluctuations is greater than the preset number, temporary load changes and continuous load trends can be effectively distinguished to prevent frequent frequency switching. When the number of fluctuations exceeds the preset number, it means that the CPU frequency of the server needs to be adjusted to the maximum value as soon as possible. Therefore, the preset load threshold and the CPU frequency reduction delay are adjusted at the same time to allow the CPU frequency to quickly enter the maximum frequency. The adjusted value can be adjusted according to actual conditions. For example, when the server is running, the frequency is quickly increased when there is a sudden high load, and the frequency adjustment overhead is reduced when the load is continuously stable. At the same time, the load value of this sampling period (i.e., the current load value) is recorded, and compared with the load value of the next sampling period in the next sampling period.

[0060] For example, server load scenarios are categorized into three types: sudden high load, sustained medium load, and drastically fluctuating load. In the case of sudden high load, if the sampling period detects that the current load value is 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, the frequency reduction logic is activated. In the case of sustained medium load, if the load stabilizes at 60%, the target frequency (e.g., 1.26GHz) is calculated proportionally and gradually reduced to this value. If there are no significant fluctuations, the default parameters are maintained to avoid frequent adjustments and reduce power consumption. In the case of drastically fluctuating load, such as if the load fluctuates between 30% and 90% 10 times within a preset time period within 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, the frequency reduction logic is activated.

[0061] S3. Determine whether the current load value is greater than the preset load threshold: if so, set the CPU frequency of the server to the maximum value; if not, 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.

[0062] In an embodiment of the present invention, by determining 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 the present invention are cyclical steps, meaning that steps S1-S3 can be performed again during the next sampling cycle, allowing the server's CPU frequency to be dynamically adjusted based on actual conditions, thereby achieving server load adaptation.

[0063] 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 usage. Load is calculated using the following conditions: ; Where time_elapsed is the time difference between two samples calculated using 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.

[0064] The dynamic adjustment device 300 for server power consumption provided in an embodiment of the present invention can implement the steps in the dynamic adjustment method for server power consumption in the above embodiment and can achieve the same technical effects. Please refer to the description in the above embodiment and will not repeat it here.

[0065] Example 4 An embodiment of the present invention also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a dynamic adjustment program for server power consumption. When the dynamic adjustment program for server power consumption is executed by a processor, the various processes and steps in the dynamic adjustment method for server power consumption provided in an embodiment of the present invention are implemented, and the same technical effects can be achieved. To avoid repetition, they will not be described here.

[0066] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program for dynamically adjusting server power consumption can be stored in a computer-readable storage medium. When executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0067] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.

[0068] Through the above description of the embodiments, those skilled in the art will clearly understand that the methods of the above embodiments can be implemented using software plus the necessary general-purpose hardware platform. Of course, hardware can also be used, but in many cases the former is the more preferred implementation method. Based on this understanding, the technical solution of the present invention, or the portion 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, or optical disk) and includes a number of instructions for enabling a terminal (such as a mobile phone, computer, server, air conditioner, or network device) to execute the methods described in the various embodiments of the present invention.

[0069] The embodiments of the present invention are described above in conjunction with the accompanying drawings. What is disclosed is only a preferred embodiment of the present invention. However, the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms and equivalent changes without departing from the scope of protection of the purpose of the present invention and the claims, which are all within the protection of the present invention.

Claims

1. A method for dynamically adjusting server power consumption, characterized in that: The dynamic adjustment method comprises the following steps: S1. Obtain the current load value of the server in the current sampling period; S2. Determine, based on the current load value, whether the fluctuation of the working state of the server occurs a preset number of times within a preset time period, and obtain a determination result; and adjust a preset load threshold and a CPU frequency reduction delay of the server based on the determination result; S3. Determine whether the current load value is greater than the preset load threshold: if so, set the CPU frequency of the server to the maximum value; if not, 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.

2. The method for dynamically adjusting server power consumption according to claim 1, wherein: Step S2 includes the following sub-steps: S21. Determine whether the current load value and the load value of the server in the previous sampling period generate a preset fluctuation value: if so, record the number of times the preset fluctuation value is generated within the preset time period to obtain a fluctuation number value; S22. Determine whether the number of fluctuations is greater than the preset number: if so, adjust the preset load threshold and the CPU frequency reduction delay; if not, restore the preset load threshold and the CPU frequency reduction delay to the preset value.

3. The method for dynamically adjusting server power consumption according to claim 1, wherein: The target CPU frequency is calculated based on the following conditions: ; Wherein, freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU usage.

4. The method for dynamically adjusting server power consumption according to claim 2, wherein: The preset time period is 1 second.

5. A dynamic adjustment device for server power consumption, characterized in that: include: The load acquisition module is used to obtain the current load value of the server in the current sampling period; an adjustment module, configured to determine, based on the current load value, whether the fluctuation of the working state of the server occurs a preset number of times within a preset time period, and obtain a determination result; and adjusting the preset load threshold and CPU frequency reduction delay of the server according to the judgment result; The frequency adjustment module is used to determine whether the current load value is greater than the preset load threshold: if so, the CPU frequency of the server is set to the maximum value; if not, 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.

6. The dynamic adjustment device for server power consumption according to claim 5, characterized in that: The adjustment module includes the following subunits: a determination unit, configured to determine whether the current load value and the load value of the server in the previous sampling period generate a preset fluctuation value; if so, recording the number of times the preset fluctuation value is generated within the preset time period to obtain a fluctuation number value; An adjustment unit is used to determine whether the number of fluctuations is greater than the preset number: if so, the preset load threshold and the CPU frequency reduction delay are adjusted; if not, the preset load threshold and the CPU frequency reduction delay are restored to the preset value.

7. The dynamic adjustment device for server power consumption according to claim 5, characterized in that: The target CPU frequency is calculated based on the following conditions: ; Wherein, freqnext represents the target CPU frequency, minf represents the minimum CPU frequency, maxf represents the maximum CPU frequency, and load represents the CPU usage.

8. The dynamic adjustment device for server power consumption according to claim 6, characterized in that: The preset time period is 1 second.

9. A dynamic adjustment device for server power consumption, characterized in that: include: A memory, a processor, and a dynamic adjustment program for server power consumption stored in the memory and executable on the processor, wherein the processor implements the steps of the method for dynamic adjustment of server power consumption as described in any one of claims 1 to 4 when executing the dynamic adjustment program for server power consumption.

10. A storage medium, characterized in that: The storage medium stores a dynamic adjustment program for server power consumption. When the dynamic adjustment program for server power consumption is executed by the processor, the steps of the method for dynamic adjustment of server power consumption according to any one of claims 1 to 4 are implemented.

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

  • Power consumption adjustment method and apparatus

    US20240168538A1

  • CPU frequency control device, CPU frequency control method, CPU frequency control program, and CPU frequency control system

    WO2024261900A1

Cited By

  • Multi-threshold on-demand equipment frequency modulation method based on steady state

    CN121255370A