Chart performance issues - even with very few points

Hello everyone!

I just recently started using Dashboard 2.0 to display some of the data that Node-RED is reading from different automations, but I am experiencing serious performance issues when charts are added to the dashboard itself.

Allow me to quickly describe the structure of the project so that everything is clearer. I have several devices running Node-RED which are responsible to fetch data from automations using both S7 and MODBUS contrib nodes, elaborate and modify the data where needed, and immediately send them to a Touch Panel device that also has Node-RED installed, using websocket protocol. This latter device, the Panel, is solely responsible for receiving the data through websocket and create the dashboard, there are no complex elaborations or processes running on the Panel machine.

The dasboard is not that complex, it is composed by some custom ui-template components (some tiles that can change style and appearance based on input), some more custom buttons that allow opening a popup and insert a value trough a text input / select, and three timescale charts which are displaying the last minute of streamed data (1 minute or 30 points). Data is received by the Panel's Node-RED once every two seconds. Here's a picture of the dashboard (pardon me for having to censor some of the writings).

The Select component placed on the top left corner allows the user to select from which device / automation should the data be received, this is especially useful since we have several automations of the same type and model and operators must be able to choose which one they want to display.

Here starts the issue, as every time the Select is changed, or every time the flow is changed and deployed in Node-RED, I see a peak in CPU usage and used memory that goes up to 100%.
When this happens on my Intel i7 PC is not an issue, the UI continues to work without any noticeable problem. However, being the Panel equipped with very very low-end hardware (Intel N4200 1.1Ghz), it is much more noticeable and even causes freezes in the UI rendering it unusable for up to 15/20 seconds at times.

When removing the three charts from the dashboard and only leaving my custom ui-template components, the CPU usage is much less intensive and the maximum usage is about 1.5 or 2%.

I also checked my flow thoroughly, to make sure there are no other operations, functions or components eating up resources, however I cannot find any issue there:

As you can see from the picture, data is received (fake data in this case) trough websocket, then a Switch node is used to check whether the msg.source property is the same as the value of the flow.source property, which is set using the dropdown select I talked about earlier.

The received payload passes then through a Switch nodes where needed properties are set, and then to the ui-template nodes that generate the tiles. Those tiles can be clicked, and the output (which includes a msg.show boolean property) is used to toggle visibility of another custom ui-template component, which consists of an overlay and a popup, where the user can insert or choose some values. The popup contains a "OK" button that when pressed sends the msg to the next node, but also to itself, with the msg.show property set to false, so the overlay and popup are hidden.

Changing the source device using the Select in the top left part of the UI triggers a Dashboard Reset, where an empty payload is passed to all widgets causing them to reset before starting to display the new data of the chosen device.

Do you see any reason why this workflow could cause performance issues? Is just the Panel hardware that is insufficient for running the Dashboard 2.0? I have been reading some issues on GitHub that seem to blame it on the Chart component and suggest using a different approach to display live data and avoid the default chart node, is that the case?

Thanks for the time and the assistance, have a great day!

Dennis

Showing chart's on low end devices is territory of:

  1. Custom built dashboard
  2. No frontend library's
  3. Lightweight charting library

I can't see other bulletproof ways to do it and I had a need to do it for myself. It does the trick.

I suspect you're hitting Performance issues with charts · Issue #676 · FlowFuse/node-red-dashboard · GitHub much sooner than others because of the limited CPU.

We are likely to be moving to Apache E Charts fairly soon.

If you could verify a "Linear" scale doesnt cause the performance problems, then that would be super useful for us too.

P.s. welcome to the forums!

But doesn't the N4200 comfortably outperform eg a Raspberry Pi 4B?
Does the same issue arise on a Pi?

It's a good point - given the minimal data being plotted here, I wouldn't expect any issues at all, but the CPU spike aligns with the issue I've linked - which annoyingly is an internal ChartJS problem - hence we're looking at moving to Apache eCharts.

I have a Pi on my desk, I'll try and have a play in the next couple of days

Good morning,

thank you to everyone for your contribution to this topic! I did some more research, and while it's true that ChartJS seems to be quite heavy on these low-end CPUs, it is also true that the N4200 is a very very underperforming processor and even Microsoft Paint runs slow on it.

That said,we now have two of these panels and since they are industrial devices and are quite expensive, I do not wish to throw them away in favor of more powerful hardware, therefore I decided to create my own chart widget using Apache eCharts and the ui-template node. The performance appears to be slightly better and the charts are non-blocking, meaning that even though the CPU is being used up to 50%, the UI does not become unresponsive and users are still able to interact with the dashboard.

However, that was still not enough for me and I wanted to free the CPU from such a heavy workload, I then resorted to using the SVG Renderer and the SSR functionality offered by eCharts. After this change, the performance improved significally and processor usage now remains between 1.5% and 15%, which is a considerable improvement.

Thank you for inspiring me to use Apache eCharts, which solved my performance problem.

I wish you all a good day!

Dennis

2 Likes

If you still get any problems, I'd recommend trying uPlot (AKA μPlot) which is tiny and high performance.

We have been using Echarts for real time data display in industrial applications, since Echarts is one of the fastest charts for large data per our testing. Embedded computers have less processing power and RAM.

It looks like the SVG renderer and Server-Side Rendering could make the performance even better with reduced memory usage.
Thanks a lot and will test them out these two options.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.