Performance Issues

I have a flow (included below) that receives packets via UDP, splits up the bytes, then parses the bytes to data and passes them to a dashboard. When I only have a single dashboard item (battery power) the dashboard is quick, snappy and does a good job at keeping up with the incoming packets.

However, as I add more dashboard nodes performance starts to suffer on UDP feed nodes to the point where the editor and the dashboard become extremely laggy.

I have tried using rate limits to limit the amount of packets being sent to the data I don't need updated in real time but that hasn't helped much.

I guess my question is, I'm I missing something obvious that causing the performance issues or I'm i hitting the ceiling of what the node-red dashboard can do?

as a side note, I've migrated from a RPi to a VM with 4 cores and 4GB RAM to see if it would make a difference, it didn't.

[{"id":"96a2f789.84f2d8","type":"tab","label":"Battery Dashboard","disabled":false,"info":""},{"id":"83a6bdc6.e3d85","type":"ui_gauge","z":"96a2f789.84f2d8","name":"SOC","group":"8a7f919d.d5fa7","order":7,"width":0,"height":0,"gtype":"donut","title":"Charge Level","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#c10000","#ff8000","#00b700"],"seg1":"25","seg2":"60","x":1270,"y":140,"wires":[]},{"id":"650eb2d4.8b658c","type":"ui_gauge","z":"96a2f789.84f2d8","name":"","group":"40d90832.56c078","order":3,"width":0,"height":0,"gtype":"donut","title":"Battery Power","label":"kWh","format":"{{value / 1000 | number:2}}","min":"0","max":"12","colors":["#00b500","#ff8000","#ca3838"],"seg1":"6000","seg2":"8000","x":1260,"y":320,"wires":[]},{"id":"a23a9147.6b96","type":"ui_gauge","z":"96a2f789.84f2d8","name":"","group":"2984d7c7.1ad178","order":1,"width":0,"height":0,"gtype":"gage","title":"Battery Voltage","label":"V","format":"{{value}}","min":"36","max":"50.4","colors":["#c10000","#ff8000","#00b500"],"seg1":"38","seg2":"43.2","x":1414,"y":387.9999952316284,"wires":[]},{"id":"3e3709f2.c85c96","type":"ui_gauge","z":"96a2f789.84f2d8","name":"","group":"2140c291.1912be","order":3,"width":0,"height":0,"gtype":"gage","title":"Battery Temp","label":"C","format":"{{value}}","min":0,"max":"60","colors":["#00b500","#ff8000","#ca3838"],"seg1":"15","seg2":"45","x":1403,"y":420.9999952316284,"wires":[]},{"id":"1c1b7901.1143f7","type":"ui_gauge","z":"96a2f789.84f2d8","name":"","group":"2984d7c7.1ad178","order":2,"width":0,"height":0,"gtype":"gage","title":"Avg Cell Voltage","label":"V","format":"{{value}}","min":"3","max":"4.2","colors":["#d90000","#ff8000","#00b500"],"seg1":"3.16","seg2":"3.8","x":1301,"y":39,"wires":[]},{"id":"1416906d.61cc8","type":"ui_chart","z":"96a2f789.84f2d8","name":"Battery Power","group":"40d90832.56c078","order":4,"width":"0","height":"0","label":"","chartType":"line","legend":"false","xformat":"auto","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"2","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1260,"y":354.0002393722534,"wires":[[]]},{"id":"19dc6aeb.de2925","type":"ui_text","z":"96a2f789.84f2d8","group":"40d90832.56c078","order":1,"width":0,"height":0,"name":"Battery State","label":"Battery State","format":"{{msg.payload}}","layout":"row-spread","x":1290,"y":540,"wires":[]},{"id":"8d563f58.20775","type":"binary","z":"96a2f789.84f2d8","name":"","pattern":"l64a => data, l16 => id1,  l16 => id2,b16 => family_id, b32 => timestamp, b8 => rtr, b8 => priority, b8 => identifier, b8 => len","x":350,"y":240,"wires":[["9e16a258.9ab18","884802c0.ad927"]]},{"id":"9e16a258.9ab18","type":"switch","z":"96a2f789.84f2d8","name":"","property":"payload.id1","propertyType":"msg","rules":[{"t":"eq","v":"0x651","vt":"num"},{"t":"eq","v":"0x650","vt":"num"},{"t":"eq","v":"0x150","vt":"num"},{"t":"eq","v":"0x68F","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":670,"y":260,"wires":[["1cb8274a.827e49"],["ccdf0aa4.5e4358"],["2ec8ca64.d2e9d6"],["8272f3be.fce41"]]},{"id":"1415a00f.96536","type":"debug","z":"96a2f789.84f2d8","name":"lowCellV, highCellV, avgCellV","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1339.4999389648438,"y":73.00003051757812,"wires":[]},{"id":"2f9e374c.0b41f8","type":"debug","z":"96a2f789.84f2d8","name":"SOC","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":1270.4999389648438,"y":107,"wires":[]},{"id":"33562a12.87eb06","type":"udp in","z":"96a2f789.84f2d8","name":"","iface":"","port":"6650","ipv":"udp4","multicast":"false","group":"","datatype":"buffer","x":140,"y":160,"wires":[["9661ee57.d1883","8d563f58.20775"]]},{"id":"2ec8ca64.d2e9d6","type":"function","z":"96a2f789.84f2d8","name":"Convert","func":"var amps = [msg.payload.data[0],msg.payload.data[1]];\nvar ampsBuff = new Buffer(amps);\namps = ampsBuff.readInt16LE(0)\n\nvar volts = [msg.payload.data[2],msg.payload.data[3]];\nvar voltsBuff = new Buffer(volts);\nvolts = voltsBuff.readInt16LE(0) / 10\n\nvar amph = [msg.payload.data[4],msg.payload.data[5]];\nvar amphBuff = new Buffer(amph);\namph = amphBuff.readInt16LE(0) * 10\n\nvar maxTemp = msg.payload.data[6]\nvar minTemp = msg.payload.data[7]\n\nif (ampsBuff.readInt16LE(0) < 0) {\n    packState = \"CHARGING\"\n} else if (ampsBuff.readInt16LE(0) > 0) {\n    packState = \"DISCHARGING\"\n} else {\n    packState = \"IDLE\"\n}\n\nkWatts = volts * amps\n\nvar msg1 = { payload:kWatts };\nvar msg2 = { payload:volts };\nvar msg3 = { payload:amph};\nvar msg4 = { payload:maxTemp };\nvar msg5 = { payload:minTemp };\nvar msg6 = { payload:packState };\nvar msg7 = { payload:amps };\n\nreturn [ msg1, msg2, msg3, msg4, msg5, msg6, msg7 ];","outputs":7,"noerr":0,"x":1006.076416015625,"y":357.5625,"wires":[["2ab8a26f.21e10e","650eb2d4.8b658c","1416906d.61cc8"],["2f5695ff.34498a"],[],["cae25853.0c8b28"],[],["19dc6aeb.de2925"],["bf59e98b.620838"]]},{"id":"2ab8a26f.21e10e","type":"debug","z":"96a2f789.84f2d8","name":"A, V, AH, MaxT, MinT","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1281.0763969421387,"y":287.00694847106934,"wires":[]},{"id":"e08be5ca.1693f8","type":"function","z":"96a2f789.84f2d8","name":"Convert","func":"msg.payload = msg.payload.data[0] / 2;\n\nreturn  msg","outputs":1,"noerr":0,"x":1046.0797729492188,"y":186.68060302734375,"wires":[["2f9e374c.0b41f8","83a6bdc6.e3d85","717e2b81.e2c344"]]},{"id":"83a6fc93.a8152","type":"function","z":"96a2f789.84f2d8","name":"Convert","func":"var avgCellVolts = [msg.payload.data[4],msg.payload.data[5]];\nvar avgCellVoltsBuff = new Buffer(avgCellVolts);\nmsg.payload = avgCellVoltsBuff.readInt16LE(0) / 1000;\n\nreturn msg;","outputs":1,"noerr":0,"x":1045.517333984375,"y":153.01040649414062,"wires":[["1415a00f.96536","1c1b7901.1143f7"]]},{"id":"717e2b81.e2c344","type":"ui_chart","z":"96a2f789.84f2d8","name":"SOC","group":"8a7f919d.d5fa7","order":8,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":"1","removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1271,"y":174,"wires":[[]]},{"id":"bf59e98b.620838","type":"ui_text","z":"96a2f789.84f2d8","group":"40d90832.56c078","order":2,"width":0,"height":0,"name":"Amps","label":"Current","format":"{{msg.payload}}A","layout":"row-spread","x":1268.9271240234375,"y":573.291615486145,"wires":[]},{"id":"d7464432.ec7bb8","type":"function","z":"96a2f789.84f2d8","name":"Convert","func":"var moduleNumber = msg.payload.data[0]\n\nvar cell1Volts = ((msg.payload.data[2]) + 200) / 100\nvar cell2Volts = ((msg.payload.data[3]) + 200) / 100\nvar cell3Volts = ((msg.payload.data[4]) + 200) / 100\nvar cell4Volts = ((msg.payload.data[5]) + 200) / 100\nvar cell5Volts = ((msg.payload.data[6]) + 200) / 100\nvar cell6Volts = ((msg.payload.data[7]) + 200) / 100\n\nmsg.totalModules = msg.payload.data[1]\n\n\nvar msg1 = { label: \"Module \" + moduleNumber + \" Cell 1\" , payload:cell1Volts };\nvar msg2 = { label: \"Module \" + moduleNumber + \" Cell 2\" , payload:cell2Volts };\nvar msg3 = { label: \"Module \" + moduleNumber + \" Cell 3\" , payload:cell3Volts };\nvar msg4 = { label: \"Module \" + moduleNumber + \" Cell 4\" , payload:cell4Volts };\nvar msg5 = { label: \"Module \" + moduleNumber + \" Cell 5\" , payload:cell5Volts };\nvar msg6 = { label: \"Module \" + moduleNumber + \" Cell 6\" , payload:cell5Volts };\n\n\nreturn [msg1, msg2, msg3, msg4, msg5, msg6];","outputs":6,"noerr":0,"x":1050.4271240234375,"y":560.291615486145,"wires":[["9fe5c37f.c6613","3a0513d3.4be12c"],["9fe5c37f.c6613","3a0513d3.4be12c"],["9fe5c37f.c6613","3a0513d3.4be12c"],["9fe5c37f.c6613","3a0513d3.4be12c"],["9fe5c37f.c6613","3a0513d3.4be12c"],["9fe5c37f.c6613","3a0513d3.4be12c"]]},{"id":"9fe5c37f.c6613","type":"ui_chart","z":"96a2f789.84f2d8","name":"","group":"2984d7c7.1ad178","order":3,"width":0,"height":0,"label":"Cell Voltages","chartType":"bar","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"3.1","ymax":"4.2","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":true,"colors":["#00ff00","#00ff00","#00ff00","#00ff00","#00ff00","#008000","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":1285.9271240234375,"y":640.291615486145,"wires":[[]]},{"id":"3a0513d3.4be12c","type":"debug","z":"96a2f789.84f2d8","name":"Mod#, CellVolts, TotalMod#","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":1335.9271240234375,"y":607.291615486145,"wires":[]},{"id":"8272f3be.fce41","type":"delay","z":"96a2f789.84f2d8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":850,"y":560,"wires":[["d7464432.ec7bb8"]]},{"id":"1cb8274a.827e49","type":"delay","z":"96a2f789.84f2d8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":901.5,"y":153,"wires":[["83a6fc93.a8152"]]},{"id":"ccdf0aa4.5e4358","type":"delay","z":"96a2f789.84f2d8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":898.5,"y":187,"wires":[["e08be5ca.1693f8"]]},{"id":"2f5695ff.34498a","type":"delay","z":"96a2f789.84f2d8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1248.5,"y":386.99998474121094,"wires":[["a23a9147.6b96"]]},{"id":"cae25853.0c8b28","type":"delay","z":"96a2f789.84f2d8","name":"","pauseType":"rate","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1248.5,"y":419.99998474121094,"wires":[["3e3709f2.c85c96"]]},{"id":"884802c0.ad927","type":"msg-speed","z":"96a2f789.84f2d8","name":"","frequency":"sec","estimation":false,"ignore":false,"x":397,"y":363,"wires":[["79d941a6.c9d22"],[]]},{"id":"79d941a6.c9d22","type":"ui_text","z":"96a2f789.84f2d8","group":"8a7f919d.d5fa7","order":9,"width":0,"height":0,"name":"","label":"UDP Packets Processed","format":"{{msg.payload}} / Second","layout":"row-spread","x":350,"y":460,"wires":[]},{"id":"658f4728.d769e8","type":"ui_ui_control","z":"96a2f789.84f2d8","name":"","x":640,"y":400,"wires":[["9e16a258.9ab18"]]},{"id":"a4c21f33.02b85","type":"ui_text","z":"96a2f789.84f2d8","group":"8a7f919d.d5fa7","order":10,"width":0,"height":0,"name":"","label":"UDP Packets Received","format":"{{msg.payload}} / Second","layout":"row-spread","x":590,"y":100,"wires":[]},{"id":"9661ee57.d1883","type":"Message Counter","z":"96a2f789.84f2d8","name":"","units":"seconds","interval":1,"alignToClock":true,"generator":"internal","x":350,"y":100,"wires":[["a4c21f33.02b85"],[]]},{"id":"feaf9998.1a3378","type":"ui_button","z":"96a2f789.84f2d8","name":"","group":"8a7f919d.d5fa7","order":1,"width":"6","height":"1","passthru":false,"label":"Clear Dashboards","tooltip":"","color":"","bgcolor":"","icon":"","payload":"[]","payloadType":"json","topic":"","x":1010,"y":240,"wires":[["1c1b7901.1143f7","83a6bdc6.e3d85","717e2b81.e2c344","19dc6aeb.de2925","bf59e98b.620838","9fe5c37f.c6613","a23a9147.6b96","3e3709f2.c85c96"]]},{"id":"8a7f919d.d5fa7","type":"ui_group","z":"","name":"Controls","tab":"2ed7f684.7cb61a","order":1,"disp":true,"width":"6","collapse":true},{"id":"40d90832.56c078","type":"ui_group","z":"","name":"Input / Output","tab":"2ed7f684.7cb61a","order":2,"disp":true,"width":"6","collapse":true},{"id":"2984d7c7.1ad178","type":"ui_group","z":"","name":"Voltages","tab":"2ed7f684.7cb61a","order":3,"disp":true,"width":"6","collapse":true},{"id":"2140c291.1912be","type":"ui_group","z":"","name":"Enviromental","tab":"2ed7f684.7cb61a","order":4,"disp":true,"width":"6","collapse":true},{"id":"2ed7f684.7cb61a","type":"ui_tab","z":"","name":"Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

What is the approx message arrival rate ? I see you have rate limit nodes in there but they aren't set to discard intermediate messages so yes of course it will start to lag if more than one message arrives per second...
If you do have a high arrival rate then you may want to drop messages as early as possible (right after the udp node).

1 Like

Arrival is anywhere from 60 to 170 per second. I figured I was doing something wrong, off to Google how to discard messages.

Thanks.

Edit: Nvm I'm dumb sometimes, it was right there on the rate limit node.