# Memory problem Dashboard/plotly.js

**URL:** https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368
**Category:** Dashboard
**Created:** [20 February 2021 22:54 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368 "2021-02-20T22:54:13Z")
**Posts on this page:** 7
**Page:** 2

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [23 February 2021 13:29 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368/21 "2021-02-23T13:29:41Z")

</div>

Having done some tests I can confirm that is correct. It doesn't stop node-red from consuming additional memory if node-red demands it. In addition max old space is supposed to be redundant in nodejs 12+ as it is supposed to work it out based on the amount of memory available.  
Which presumably means that @rko's system is asking for more and more memory, which on that scale is odd just for a few strings. Unless the array being build and kept in context is huge. @rko how big does the array get?

---

<div class="post-metadata">

### Author: ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)
#### Post date: [24 February 2021 05:39 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368/22 "2021-02-24T05:39:59Z")

</div>

Apologies for the late answer @Colin. After your comment regarding file based storage, we switched to a "ring buffer" system which sets a size limit to the array of a several thousand value pairs per curve.

It's actually mentioned in the [documentation](https://nodered.org/docs/user-guide/context#saving-context-data-to-the-file-system), that a file based storage is being stored in the memory (still).

The two steps helped to make the system more stable:

- Change the way timestamps are being produced, recommended by @TotallyInformation

- Introduce a max capacity to the measurement data array (in the future, we might want this a bit more advanced by creating some sort of average instead of directly deleting historical data, and/or move data to a data base periodically)

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [24 February 2021 18:09 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368/23 "2021-02-24T18:09:16Z")

</div>

> [@rko](#):
>
> Introduce a max capacity to the measurement data array (in the future, we might want this a bit more advanced by creating some sort of average instead of directly deleting historical data, and/or move data to a data base periodically)

I guess that you know that this is exactly what InfluxDB is good for?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [24 February 2021 21:14 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368/24 "2021-02-24T21:14:48Z")

</div>

I thought about that, but I am not sure it is appropriate for a system with 500MB RAM. Also whether the long term storage would be appropriate for influx, though I have not asked about it.  
I would not have considered running influx on a Pi Zero with an SD card, for example, with data being recorded at 5Hz.

---

<div class="post-metadata">

### Author: ![rko](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rko/32/45807_2.png) [@rko](https://discourse.nodered.org/u/rko)
#### Post date: [24 February 2021 22:27 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368/25 "2021-02-24T22:27:02Z")

</div>

I must say, the conversations here have been very helpful and interesting. And we are looking forward to more. Hopefully we will be able to help others too.

In this project, the amount of data being stored is not as big as it might seem. After each heating cycle we only store a summary (such as date&time, heating time, max temperature etc.). However, during PID tuning the dashboard will display the complete measurement data (5 Hz or even higher) . The plotly graph is an important tool to optimize the heating processes. If the engineer leaves the webinterface running or uses it for a long time, this might have led to a crash sooner or later. That's why we had to fix this problem.

For future projects with bigger amounts of data, a database system such as InfluxDB makes totally sense. The plan is to run the data base on another system since the mentioned controller is not as "powerful" or suitable for this task.

Should we move this post to another category, since it wasn't really a dashboard issue?

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [24 February 2021 22:54 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368/26 "2021-02-24T22:54:37Z")

</div>

> [@rko](#):
>
> Should we move this post to another category, since it wasn't really a dashboard issue?

Technically yes, but I think users encountering similar problems would expect to find it in the dashboard category, so maybe leave it here.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [26 March 2021 22:55 UTC](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368/27 "2021-03-26T22:55:18Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/memory-problem-dashboard-plotly-js/41368.md?page=1)
