# Unusually High CPU Usage on Raspberry Pi 3 at Startup

**URL:** <https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920>\
**Category:** General\
**Created:** [10 October 2023 14:24 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920 "2023-10-10T14:24:07Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [10 October 2023 14:24 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/1 "2023-10-10T14:24:07Z")

</div>

Hi

I have successfully installed and run Node-RED on many Raspberry Pi systems to date, however my latest install has shown strange CPU activity at start-up.

Following start-up of a clean system build, with no other programmes, no extra nodes and no flows, initially `top` shows node-red ~200% CPU and 7.0% MEM then after around four minutes it drops to 0.0% CPU and 7.0% MEM. The same high / low sequence occurs every time the system is booted up.

> Hardware : Raspberry Pi 3 Model B Plus Rev 1.3  
> OS : Linux 11 (bullseye) / 32 bit  
> Node-RED Core : 3.1.0  
> Node : v18.18.0  
> Npm : 9.8.1

the image was flashed using Raspberry Pi Imager v1.7.4 (I have tried with both HDD and SD - same result).

Installation sequence from new image:

> sudo apt-get update  
> sudo apt-get upgrade  
> sudo reboot now  
> bash \<(curl -sL [https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered](https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered))  
> sudo systemctl enable nodered.service  
> sudo reboot now

I am no expert, but `syslog` does not seem to show any issues. A filtered dump using `COMMAND=Node-RED` looks normal to me...

> Oct 10 13:04:52 Apollo systemd[1]: Started Node-RED graphical event wiring tool.  
> Oct 10 13:04:57 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info]  
> Oct 10 13:04:58 Apollo Node-RED[359]: Welcome to Node-RED  
> Oct 10 13:04:58 Apollo Node-RED[359]: ===================  
> Oct 10 13:04:58 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info] Node-RED version: v3.1.0  
> Oct 10 13:04:58 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info] Node.js version: v18.18.0  
> Oct 10 13:04:58 Apollo Node-RED[359]: 10 Oct 13:04:57 - [info] Linux 6.1.21-v7+ arm LE  
> Oct 10 13:05:01 Apollo Node-RED[359]: 10 Oct 13:05:01 - [info] Loading palette nodes  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Settings file : /home/pi/.node-red/settings.js  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Context store : 'default' [module=memory]  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] User directory : /home/pi/.node-red  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [warn] Projects disabled : editorTheme.projects.enabled=false  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Flows file : /home/pi/.node-red/flows.json  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Creating new flow file  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [warn] Encrypted credentials not found  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Starting flows  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Started flows  
> Oct 10 13:05:05 Apollo Node-RED[359]: 10 Oct 13:05:05 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)

I only have one Raspberry Pi 3 available so cannot swap out the hardware but I tried `sudo memtester 500 1` which didn't show any failures. It is worth noting though that the issue does not occur when installing the same clean build on a Pi 4!

Any thoughts?

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 October 2023 14:39 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/2 "2023-10-10T14:39:44Z")

</div>

What image did you flash with?

Looking at the log, it only took 8 seconds to start up.

Do you have anything else installed ?

Are you running the desktop version of the OS?

If running the desktop version, you could run the configurator and set it to boot to the command line and see if you have issues then

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [11 October 2023 16:12 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/3 "2023-10-11T16:12:22Z")

</div>

Hi zenofmud and thank you for your reply. Regarding your questions...

> [@zenofmud](#):
>
> What image did you flash with?

Raspberry Pi OS Lite (32bit) - bullseye

> [@zenofmud](#):
>
> Do you have anything else installed ?

The installation described above had nothing installed apart from `Node-RED` (with no additional nodes and no flows). The installation sequence above lists the only commands executed after the Pi powered up with a new image. The ~4 minute high processor usage was observed by executing `top` as soon as I logged on after reboot.

> [@zenofmud](#):
>
> Are you running the desktop version of the OS?

No - Lite. It is headless. All installation / configuration is from a command line.

> [@zenofmud](#):
>
> Looking at the log, it only took 8 seconds to start up.

To check, I've just disabled Node-RED Autostart on Boot, re booted and run `node-red-start`. Seems to take approximately 7 seconds to start up...

> Starting as a systemd service.  
> 11 Oct 15:53:59 - [info]  
> Welcome to Node-RED
> 
> 11 Oct 15:53:59 - [info] Node-RED version: v3.1.0  
> 11 Oct 15:53:59 - [info] Node.js version: v18.18.0  
> 11 Oct 15:53:59 - [info] Linux 6.1.21-v7+ arm LE  
> 11 Oct 15:54:02 - [info] Loading palette nodes  
> 11 Oct 15:54:05 - [info] Dashboard version 3.6.0 started at /ui  
> 11 Oct 15:54:06 - [info] Settings file : /home/pi/.node-red/settings.js  
> 11 Oct 15:54:06 - [info] Context store : 'default' [module=memory]  
> 11 Oct 15:54:06 - [info] User directory : /home/pi/.node-red  
> 11 Oct 15:54:06 - [warn] Projects disabled : editorTheme.projects.enabled=false  
> 11 Oct 15:54:06 - [info] Flows file : /home/pi/.node-red/flows.json  
> 11 Oct 15:54:06 - [warn] Encrypted credentials not found  
> 11 Oct 15:54:06 - [info] Server now running at [http://127.0.0.1:1880/](http://127.0.0.1:1880/)  
> 11 Oct 15:54:06 - [info] Starting flows  
> 11 Oct 15:54:06 - [info] Started flows

Apart from the CPU anomaly at start up, the system seems to be running fine. I have subsequently proceeded to install Plex Media Server, Samba, three Node-RED nodes and a flow. All seems ok!  
I have attached two screenshots from `top`. One immediately after start up (~200% CPU) the other ~4 minutes later. Now that Node-RED is doing "something" `top` shows CPU varying between 1.3% and 7.6%.

 ![Apollo top 231011 1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/6/9605c7950c97b7f21bec859e597c0dec164114c7.png)

 ![Apollo top 231011 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/9/391a1f778d76652b337199ff07b778493ca46b26.png)

Although all seems well, I am just a bit nervous that the CPU anomaly at start up could indicate a problem which may cause issues in the future!

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 October 2023 16:31 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/4 "2023-10-11T16:31:48Z")

</div>

What happened if you shutdown NR and start with `node-red dummy.flow`?  
This will create an empty flow.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [11 October 2023 16:37 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/5 "2023-10-11T16:37:59Z")

</div>

> [@dunum](#):
>
> I am just a bit nervous that the CPU anomaly at start up could indicate a problem which may cause issues in the future!

Node RED has been installed on much much lower spec pieces of hardware!  
unless you do something in your flows like an insane endless data loop - I really wouldn't worry.

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [11 October 2023 16:40 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/6 "2023-10-11T16:40:13Z")

</div>

> [@zenofmud](#):
>
> node-red dummy.flow

 ![2023-10-11](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/1/610be2b9a834270faab588a7dafc4589b9546408.png)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 October 2023 16:42 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/7 "2023-10-11T16:42:07Z")

</div>

I don't see node-red in that top, did it start ok?

I'd so, how big is your original flow?

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [11 October 2023 16:49 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/8 "2023-10-11T16:49:40Z")

</div>

> [@marcus-j-davies](#):
>
> Node RED has been installed on much much lower spec pieces of hardware!  
> unless you do something in your flows like an insane endless data loop - I really wouldn't worry.

Noted and thank you. I guess I don't like anomalies! I have other (older) systems and have checked them - CPU usage "normal" at start up; Raspberry Pi 4 - CPU usage "normal" at start up. Either something is different with or has changed within the OS or Node-RED re. Raspberry Pi 3 or I am doing something wrong. Just like to know.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [11 October 2023 17:02 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/9 "2023-10-11T17:02:22Z")

</div>

> [@dunum](#):
>
> or I am doing something wrong

If this is with a blank flow - I guess its "normal" 🤷‍♂️ , if you actually have flows, then you can export said flow, and we may be able to spot something - especially if you have inject nodes that fire at start up.

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [11 October 2023 17:13 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/10 "2023-10-11T17:13:26Z")

</div>

> [@zenofmud](#):
>
> I don't see node-red in that top, did it start ok?

Yes it did start ok and the editor shows one empty flow.

Node-RED seems to come and go from the `top` list, I guess `top` ignores processes that aren't using resources(?). Here is `htop` output...

 ![2023-10-11 (2)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/8/b8266a75634aa0ed1f716ba7a08c87e4a3a13551.png)

The flow is quite big (how big is big?). I use it on all of my Pi projects (including Pi Zero) to produce a dashboard showing system status...

 ![Apollo Dashboard 231011 2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/6/766da50f9b81eb7ef47b381180fda110c092b20f.png)

This screenshot is how I noticed the CPU usage issue! Do note however, the issue manifested itself on an installation with NO additional nodes and no flows using `top` / `htop` to display CPU%

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [11 October 2023 17:31 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/11 "2023-10-11T17:31:35Z")

</div>

How do I post a flow on the forum?

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [11 October 2023 17:33 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/12 "2023-10-11T17:33:56Z")

</div>

Top right menu

````auto
```
JSON Here
```

````

Then we can import the flow - remember to remove anything sensitive (like API keys and alike)

 ![Screenshot 2023-10-11 at 18.32.06](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/f/2f9821fadbda95bc97bee14b912d9a31dca59ffe.png)

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [11 October 2023 19:22 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/13 "2023-10-11T19:22:30Z")

</div>

> [@marcus-j-davies](#):
>
> Top right menu

Don't seem to have the right menu item???  
In any case, the issue manifested itself on an installation with NO additional nodes and no flows. I can't see how my flow would have caused the problem.

 ![Screenshot 2023-10-11 201551](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/a/0a3e6aac93a7ad36929efb17e3398a764e4d2f06.jpeg)

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [11 October 2023 19:24 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/14 "2023-10-11T19:24:15Z")

</div>

Sorry - I thought you mean how to export a flow.  
but I wouldn't worry if its with a blank flow

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [11 October 2023 19:41 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/15 "2023-10-11T19:41:15Z")

</div>

Sorry I didn't get back to you earlier, our three year old granddaughter fell asleep on my lap.

This should help:

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [12 October 2023 12:45 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/16 "2023-10-12T12:45:11Z")

</div>

Ok so either I am going mad or someone is playing tricks behind the (Raspberry Pi OS) scene!

I slept on the problem overnight and came up with a few things to try. Interestingly, four rebuilds later (with SD, HDD and a few build sequence changes) Node-RED installed perfectly every time! There was no excessive CPU usage on any of the builds.

**HOWEVER** in each build `syslog` was missing. Searching showed the file did not exist. Indeed `/var/log/` contained very few files at all compared with similar builds. e.g. no `kern.log`, `messages`, `auth.log`, etc. I do not know what all of these file are for but seems to me that they ought to be there.

 ![2023-10-12 (1)](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/6/56db5154dd9aeaa8ebfe967d4ba1691558fc18d5.png)

What I have discovered is that the image downloaded via Raspberry Pi Imager has changed from `bullseye` to `bookworm` between 9/10/23 (High CPU Usage) and today (Normal CPU Usage). Hmm.

There are differences in the `nodered-install.log`'s generated between those dates showing this change of OS including the appearance of the line...

> W: [http://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease:](http://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease:) Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

I've no idea whether this is significant or not!

In (my) conclusion the change of OS fixed the Node-RED issue but introduced the total lack of system logging.  
O Joy!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 October 2023 13:03 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/17 "2023-10-12T13:03:18Z")

</div>

Apparently rsyslog is not enabled in bookworm (google will bring up numerous references if you need it). So the log files are not generated. The 'solution' is to learn how to use journalctl for displaying logs. journalctl has been available for a long time. node-red-log, for example, uses it for displaying the node red log. Alternatively I expect it is possible to install and enable rsyslog.

---

<div class="post-metadata">

**Author:** ![dunum](https://avatars.discourse-cdn.com/v4/letter/d/258eb7/32.png) [@dunum](https://discourse.nodered.org/u/dunum)\
**Post date:** [12 October 2023 13:39 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/18 "2023-10-12T13:39:54Z")

</div>

Ah. Thanks for that. Looks like I have some learning to do!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 November 2023 10:54 UTC](https://discourse.nodered.org/t/unusually-high-cpu-usage-on-raspberry-pi-3-at-startup/81920/19 "2023-11-30T10:54:18Z")

</div>

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