AGILE Application deployment and offloading
AGILE provides Node-RED nodes to export part of an AGILE application to a remote Node-RED instance. The code is hosted here: https://github.com/Agile-IoT/node-red-contrib-agile-deployer
The possible objectives to follow with the application deployment are:
- Develop locally and put into production on cloud,
- Process locally and forward data to cloud for further analysis (Real Time processing vs Batch processing),
- Offloading of job processing to the cloud in case the gateway is overloaded.
In AGILE we have focused in the last item. For this to work, it is important to know what nodes can be exported or not. In AGILE, we have decided to simplify the process by making the allocation of nodes explicit. The developer must "isolate" the workflow to be exported in a separate flow (i.e. a separate Node-RED tab), receiving input from link-in nodes and returning output to link-out nodes.
The TabDeploy node is in charge of exporting a flow (identified by its name) to a configured remote Node-RED instance. In the figure, the local workflow is represented by a 'Main' flow and a 'HeavyTask' flow. The HeavyTask flow is the flow to be exported.
To achieve the offloading, a CloudLink node (the 'link' node in the figure) must be placed before the link-out node to the flow to export. The CloudLink node has two outputs: the first output is used for local processing; while the second output is used when the cloud-link node has internally forwarded the input data to the remote workflow and received its output.
The decision to offload in the cloud-link node is taken in case the gateway is considered overloaded. To overload situation is currently detected measuring the gateway temperature, the %mem usage and the %CPU usage. This performance values are compared with threshold values configured in the cloud-link node. In case any of these values is above the threshold, the data is offloaded.