Is there any way of seeing what function/node is using most cpu?
It would be nice to be able to see where things are slow.
I have a wery large procject that is using about 10% cpu all the time in average on a pi 4.
lots of mqtt and interval functions. i have lost track. so a overview of what node-red spends most time on would be nice.
It is necessary a tracer+profiling tool. I will be building one as for my next project but i cant tell you how long it will take. You can create a plugin using hooks and sentry if you want a cloud solution.
Allan, is that tool for node-red or a general one?
it this was implemented in node-red core it could track each nodes execution. Or can that be done from outside node-red?
it migth be something we could turn on for testing and then off for performance.
10% is average. it sometimes spikes a bit. Nothing critical at the moment.
it was running slow.
I have a lot of mqtt messages that are procecesed, so i had to buffer them for 2sec. then batch process them. this works fine and offloads cpu alot.
one downside to my approach is that im overwriting sensor values that come in durring those 2 seconds. not a issue realy. but less is better.
I also have a lot of other interval tasks. polling/processing stuff.
i would like to to some of this faster if possible. but i'm conservative now since it can escalate cpu usage quickly. if i could see how long a node or flow uses cpu i could step this up or down.
Seems to me you need to consider scaling out to a more distributed arrangement.
If this is for a professional setting, then perhaps you might consider a management platform that simplifies all this like FlowFuse? It has performance monitoring built in (on top of many other enterprise features)
Full disclosure, I work for FlowFuse alongside Nick - you could say Node-RED is our bread and butter
Of course, just because you have Node-RED, it doesn't mean that you have to use it for everything.
There are plenty of other ways to easily record, monitor and chart near real-time stats. For example, I use Telegraf, InfluxDB and Grafana to monitor my system stats. Telegraf writes to InfluxDB but also copies the data to MQTT so I can access the data without needing a separate InfluxDB query - though if the data were more critical than my home server, I would almost certainly use the features of InfluxDB to sensibly summarise the data even if I wanted to do more with it in Node-RED. As it is, on the rare occasions I need to look into what is happening on my network or the sites and services I monitor, Grafana charts are sufficient for the most part.
You would, of course, need to look at the licensing requirements if working in a commercial environment, not all of these tools might be "free" for commercial use.
However, there are certainly time-series DB's that are free to use in commercial settings (I can't remember if InfluxDB and Telegraf are I'm afraid) and depending on how you are trying to use the incoming data, you might find that passing the data direct to the DB engine and querying it from Node-RED may still be more efficient.