New to OPNsense - improving power consumption

Started by andrewmoore, September 09, 2023, 02:37:45 PM

Previous topic - Next topic
September 09, 2023, 02:37:45 PM Last Edit: September 09, 2023, 02:45:46 PM by andrewmoore
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.

  • Minimum: Locks the CPU frequency at 800MHz and reduces firewall throughput to a maximum of 400Mb/s on my gigabit connection.
  • Maximum: Locks the CPU frequency at 2200MHz
  • Adaptive: Locks the CPU frequency at 2200MHz
  • Hiadaptive: Locks the CPU frequency at 2200MHz

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.

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).

September 16, 2023, 04:22:10 PM #2 Last Edit: September 16, 2023, 04:25:45 PM by saltyzip
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.

Install htop from mimumail repo and you can enable CPU Freq and temps in it.


Something like this :)

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