Node-Red High CPU load after 24 hours

Hello, for a few days now I have had the problem that everything is very slow. For example, no matter where I press a button, it takes a very long time (about 5 seconds) for the assigned light to come on. I noticed that the CPU load on the Raspberry Pi Zero 1 was over 90%. After a "node-red-restart" the CPU utilization is below 10% again for about 24 hours. Then it rises again to over 90.
This has been happening since I updated Node-Red and the palettes.
What is the best way to tackle the problem?

Hig CPU Usage
LOW CPU after Restart

Unfortunately nowhere near enough info to assist. However, some questions that prove common issues are:

Do you run dashboard? If yes, do you use charts? If yes, what settings do you use for the chart, how often do you update it, how many charts?

Do you have MQTT subscription that you then publish to (e.g subscribe topic-x/# > do something > publish topic-x/subtopic)? (This is known as an MQTT loop and it soaks your device)

Do you process large arrays of data?

Do you process images or other large files?

Do you have any flows that link back on themselves (i.e. a loop)

Do you have any for/while loops in function nodes.

The above are very common issues when CPU goes through the roof.

1 Like

Yes, I use the dashboard and diagrams. But nothing is saved permanently. Everything older than one week is overwritten.

This is what my dashboard looks like.

It checks every second whether a signal has been received from the Zigbee temperature sensor and then calculates how many minutes ago the last signal was received.

No pictures or large data. No MQTT subscription either.

I still have about 7 Wifi sockets, Tuya thermostat, RF433 bridge and everything is a bit linked.

I don't know much about function nodes but I use a few.
I have a function node on my RF433 Bridge which starts again from the beginning when the last command was processed by pressing a button. For the battery roller blind this works with a single button. UP STOP DOWN STOP repeat...

Would it help if I uploaded my flows here?

I can also try disabling the dasboard for 24 hours if that would be helpful.

I see 8 graphs (I'm guessing there will be 12 at some point) with 24hrs range?

How often are these graphs sent data? Every second? once per minute? once per hour?

That is very different. The sensor only sends a signal when a value changes. A signal is usually sent between 15 seconds and 10 minutes. Only then is the chart updated.

Everything is still running smoothly.
I think it really is exactly 24 hours until the CPU goes up. The error will probably occur in about 4 hours.

Ok, so lets take best case scenario. Once every 15 secs:

At a guess, these graphs (as I/you see them) occupy around 150pixels in width.

If you send a new measure 15 secs, that is 4 per minute, 240 per hour, 5760 over 24hs. There is simply not enough real-estate on your monitor to draw these. On top of that, 5760 data points are being stored / computed / transmitted redrawn in a graph the width of ~150 pixels.

Now multiply that by 8 graphs (or 12)

I am not saying this is definitely your problem, but we have seen this kind of slow down soooo many times & we know what to point at first.

If, like you say, you get this issue as normal, try disabling all graphs (or do some averaging and only permit updates once per 5 mins) that will keep the data points down to around 288. Just as a trial to see how that fairs.

Is there a way to deactivate the dashboard completely or only the individual ones that are in use like the ui_chart, ui_gauge etc.?

It would be very tedious to inspect all flows now.

I think you can disable the chart nodes from the dashboard side bar.

Alternatively, if they are one one flow tab, you can ctrl+click (multiple select) them then press ctrl+shift+p and type disable selected to do them all at once.

Looks like I won't be spared that.

CPU load is over 1000 again.
Screenshot 2024-03-11 221113

I just find it really strange that this phenomenon only occurred after the update. Had no problem with it for the last two years.

How do I install an older dashboard version?

cd ~/.node-red
sudo systemctl stop nodered
npm install node-red-dashboard@3.6.1
sudo systemctl restart nodered
1 Like

I wanted to share my status and findings here.
The problem seems to have been solved in the meantime.
I got an error message in Putty when I started NodeRed that there were problems with the connection to the Fritzbox. After that I deactivated the flow and since then everything works.
The error occurred after I got a hybrid modem from my internet provider which I connected to the Fritzbox via the WAN port.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.