# Best Practices questions for dashboard and storing data

**URL:** <https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148>\
**Category:** Dashboard\
**Created:** [13 May 2018 18:00 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148 "2018-05-13T18:00:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlinkScooby](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@BlinkScooby](https://discourse.nodered.org/u/BlinkScooby)\
**Post date:** [13 May 2018 18:00 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148/1 "2018-05-13T18:00:49Z")

</div>

Hey guys. I had some quick questions about the dashboard. So in a previous topic that i implemented showing and hiding different groups of data. This has worked great. However has caused a slow down of the interface to where it lags when it generates all the data shown and not shown. Sometimes it laggs so much that the graph lines never actually generate forcing me to reload the page then they generate.

> [@Link to another Tab](https://discourse.nodered.org/t/link-to-another-tab/115/4):
>
> Hello Blink, With the "UI control" node standard on node red you can make jumps from one tab to another for instance, what makes you can physically display a button on your dashboard that directly inject a value on the "ui control" on your flow and on your dashboard will jump to the specific tab you wanted, the same can be done to move back or whatever. Also you can make that a specific hour or after specific time with no action, it moves directly to a specific main tab. [image] I think this…

this is caused by i think a few problems  
1 its running on a raspberry pi so its not extremely powerful and has to do number crunching. - I will eventually move this to an actual server  
2 I am not storing the data anywhere.  
So when node-red creates graphs where does it store the data it recieves for the graphs? in RAM?  
what happens when i restart? does it all go away?

Would it help if I take the output of the data and store it in a database then call it for the graphs?

What are the best ways to optimise flows? any suggestions?  
Thanks guys

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [13 May 2018 18:47 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148/2 "2018-05-13T18:47:30Z")

</div>

If your question is only regarding the graphs maybe it helps you this way:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/07a320e8a5d01b7e350e4125d2769fce4444dcdf.png)

Take the top out from the graph and store it on a file (select overwritte file on config)  
Then after start inject to push the content of the file out pass it through json node and inject it back to the graph.

This will recover the data on deploy/restart

If you wanted to go through more advanced mode start looking for databases like SQL

---

<div class="post-metadata">

**Author:** ![BlinkScooby](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@BlinkScooby](https://discourse.nodered.org/u/BlinkScooby)\
**Post date:** [14 May 2018 12:12 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148/3 "2018-05-14T12:12:40Z")

</div>

That is a start!  
Where is the data stored if its not done like this? in Ram? temp on disk?  
Should I, instead be storing the data in an sql database then having a seperate flow for charts that pulls from the database? would that help?  
I also found this which helped my interface a tiny bit

> **[node-red dashboard development, Node-red solutions, node-red coders](https://www.softwareassociates.co.in/node-red-best-practices/)**
>
> IOT development using Node-RED dashboard development best practices for integrating smart devices on IBM Cloud for remote monitoring, maintenance management

---

<div class="post-metadata">

**Author:** ![davidcgu](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@davidcgu](https://discourse.nodered.org/u/davidcgu)\
**Post date:** [14 May 2018 12:29 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148/4 "2018-05-14T12:29:05Z")

</div>

Hello Blink

Most probably someone else can answer you as I don’t know exactly where is saved while running, what is clear is the fact that is lost after deploy/restart and as far as I know you have those 2 options( could be there are more…) or save it to a file and restore at start node-red as I showed you or handle the info on a database and work with it, is not extremely difficult but depending on your needs will deserve to do it… for me when is some table with not many values I used like this on a file and if you wanted something more advanced then I’m not using the graphs directly from node red, check grafana or emoncms or some other.

Regards

---

<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:** [14 May 2018 12:57 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148/5 "2018-05-14T12:57:12Z")

</div>

Currently, back-end data (global, flow, context variables) are all stored in server memory (RAM). Persistent variables are on the roadmap.

In the front-end (where the Dashboard actually lives when viewed by a user), data is also stored in RAM. Whilst the use of local storage is potentially possible for this, each browser has its own limits on what can be stored so it really isn’t very feasible to have a one-size-fits-all solution for persistence.

As to how to make your data persistent on the server, it really depends on the type and volume of data. If the data is complex, e.g. JSON, then a file or a nosql database would be best (a file probably only if you always need the whole dataset and update as a single unit or if the data is small). SQL works best when the data matches a relational format (e.g. tabular).

---

<div class="post-metadata">

**Author:** ![BlinkScooby](https://avatars.discourse-cdn.com/v4/letter/b/22d042/32.png) [@BlinkScooby](https://discourse.nodered.org/u/BlinkScooby)\
**Post date:** [20 May 2018 22:50 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148/6 "2018-05-20T22:50:52Z")

</div>

late reply but i got it to work so that is great. Thanks for the idea of writing to file. I should have implemented this earlier …haha i shutdown my pi and lost all my graphs ! doh!  
quick question about your delete (inject) node. Obvious its there to delete the existing data in it. but what did you add in it? because if I just inject a “delete” string it does nothing. It would be useful to know what you have in there. Thanks guys  
@Totallyinfo thats great to hear about persistant globals and where stuff is stored 🙂

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 May 2018 06:42 UTC](https://discourse.nodered.org/t/best-practices-questions-for-dashboard-and-storing-data/148/7 "2018-05-21T06:42:50Z")

</div>

To delete/clear a chart, send an empty array of data, ie. []
