Tontonjo / proxmox_toolbox

A toolbox to get the firsts configurations of Proxmox VE / BS done in no time
https://www.youtube.com/c/tontonjo
GNU General Public License v3.0
266 stars 40 forks source link

[FEATURE SUGGESTION] CPU Governor #8

Closed BadCo-NZ closed 2 years ago

BadCo-NZ commented 2 years ago

Hi, I recently setup a second node and came across a few things that might be useful to add to the Toolbox

Third up, is CPU governor.

I generally change this to ondemand on a new install which reduces power consumption but doesn't seem to affect performance.

I do this with the below command:

# echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Then add a cron job to run at each boot:

crontab -e
@reboot echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null 2>&1
Tontonjo commented 2 years ago

Thanks for your suggestion again.

I dont know much about governors, but I'm not much into playing with them on an hypervisor appart if this is part of any official recommandations, documentations, or documented and proved to be reliable without any side effects at all.

What consumption reduction did you experienced? is it really worth-it?

Do you have any proof of work link or tests? Does this have been extensively tested?

BadCo-NZ commented 2 years ago

Hi @Tontonjo,

I originally dug into this when I was first using Proxmox, so I was going off my own documentation. However, I have re-dug and got some results for you.

My system:

Supermicro x10DRG-HT
2x E5-2620v3 85w TDP
8x 8GB Memory
6x SSDs
2x 80mm fans at low RPM
2x 60mm fans at low RPM

With CPU governor set at performance the frequency sits around 3.05Ghz and power draw read from IPMI is 144w.

root@hard1 ~# cpupower frequency-info
analyzing CPU 0:
  driver: intel_cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 20.0 us
  hardware limits: 1.20 GHz - 3.20 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 1.20 GHz and 3.20 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 3.05 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

With CPU governor set at ondemand the frequency sits around 1.29Ghz and power draw from IPMI is 117w.

root@hard1 ~# cpupower frequency-info
analyzing CPU 0:
  driver: intel_cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 20.0 us
  hardware limits: 1.20 GHz - 3.20 GHz
  available cpufreq governors: conservative ondemand userspace powersave performance schedutil
  current policy: frequency should be within 1.20 GHz and 3.20 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 1.29 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

Also, powersave gets me 1.20Ghz and 109w, conservative is 1.20Ghz and 123w. There is definitely some power savings to be had and could be up to 35w on my system and this is only with 85w TDP CPUs. Imagine the savings with 145w TDP CPUs!

Resources

https://wiki.archlinux.org/title/CPU_frequency_scaling#cpupower https://wiki.archlinux.org/title/CPU_frequency_scaling#cpupower https://forum.proxmox.com/threads/fix-always-high-cpu-frequency-in-proxmox-host.84270/ https://old.reddit.com/r/homelab/comments/bltm26/proxmox_power_usagemanagement_still_no_cpu_scaling/ https://community.home-assistant.io/t/psa-how-to-configure-proxmox-for-lower-power-usage/323731

Tontonjo commented 2 years ago

Thanks for this - looks interesting for home setups! I never though about this.

EDIT: just tested on my system - looking promising: S-tui: package power with Performance: env. +30w @ 3.5 Ghz package power with ondemand: env. +28w @ 2.3 Ghz

Tontonjo commented 2 years ago

Hello!

After some testings on some systems, this does not looks to ba a game changer but it may be interesting for some people - Will add this in my Proxmox commands.md.

BadCo-NZ commented 2 years ago

Hello!

After some testings on some systems, this does not looks to ba a game changer but it may be interesting for some people - Will add this in my Proxmox commands.md.

Thanks for looking into :)

BadCo-NZ commented 2 years ago

For others who come across this, check out this script.

https://github.com/tteck/Proxmox/raw/main/misc/scaling-governor.sh

Tontonjo commented 1 year ago

For others who come across this, check out this script.

https://github.com/tteck/Proxmox/raw/main/misc/scaling-governor.sh

Hello! For your information i've make a "tuto" about this who came out yesterday. As there's some kind of energy crysis here i though it may interest people to save some watts and some penny. https://www.youtube.com/watch?v=loV6v--95lA

I also updated the Proxmox commands guide here with thoses new informations: https://github.com/Tontonjo/proxmox

PS: It does not looks like this script can make sure the selected CPU gouvernor is applied after a reboot. is it?