Below if my code of orchestrator, I am using combination of chaining and fanin/fanout
const df = require("durable-functions");
const geocodeActivity = "getActualData";
const getDataActivity = "getDataFromDB";
const ld = require('lodash')
module.exports = df.orchestrator(function* (context) {
const outputs = [];
const parallelTasks = [];
try {
let payload = context.bindingData.input;
payload.dataType = "truth";
let truthData = yield context.df.callActivity(getDataActivity, payload);
for (const data of truthData) {
const truthDataObj = payload;
truthDataObj.data = data;
//console.log("ORCHESTRATOR: " + JSON.stringify(truthDataObj));
parallelTasks.push(context.df.callActivity(geocodeActivity, ld.cloneDeep(truthDataObj)));
}
let actualData = yield context.df.Task.all(parallelTasks);
let uploadDataInfo = payload;
uploadDataInfo['actual_data'] = actualData;
let uploadedCsv = yield context.df.callActivity("uploadActualData", uploadDataInfo);
if (uploadedCsv == false || uploadedCsv == null || uploadedCsv === undefined) {
outputs.push("failed");
} else {
outputs.push(uploadedCsv);
}
} catch (err) {
context.log(JSON.stringify(err));
outputs.push('-1');
}
return outputs;
I am having below observations
Many times the orchestrators keeps stuck in running
The 1st Activity that is called for getDataActivity, returns record from DB, that can go upto million in rows and each row containing atleats 20 columns
Then I am looping through each record and performing some actions
But I have observed many times that it gets stuck in running or sometimes the server on which orchestrator is running gets restarted
Is it something to do with the huge amount of data that is getting returned from "GetDataActivity"? If yes what are your advise here, how can I try to solve this