I've a query, while writing and reading the data to the global variable having multiple nested objects from different flows and nodes ...will it leads to any performance issue in node red ?
my global variable will be like this -->
For our project I'm using the centralized data in one global variable under many layers of data splitted into sub objects, is this better approach to store data under single variable ?
There will be a "cost" once objects become very large (objects with 100k+ arrays). The example you gave is very small, there will be no measurable performance impact. However, you could run into potential problems when multiple flows write into the same object and it is written to disk while other flows are reading+writing into the same object.
Maybe I misunderstand but doesn't that mean that your value "data7", already rather cryptically named, will be stored at globalvariable.vsecc.connector1.em.freq.real.value.type.int.value.data.data.data.data.data.data.data7?
Do you need to use a global variable to store this value anyway?
I just have given an example data structure, how I'm storing the different variables under single.
I just need info about like will it effect the performance of node red (CPU usage) while accesing the global variable having length nested objectsand sub objects simultaeously from different nodes
So, updating the same variable from different nodes at the same time using common trigger for all the function node where each function node will set the same global variable...so in this case also, it wont be a problem ??
your question is about writing to context, each node has to take its turn, so writing should not be an issue. You may find concurrency issues with the data not being what you expect, if two nodes have written to context, the first node that writes the data may find the data has been changed by the second node, and this may cause issues you may not of expected.
If you trigger them all at once and they all update the same variable, then they will run one after another, so at the end the variable will be set to whichever function ran last, but you will not know which one ran last.