15 Graphs on UI, draining all resources

Hi All ,

What can I do to prevent NodeRed from hanging , I use 18 graphs to log my temps for 24hrs , and another screen for logging 15 PIR's in the house , If it's already loading the page , I usually get the 'lost connection' message , can somebody point me in the right direction.

Kind regards , Peter

Dashboard performance when using graphs is highly dependent on the number of data points and the update rate.

In a lot of cases, it makes sense to aggregate the data before sending it to the graph node, especially for longer periods.
That interval depends on the pixel width of your graphs, as you won't need more data points than you can actually display. I'd say, try 5 or 10 minute intervals.

What is the range of the graphs, how many lines altogether and how often are they being updated? If you multiply the range in hours by the total number of lines by the rate in samples/hour then that will tell you how many samples the browser has to manipulate when a new sample set is received. If that is a huge number then remember there is little point have more points across a graph than there are pixels on the graph. So for example if the range is 24 hours and the graph is 200 pixels wide then the max sensible sample rate is about one every 10 minutes.

I made a little example how and may be why to aggregate data for chart.
It uses non standard nodes: node-red-contrib-aggregator, node-red-node-random

[{"id":"9176f8a3.80b2c8","type":"aggregator","z":"2cc2b60c.fb70ba","name":"","topic":"","intervalCount":"5","intervalUnits":"s","submitIncompleteInterval":true,"submitPerTopic":true,"aggregationType":"mean","x":610,"y":360,"wires":[["767de6db.f12228","c8afe7a.6b03d18"]]},{"id":"9f2ae3d.e485a2","type":"inject","z":"2cc2b60c.fb70ba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"Temperature","payload":"","payloadType":"date","x":230,"y":220,"wires":[["df3de161.531d5"]]},{"id":"f27acad7.467da8","type":"inject","z":"2cc2b60c.fb70ba","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":0.1,"topic":"Humidity","payload":"","payloadType":"date","x":230,"y":260,"wires":[["fda67585.fb8b18"]]},{"id":"df3de161.531d5","type":"random","z":"2cc2b60c.fb70ba","name":"","low":"15","high":"25","inte":"false","property":"payload","x":430,"y":220,"wires":[["9176f8a3.80b2c8","5e61ab9c.23cea4"]]},{"id":"fda67585.fb8b18","type":"random","z":"2cc2b60c.fb70ba","name":"","low":"35","high":"45","inte":"false","property":"payload","x":430,"y":260,"wires":[["9176f8a3.80b2c8","c2701b6a.900018"]]},{"id":"767de6db.f12228","type":"ui_chart","z":"2cc2b60c.fb70ba","name":"","group":"50a1d6b5.ce2c88","order":37,"width":"6","height":"4","label":"chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":870,"y":420,"wires":[[]]},{"id":"5e61ab9c.23cea4","type":"change","z":"2cc2b60c.fb70ba","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"temp all points","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":100,"wires":[["767de6db.f12228","ddb12944.ccebe8"]]},{"id":"c2701b6a.900018","type":"change","z":"2cc2b60c.fb70ba","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"hum all points","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":650,"y":140,"wires":[["767de6db.f12228","ddb12944.ccebe8"]]},{"id":"9691e0.cf50fe2","type":"inject","z":"2cc2b60c.fb70ba","name":"reset","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"reset","payload":"[]","payloadType":"json","x":610,"y":420,"wires":[["ddb12944.ccebe8","c8afe7a.6b03d18","767de6db.f12228"]]},{"id":"deed1fdf.a1c4f","type":"ui_text","z":"2cc2b60c.fb70ba","group":"50a1d6b5.ce2c88","order":37,"width":0,"height":0,"name":"","label":"All points","format":"{{msg.payload}}","layout":"row-spread","x":1020,"y":100,"wires":[]},{"id":"ddb12944.ccebe8","type":"function","z":"2cc2b60c.fb70ba","name":"count all","func":"let count = global.get(\"countAll\")\nif(!count){\n    count = 0\n}\ncount ++\nif(msg.topic === \"reset\"){\n    count = 0\n}\nglobal.set(\"countAll\",count)\nmsg.payload = count\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":880,"y":100,"wires":[["deed1fdf.a1c4f"]]},{"id":"c8afe7a.6b03d18","type":"function","z":"2cc2b60c.fb70ba","name":"count aggregated","func":"let count = global.get(\"countAggregated\")\nif(!count){\n    count = 0\n}\ncount ++\nif(msg.topic === \"reset\"){\n    count = 0\n}\nglobal.set(\"countAggregated\",count)\nmsg.payload = count\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":910,"y":140,"wires":[["890857d5.aa0b28"]]},{"id":"890857d5.aa0b28","type":"ui_text","z":"2cc2b60c.fb70ba","group":"50a1d6b5.ce2c88","order":37,"width":0,"height":0,"name":"","label":"Aggregated  points","format":"{{msg.payload}}","layout":"row-spread","x":1110,"y":140,"wires":[]},{"id":"c0d5f608.230e48","type":"comment","z":"2cc2b60c.fb70ba","name":"Delete all above to have only aggregated data in chart","info":"","x":800,"y":220,"wires":[]},{"id":"14b1f6b4.2be1c9","type":"comment","z":"2cc2b60c.fb70ba","name":"Example of creating aggregated data for chart","info":"","x":290,"y":80,"wires":[]},{"id":"50a1d6b5.ce2c88","type":"ui_group","z":"","name":"HOME","tab":"6ff5405c.a8e6","order":1,"disp":true,"width":"6","collapse":false},{"id":"6ff5405c.a8e6","type":"ui_tab","z":"","name":"TEST","icon":"dashboard","order":3,"disabled":false,"hidden":false}]
2 Likes

Hi Kuema , Colin & hotNipi,

Thanks for the fast reply , It makes more sense after the explanation , I will go for the aggregator option from hotNipi , and will come back if it fits the need.
I tried to attach the flows , but it seems new users can't upload, and pre-formatted text it is too big , hmmm

In any case , will return the feedback for the status

You can now, although try not to upload complete flows unless it's absolutely necessary. It's usually better to upload either part flow, or an example flow to demonstrate the issue.

Hi Colin ,

The update timer is set to 15min , total graph is 24hrs ,for the temperature readings
But the PIR's giving me a signal that stands 30s , therefor this update timer is set to 5sec ,and also logging for 24hrs. display size for both series of graphs are 12x2
It becomes clear where it goes wrong , will try the aggregator option provided by hotNipi

Peter

Thanks Paul !

[{"id":"e9fe8350.5acd6","type":"http request","z":"4901fbb.d9bba04","name":"http request ","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.1.5:8666/json.htm?type=devices&rid=488","tls":"","persist":false,"proxy":"","authType":"","x":330,"y":120,"wires":[["589c809b.7f9bb8"]]},{"id":"ad048c0d.a2773","type":"inject","z":"4901fbb.d9bba04","name":"","topic":"","payload":"","payloadType":"date","repeat":"5","crontab":"","once":false,"onceDelay":"1","x":130,"y":120,"wires":[["e9fe8350.5acd6"]]},{"id":"589c809b.7f9bb8","type":"json","z":"4901fbb.d9bba04","name":"JSON Parse","property":"payload","action":"","pretty":false,"x":510,"y":120,"wires":[["a5097532.f19ef"]]},{"id":"a5097532.f19ef","type":"change","z":"4901fbb.d9bba04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.result[0].Status","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":120,"wires":[["f026b16e.8449b"]]},{"id":"af7f7521.de2d2","type":"ui_led","z":"4901fbb.d9bba04","group":"f08f6825.64d988","order":1,"width":3,"height":1,"label":"Entree","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"red","value":"true","valueType":"bool"},{"color":"green","value":"false","valueType":"bool"}],"allowColorForValueInMessage":false,"name":"","x":1350,"y":160,"wires":[]},{"id":"f026b16e.8449b","type":"switch","z":"4901fbb.d9bba04","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"On","vt":"str"},{"t":"eq","v":"Off","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":910,"y":120,"wires":[["3f83e338.1fd3f4","6ebd679a.5d39b8"],["79c5f5b5.7d8e9c","847192ff.f9fec"]]},{"id":"3f83e338.1fd3f4","type":"change","z":"4901fbb.d9bba04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"true","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":100,"wires":[["af7f7521.de2d2"]]},{"id":"79c5f5b5.7d8e9c","type":"change","z":"4901fbb.d9bba04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"false","tot":"bool"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":140,"wires":[["af7f7521.de2d2"]]},{"id":"7c29a6f1.a907f8","type":"ui_chart","z":"4901fbb.d9bba04","name":"","group":"3296fad9.82026e","order":1,"width":12,"height":2,"label":"Entree","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"0","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1350,"y":60,"wires":[[]]},{"id":"847192ff.f9fec","type":"change","z":"4901fbb.d9bba04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":180,"wires":[["7c29a6f1.a907f8"]]},{"id":"6ebd679a.5d39b8","type":"change","z":"4901fbb.d9bba04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":1080,"y":60,"wires":[["7c29a6f1.a907f8"]]},{"id":"64910d76.08f724","type":"comment","z":"4901fbb.d9bba04","name":"Example PIR logging","info":"","x":130,"y":60,"wires":[]},{"id":"29488414.aafa6c","type":"change","z":"4901fbb.d9bba04","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.result[0].Temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":320,"wires":[["4926ddd9.0bf5ec","971d6836.d4f0c"]]},{"id":"4926ddd9.0bf5ec","type":"ui_chart","z":"4901fbb.d9bba04","name":"","group":"336376d8.95553a","order":1,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":950,"y":360,"wires":[[]]},{"id":"cd1eb079.03c1c8","type":"comment","z":"4901fbb.d9bba04","name":"Radiator temperature logging","info":"","x":160,"y":260,"wires":[]},{"id":"971d6836.d4f0c","type":"ui_level","z":"4901fbb.d9bba04","group":"336376d8.95553a","order":2,"width":0,"height":0,"name":"","label":"Entree","colorHi":"#e60000","colorWarn":"#00fa00","colorNormal":"#0432ff","colorOff":"#000000","min":"10","max":"30","segWarn":"18","segHigh":"22","unit":"°C","layout":"sh","channelA":"","channelB":"","decimals":"1","animations":"soft","shape":2,"colorschema":"rainbow","textoptions":"custom","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":false,"hideValue":false,"tickmode":"off","peakmode":false,"peaktime":3000,"x":950,"y":320,"wires":[]},{"id":"73a38c64.8fcf4c","type":"inject","z":"4901fbb.d9bba04","name":"","topic":"","payload":"","payloadType":"date","repeat":"900","crontab":"","once":false,"onceDelay":0.1,"x":130,"y":320,"wires":[["76749600.d19328"]]},{"id":"76749600.d19328","type":"http request","z":"4901fbb.d9bba04","name":"http request ","method":"GET","ret":"txt","paytoqs":false,"url":"http://192.168.1.5:8666/json.htm?type=devices&rid=203","tls":"","persist":false,"proxy":"","authType":"","x":370,"y":320,"wires":[["ad77f1ba.66fc98"]]},{"id":"ad77f1ba.66fc98","type":"json","z":"4901fbb.d9bba04","name":"JSON Parse","property":"payload","action":"","pretty":false,"x":570,"y":320,"wires":[["29488414.aafa6c"]]},{"id":"f08f6825.64d988","type":"ui_group","z":"","name":"Zone Status","tab":"50354383.551efc","order":2,"disp":false,"width":6,"collapse":false},{"id":"3296fad9.82026e","type":"ui_group","z":"","name":"Histo","tab":"be294d67.43c98","order":1,"disp":false,"width":"12","collapse":false},{"id":"336376d8.95553a","type":"ui_group","z":"","name":"Temp1","tab":"a9c550e1.6dfa6","order":1,"disp":false,"width":"6","collapse":false},{"id":"50354383.551efc","type":"ui_tab","z":"","name":"Alarm","icon":"link","order":10,"disabled":false,"hidden":false},{"id":"be294d67.43c98","type":"ui_tab","z":"","name":"HistoMovement","icon":"dashboard","order":11,"disabled":false,"hidden":false},{"id":"a9c550e1.6dfa6","type":"ui_tab","z":"","name":"Temperatuur","icon":"settings_input_antenna","order":1,"disabled":false,"hidden":false}]

You might find that just using a delay node set to rate limit mode and discarding extra messages so it only lets them through at the right rate is good enough.

Dear all ,

The PIR status (boolean) filtered by the RBE node before entering the graph seems to do the trick
And the temperature logging through the aggregator works for me as well.

Many thanks , Peter