我有一个Durable Function App
(.NET 7独立工作器),其中我在Orchestrator
中运行了一个Foreach循环,以使活动函数以以下方式并行运行:
foreach (var item in itemList)
{
itemIndex++; //sent to activity function to determine if a new file needs to be created as we're storing results in blob storage
activities.Add(context.CallActivityAsync(Constants.FUNCTION_NAME, new activityInput
{
activityInput data
}));
}
await Task.WhenAll(activities);
每个活动功能的完成大约需要3分钟(大量的业务逻辑/数据库访问).随着我继续对函数进行压力测试并添加更多实例,运行时间随着运行的活动函数数量的增加而线性增加.因此,对于10个功能中的一个风扇来说,大约需要30分钟.根据运行所用的时间,它似乎不是并行运行的(或者可能是并行运行,但负载密集型导致速度变慢)?
活动函数的业务逻辑中是否有我遗漏或需要查找的内容,而这些内容可能会导致单个实例停止(如DB调用等)?