OPNsense Forum

English Forums => Hardware and Performance => Topic started by: andrewmoore on September 09, 2023, 02:37:45 PM

Title: New to OPNsense - improving power consumption
Post by: andrewmoore on September 09, 2023, 02:37:45 PM
Hi all,

I've recently jumped into the OPNsense world, with a Supermicro 5019A-FTN4 (Atom C3758) and Intel X520-DA2 NIC. Running OPNsense 23.7.3.

Loving the OS so far, however, the power consumption of the device seems quite high given the load it's under.

It's consuming around 35W, which is about the maximum possible, and the CPU is pegged at maximum frequency (2.2GHz). Despite the system only being under minor CPU load (0-20%) most of the time.

My initial research pointed me at enabling PowerD and experimenting with the power mode settings. This does change the behaviour, but not in particularly desirable ways.

The correct frequency options are detected:
dev.cpu.0.freq_levels: 2200/0 2100/0 2000/0 1900/0 1800/0 1700/0 1600/0 1500/0 1400/0 1300/0 1200/0 1100/0 1000/0 900/0 800/0

Here are the c-states:
sysctl dev.cpu | grep cx
...
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.0.cx_usage_counters: 94456259 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 123us
dev.cpu.0.cx_lowest: C1
dev.cpu.0.cx_supported: C1/1/1 C2/2/50


I'd like Adaptive or Hiadaptive to actually adapt, and lower the frequency when the system is idling, which is most of the time. Only ramping up when required.

Any pointers on where to start investigating next would be great. Thanks in advance.
Title: Re: New to OPNsense - improving power consumption
Post by: abulafia on September 09, 2023, 11:17:46 PM
There are several forum threads on power consumption.

One in particular recommended using powerdxx and playing around with the C states. Try here: https://forum.opnsense.org/index.php?topic=28033.0

But generally speaking, a firewall is unlikely to reach high C states because it will invariably be woken up by incoming traffic (= interrupts). Plus, certain NICS or NIC settings will prevent high C states (example: Intel 1G NIC, an i219 IIRC, will prevent high C states if you enable jumbo frames).
Title: Re: New to OPNsense - improving power consumption
Post by: saltyzip on September 16, 2023, 04:22:10 PM
PowerD enabled in the GUI (Settings->Miscellaneous) with Adaptive and HiAdaptive should in theory not lock the CPU, it hasn't in my experience.

How are you checking the frequency, using either sysctl hw.clockrate or sysctl dev.cpu.0.freq?

I wish we could see this in the GUI, like pfsense.

The command powerd -v shows realtime tracking of the freq.
Title: Re: New to OPNsense - improving power consumption
Post by: newsense on September 16, 2023, 04:58:56 PM
Install htop from mimumail repo and you can enable CPU Freq and temps in it.
Title: Re: New to OPNsense - improving power consumption
Post by: maclinuxfree on September 16, 2023, 05:24:45 PM
cpufreq in htop? how should that work?
Title: Re: New to OPNsense - improving power consumption
Post by: newsense on September 16, 2023, 11:09:25 PM
Something like this :)

As I said, it's not enabled by default, you need to enable it in htop settings