PSA How to configure Proxmox for lower power usage

i’ve tried your sensors but if you are in a vm, the host system is a different one, how you can have it?
thanks

I use Proxmox, which is running on top of a Linux install. You can read the sensors from that host Linux instance to get the actual values of the hardware sensors.

Im interested in changing the governer from HA guest to proxmox host.
The host runs a mythtv backend as well
Id like to run the host in ‘performance’ when any tv is in use but ‘powersave’ at all other times.
I have followed the guidance above but cant see how a guest can control the host in that way, I assume i need to run the command on the host?

Im going on a power saving diet and even thought its a modern host its uses a lot more power in perforance than it does in power save, but powersave causes issues with video playback and performance doesnt.

Thanks

The ‘guest’ can control the Proxmox host if the ‘guest’ can send a command to the Proxmox host.

Suggestion: put some shell scripts on the Proxmox host first.
One script puts the Proxmox host in performance mode, the other script puts the host in power save mode
From the ‘guest’ you execute the scripts remotely at the appropriate moment
Examples how to do that:

You will probably need to use sshpass so that the ‘guest’ can send the password to the Proxmox host to authenticate the ssh session.

But that script doesn’t change it permanently. Does anyone know how to automatically set the governor at boot?

don’t recommend, but
https://www.reddit.com/r/homelab/comments/bltm26/proxmox_power_usagemanagement_still_no_cpu_scaling/emul6ek/

Found another tip to lower a VM’s CPU usage in case you don’t use a GUI in the VM: disable ‘Use pointer for tablet’.
See https://www.reddit.com/r/homelab/comments/q1m383/a_small_but_useful_tip_for_proxmox_users/

5 Likes

For my HA running on proxmox, I added this switch which updates based on the status. Ofc, you have to add your HA authorized keys to proxmox host to skip password check (guide).

switch:
    - platform: command_line
      switches:
        proxmox_turbo:
          friendly_name: Proxmox Turbo
          unique_id: proxmox_turbo_switch
          command_on: ssh -i /config/.ssh/id_rsa root@PROXMOX_HOST 'echo "performance" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'
          command_off: ssh -i /config/.ssh/id_rsa root@PROXMOX_HOST 'echo "powersave" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'
          command_state: ssh -i /config/.ssh/id_rsa root@PROXMOX_HOST 'cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor | grep -oc "performance"'
          icon_template: >-
            {% if states('switch.proxmox_turbo') == on %}
              mdi:speedometer
            {% else %}
              mdi:speedometer-slow
            {% endif %}
7 Likes

Very useful info! Just FYI, from what I read the “powersave” governor locks your CPU at its min frequency. A better choice for most might be the “conservative” governor, which throttles back the CPU when possible but allows clock speeds to return to normal when the CPU is loaded.

It’s also worth mentioning that you may have to set the governor for each core. My /sys/devices/system/cpu/cpufreq/ directory contained four subdirectories - policy0, policy1, policy2, policy3 - and I had to change the scaling_governor file in each. Actually, this could open some interesting possibilities about setting different governors for each core based on your different VMs’ needs.

With the performance governor, my homelab setup (AMD FX-4100 PC, PoE switch, WAP, and small router) was running at ~145W with all four cores pinned at 3.6GHz. Switching the “powersave” reduced power use to ~104W, and all four cores were pinned at 1.4GHz. With “conservative”, my power use seems to have stabilized around 106W. I’m seeing cores constantly fluctuating between 1.4GHz and 3.6GHz, with the occasional spike to ~4GHz. Odd, I didn’t think my CPU turbo boosted. Perhaps an artifact?

Clock frequencies were observed with watch -n.1 "grep \"^[c]pu MHz\" /proc/cpuinfo".

I’m wondering if further tuning is possible to get consumption down. Not sure if I can mess with governor settings within each VM? Or perhaps messing with CPU affinity?

2 Likes

How cool is this!
Thanx for sharing information!!!

Just curious:
I recently switched to proxmox on a Dell OptiPlex 7050:

  • 3.4 GHz Intel Core i5-7500 Quad-Core
  • 32GB of 2400 MHz DDR4 RAM
  • 512GB SSD NVMe PCIe
  • no spinning disks

baseline of my power consumption: 28W (thus without any VM running)

Is this OK? Some people suggest that it is rather high, but when I run

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

there is no change in power consumption.

kind regards,
Bart

on my old I5 7200u and proxmox, Powersave definitely does not lock freq to the minimum. It scales as needed and expected.

my i5-9500 also scales when needed.

1 Like

Hey, I’m quite new to Proxmox and just wanted to ask if someone can give me a more detailed guide on how to do this. I don’t know what a node nor I know what a shell is. Hope someone can help me, thanks

Click on the Node which is your server hosting the virtual machines and then click on Shell to open up a command shell where you can type in the commands to change to the powersave governor.

image

This video may help you Proxmox VE Full Course: Class 12 - The Command-Line Interface - YouTube

This is high. Maybe check in BIOS of C-states are enabed?

I have two of these, and it can idle at 10 W. Personally, I’ve went from 36 W average to 19 W average after switching to powersave.

Optiplex 3050
i5-6500
1x M2 SSD
2x RAM stick
1x enterprise Toshiba HDD
2x USB adapters
~3-4 VMs running

Thanks for posting this. I was able to cut ~10-12 w by simply switching to ondemand. Granted my system is above a lot of what is posted but the Proxmox server (14 core w/ 128 GB of RAM) is running my firewall (with 2 - 10Gbps interfaces), a TrueNAS server with 16 TB of storage, frigate for 3 HD cameras, etc. Idle load is about 50w. Operational used to be slightly over 100w and now it is sitting at 90w. I’ll take a 10% improvement for flipping a few settings. Thanks!!!

The config change was a bit after noon on 15 Nov. Initially I did powersave but the average from ondemand is nearly the same so seems like the better choice for my system.

1 Like

Golden tip! Thanks!

1 Like

How are monitor the power consumption using HA? Proxmox integration?

I am using an external power meter like https://a.co/d/eBqGuxJ

1 Like