OPNsense Forum

Archive => 23.7 Legacy Series => Topic started by: beneix on December 02, 2023, 07:59:46 PM

Title: Much higher CPU use after upgrade from 23.1.9
Post by: beneix on December 02, 2023, 07:59:46 PM
Having just upgraded to 23.7.9, I am seeing much higher CPU usage than before, and the unit runs much warmer. While it isn't getting critical, I would like to understand what has changed and if there are parameters I should change or something I should fix.

Before the upgrade, the CPU usage would stay below 10% all the time except when there was heavy traffic such as a download or HD video streaming. Now, even when there is no traffic, it oscillates between 0% and 100%:
(https://i.ibb.co/0Z2hvWq/Screenshot-2023-12-02-194955.png)

The CPU used to run at 61 degrees, now it is at 65.

Where should I start looking for the cause?
Title: Re: Much higher CPU use after upgrade from 23.1.9
Post by: thebull on December 03, 2023, 10:03:25 AM
You need to find out which proces is causing the spikes. Process manager in the GUI or via CLI.


Verzonden vanaf mijn iPhone met Tapatalk
Title: Re: Much higher CPU use after upgrade from 23.1.9
Post by: beneix on December 03, 2023, 08:01:32 PM
Thanks. This looks like a potential culprit:

PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU COMMAND
80468 root 86 0 54M 33M CPU1 1 443:26 100.00% /usr/local/bin/python3 /usr/local/opnsense/scripts/netflow/flowd_aggregate.py (python3.9)


Has anything changed regarding python or netflow between 23.1 and 23.7?
Title: Re: Much higher CPU use after upgrade from 23.1.9
Post by: dinguz on December 03, 2023, 08:17:34 PM
It sometimes does that, unfortunately; presumably it stems from silent Netflow database corruption. You can try to repair or delete the Netflow database, or disable Netflow altogether (Reporting:Netflow and Reporting:Settings).
Title: Re: Much higher CPU use after upgrade from 23.1.9
Post by: beneix on December 04, 2023, 09:20:38 AM
Thanks dinguz. I reset the Netflow data – no difference. I repaired the database – no difference. I rebooted OPNSense. After this, at first it seemed there was no difference, but then I noticed that ddclient seemed to feature high in the process list (sorted on WCPU).

I remembered that I had changed the ddclient back-end from ddclient to native after reading the release notes for 23.7.9, so I changed it back to ddclient. Now the overall CPU activity is ever so slightly lower, but there is still a lot more going on than before the upgrade.

Netflow remains with high WCPU in the list.
PID USERNAME PRI NICE SIZE RES STATE C TIME WCPU COMMAND
15527 root 96 0 30M 20M CPU1 1 14:19 99.55% /usr/local/bin/python3 /usr/local/opnsense/scripts/netflow/flowd_aggregate.py (python3.9)
Title: Re: Much higher CPU use after upgrade from 23.1.9
Post by: iMx on December 04, 2023, 09:49:24 AM
Quote from: beneix on December 04, 2023, 09:20:38 AM
Now the overall CPU activity is lower, but there is still a lot more going on than before the upgrade.

I think you're a little late to the 23.7.x 'party' - as it were.

I'm pretty sure I remember seeing a number of discussions on this when it was first released, perhaps going back to the 'early days' of the 23.7 forum?

... gateway_watcher.php springs to mind:

https://forum.opnsense.org/index.php?topic=35219.0