Enable/disable flow dinamically

995 views
Skip to first unread message

David Caparrós

unread,
Dec 14, 2017, 2:53:44 PM12/14/17
to Node-RED
Good afternoon

Since long time ago my dashboard was going slower and slower.

I just tried to disable a couple of full flow tabs where were located basically the nodes related to: exec request nodes, and graphs nodes.

I have to make some more test but seems that the graphs slow down drastically the speed how dashboard loads on browser, have sense....

Now I wonder if there is some way to make that those flow tabs to be loaded on a different address than localhost:1880/ui  so I can just open them when I wanted to check specifically something related or if there is the option that I can enable/disable those tabs dynamically directly from dashboard. 

As a third option I have read something about installing several instances of node red on same machine, however I have not being able to understand totally how to do it and how it works, this could be also a solution as this second instance can run the flows that analyze and shows the graphs.

Any advice is welcome.

Thanks in advance

Colin Law

unread,
Dec 14, 2017, 4:33:47 PM12/14/17
to node...@googlegroups.com
The clue to the probable cause of the problem is the word graphs.  First I suggest you do something.  Work out how often you are feeding new values to the chart or charts (so once per second, once per hour or whatever).  Then take the timerange of each chart (so maybe 3 hours or whatever). Then work out how many data points make up each line across the chart. For example if the data points were going in once a minute and the chart is 3 hours long that would be 180 total data points on the line.  Then multiply that by the total number of lines you have on the chart. Do that for each of the charts across all flows and add them all together.

Now what number have you come up with?  Then consider that when you load the flow into the browser it has to download all that data, and each time you add a new data point it has to shuffle all that data about.

Colin

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/2f567fd1-c940-4cbc-9543-b2afeecaf037%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Caparrós

unread,
Dec 14, 2017, 6:09:25 PM12/14/17
to Node-RED
Hello Colin,

Yes I see that this is the clue, word graphs and the amount of points make really heavy all dashboard to load.

Months ago I made some tests also with MySQLdatabase,node-red-contrib-graphs,emoncms & Graphana.

After playing with all this stuff something easy ton configure, flexible and reliable seems to be emoncms and a steep further with full options and more professional seems to be MySQL database + Grafana.

I think I will move this to this second option, actually I was already having all data handling and graphs in parallel on another pi with emoncms and frankly speaking very happy with the results compared with how easy it was to have it fully working.

Taking this debate out as seems clear...... I'm anyhow interested into know how it's possible to run several instance of node red on same pi, this will give the advantage of having more than one dashboard in order to use one or another depending on the screen size or resolution of the device I use.

Does someone have some experience or starting point for me to investigate and try?

Thank a lot for your time 

David


steve rickus

unread,
Dec 15, 2017, 10:47:00 AM12/15/17
to Node-RED
David,

It sounds like you need to split up your flows into separate directories -- this gives you the option to have different npm modules installed, and each editor and/or dashboard running on different ports. You can start/stop them independently of each other as needed. I'm currently doing this with the 6-7 projects I have set up. 

For each user directory, I create a package.json file with the version of node-red, node-red-dashboard, and other modules I need for that project. Then I run npm install inside that directory to load all the modules. Here is an example of what's in one of my package files:

{
 
"name": "node_red_test",
 
"version": "0.0.1",
 
"description": "Project for testing/debugging imported flows",
 
"private": true,
 
"dependencies": {
   
"node-red": "^0.17",
   
"node-red-contrib-binary": "*",
   
"node-red-contrib-collector": "*",
   
"node-red-contrib-journal": "*",
   
"node-red-contrib-merge": "*",
   
"node-red-contrib-modbus": "*",
   
"node-red-contrib-moment": "*",
   
"node-red-contrib-web-worldmap": "*",
   
"node-red-node-base64": "*",
   
"node-red-node-daemon": "*",
   
"node-red-node-data-generator": "*"
 
}
}

I modify the settings.js file for each project to set a different port to use for that instance -- this way, I can run multiple instances at once. If you only plan to work on one project at a time, you can just leave the port set to the default value.

Each user directory is underneath a projects directory, where I keep a script (well, a .bat file since i'm on windows) to start each node-red instance. Inside the script is a command like this:

node node-red\red.js -v -u node_red_%1 --title red-%1

so for example, I can pass in "test" as the first argument, and it will use the node_red_test userdir (the -u command line option). 

The downside is that I practically need a spreadsheet to keep track of which flows are deployed on which ports. Someday I will figure out how to have one master express application for managing all the node-red instances... Until then, I would be interested in knowing if anybody has set up an Express app to manage starting/stopping their node-red instances?
--
Steve

David Caparrós

unread,
Dec 15, 2017, 11:22:23 AM12/15/17
to Node-RED

Thanks Steve I will give it a try and see if I can make it work.

Regards

Colin Law

unread,
Dec 15, 2017, 11:31:00 AM12/15/17
to node...@googlegroups.com
You may be able to make a massive improvement in the overheads just by slowing down the feed to the charts. If, for example, a chart is three hours long and 300 pixels across then there is no point having more than one data point per minute going in. You can easily do this by putting a Delay node in series, set to Rate limit, 1 message per minute (or whatever is appropriate) and Drop Intermediate Messages.  Try that before you go to the effort of major re-structuring.

On the issue of databases and Grafana, do have a look at influx db, it is designed for precisely this sort of application and Grafana comes with influx knowledge so there is virtually nothing to configure.

Colin

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
Reply all
Reply to author
Forward
0 new messages