Libraries affect load time?

I am running Node-RED on an embedded computer with limited resources. I have developed a set of flows for my application. With all flows loaded into the editor, a browser refresh takes about 20-30 seconds to refresh and redraw the editor interface and my flows. I created libraries of each of the five flow pages I have using the Export->Library function in the editor. Now it takes over 8 minutes to refresh the Node-RED editor in a browser window! I removed the library files and it returned to the 20 second refresh time.

What is Node-RED doing with libraries on a browser refresh? Why would a static library file, that is just stored on the system for possible use at a later time, cause Node-RED to take so much longer to redraw the screen?

Interesting catch Rob.

Something weird there for sure.

A couple of things you might check. Firstly use the network tab in your browser to monitor the performance of resources that are being loaded. Maybe post a screenshot of the results.

Secondly, run a monitor on your embedded computer so that you can see the performance details while loading the page. Pay particular attention to any info on memory utilisation and SWAP


This is from the Linux system monitor glances on a Pi2 running my NR HA service along with Mosquitto, InfluxDB, Graphana, Telegraf, etc.

If the swap utilisation is more than minimal, especially when loading the NR admin interface, that indicates you are running out of RAM and that the system is having to send/load things from "disk" - in your case, that may well be an SD card which can be very slow indeed.

Hi @RobSenix

when the editor loads, one of the requests it makes is for a complete listing of your local flow library so it can pre-populate the Import menu.

I thought that code did some caching so it wouldn’t have to rescan the file system each time - but looking at it now, I see it doesn’t cache anything. Which would explain the longer load times the more flows you have.

This is one of the many reasons the whole library is over due an overhaul - something that is highlighted in our roadmap.

But in the absence of any immediate overhaul, we ought to make this better in the existing code. If you’d be so helpful as to raise an issue on github we can take a look at adding some caching in the short term.

Thanks @knolleary, @TotallyInformation,

The vmstat output on my system shows no swap usage, so I think this is purely a CPU power issue on my system. It's a 400MHz ARM 9. I will not use libraries on this system! I've submitted an issue:

OK, though as Nick has said, it is scanning the file system each time - this is going to be a really slow process on a device that uses an SD card, especially if you have an older or less capable card. So that is another thing to look at. Also, if using an SD card, make sure it doesn't have errors on it. Over time, SD cards wear out - sometimes quite quickly. Unbranded and some branded cards are notorious for this which is why you sometimes see people recommending moving logging to a RAMdisk.

A better, faster SD card or better still, moving to an SSD or HDD - even via USB - will likely speed things up a fair bit.

Alternatively, if your flows don't change much, on bootup, move the Node-RED userDir folder to RAMdisk and use from there. Just make sure to copy everything back when you make changes.