Best Practices questions for dashboard and storing data

#1

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.

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

#2

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

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

#3

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

#4

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

#5

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).

#6

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 :slight_smile:

#7

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