Node red web page not loading or slow loading

I´m working in a rs-485 power meter web telemetry interface using raspbian, node-red in a raspberry pi3. I used the modbus nodes. I was increasing my flows, testing and improving. It´worked fine until suddenly, the web interface started to show a loading problem. I try to open node-red directly on the desktop using localhost:1880, it will not load. It only loads the Node-Red logo (header) and the sidebar, but no nodes in the palette. It shows the "loading" gif but that is all. It also does not show my flows. After a while (lots of mins) the interface opens and then i can edit the flows, deploy and work with flows with no problems. This just happens when i try to open for the first time after powering on the raspberry pi... In the raspberry, i can see that the cpu is working a lot. Sometimes goes to 100%. The dashboard i´ve created stops to responds and lost connection. I don´t know if this is related to flow code, raspberry files, or my web brownser.

Start by going back to the version before you made the changes that may be causing the problem. Then you will know whether it is your flow or something else.
If for some reason you have not been keeping backups then disable all tabs and check it comes up ok, then you can enable them again to find where the problem lies. Then start keeping backups. The projects feature makes this reasonably straight forward.

Hi Colin. Apparently, I found the problem. It was related to the amount of libraries that are in the folder /home/pi/.node-red/lib/. In the menu in the upper right corner "= > import > library" many libraries would appear. I think it's a problem to have many libraries in this folder. The Web browser has difficulty loading all and hangs up for a few moments, until it loads. After deleting these libraries, which i´m not using, the web page instantly loaded! Even the raspberry pi is working without much processing load now.

That is interesting and slightly worrying.

Some questions:

  • What version of Node-RED and Node.JS are you using?
  • Is this on a Pi? If so, what version of the hardware?
  • Can you check your swap? Is the Pi paging a lot of data in and out of swap? That will absolutely kill the performance of a Pi since it has to use the very slow SD-card.

Answers:

  • What version of Node-RED and Node.JS are you using? A: 0.19.5: Maintenance Release

  • Is this on a Pi?If so, what version of the hardware? A: Yes. Working a RASP PI 3 Model B V1.2. With a Schneider EGX100 on the netwok (port 502). Worked with serial adpater as well directly to raspberry and the power meter.

I can Chek the swap (where it is?)...but was definitely the amount of libraries in the /home/pi/.node-red/lib/ folder, as I did the same procedure in another rasp and it worked. The problems are over. i´m a newbee in node-red and still have some issues to solve. But now my dashboard is working and didn´t locked since...

You haven't said what version of node.js you are using. To find out run
node -v

If there are lots of files under .node-red/lib then the runtime has to do more work to index them when the editor is loaded. I've not seen it cause problems, but there is certainly a correlation between number of files and amount of work the runtime has to do.

Something for us to dig into. A general overhaul and rework of the library is in the plan - this is the type of issue that rework will have to address.

1 Like

I get that, but swap use is directly related to how much the device has to load into memory. So if all of the library is being loaded it may take you over the limited memory capacity of the Pi and start to swap. Once that happens, you can kiss goodby to performance on a Pi due to the slow "disk" interface.

1 Like

On my RPi Zero W with a startup on boot script it takes NodeRed about 1 minute to load. Is there a way to improve it?

My Zero takes about 40 seconds with a very simple flow, so if you have a more complex flow then what you are seeing is probably what you have to put up with. It is not a problem for me, after all how often do you stop and start node-red? Re-deploying only takes a few seconds.

The main cost at startup is scanning for and loading the node modules. The more modules you have installed, the longer that will take. So one way to speed up is to remove all modules you are not actively using. Beyond that, you are then limited by the speed of your SD card and the available memory (ie how much swap activity is going on).

1 Like

The node-red version is V10.15.0

The main cost at startup is scanning for and loading the node modules.The more modules you have installed, the longer that will take.

Reply:You´re right, i noticed that.

So one way to speed up is to remove all modules you are not actively using.

Reply :I did that, before cleaning the libraries, but didn´t worked. So i keep investigating until find the problem. When cleaned the libraries, it stoped to lock at webrowsing opening. Now opens instantly.
No flaws so far...
I think i was using the libraries in a wrong way. Every flow i designed, i was saving it at this folder. Every verision i modified, i was saving it there. So i had a, lot of examples flows in this folder, instead of saving in somewhere else.

Beyond that, you are then limited by the speed of your SD card and the available memory (ie how much swap activity is going on).
Reply: I used the Gparted APP to see how much swap i have (this is what it shows)


I didn´t find the swap. Assuming that swap is a partition...If i´m looking in the wrong place, please let me know whrere i can find find the swap size....

The flow and the library menu empty.

Ummm the latest version is 0.19.5

I believe that @knolleary meant installed nodes (for example node-red-contrib-something) in addition to the library is also significant. Go to Manage Palette and you can see all the nodes that are installed. Uninstall any of those that you are not using.
If you run top in a terminal it will show you the total Swap available and how much is used. If you find you are using any then things will start slowing down dramatically.

in my system I turn on and off power to RPi, similar to this one - https://spellfoundry.com/2016/05/21/introducing-sleepy-pi-2/ so both the startup time and loading time of nodered are important

In that case try the advice that you have already been given, make sure you have not installed any nodes you are not using and make sure you are using a fast SD card.
If it is still too slow then you may not be able to get away with using a Zero.

1 Like

Thanks, I already ordered a faster miroSD card and will try just nodejs to see if there is a difference. Interestingly on Pi3B+ and Pi3A+ the loading of nodejs is fast. Will have to investigate how to decrease the clock of Rpi3A+ after loading nodered to save power

1 Like

You should also note that if you are running a standard Pi installation, that starts up a desktop. This places quite a load on the Pi just on its own.

All of my Pi's run "headless" - e.g. without a desktop. They are accessed remotely. Via SSH for a command line, WinSCP for a GUI file explorer and of course the browser for Node-RED.

1 Like