简体   繁体   English

并行运行 Azure 耐用 Function 的问题

[英]Problem Running Azure Durable Function in parallel

I am trying to run each API call to my Azure Durable Function in parallel.我正在尝试并行运行对我的 Azure Durable Function 的每个 API 调用。 It works fine with executing just a single call, but when I get multiple calls at once (lets say 10) it first starts running all 10 requests.它只执行一个调用就可以正常工作,但是当我一次收到多个调用时(比如 10 个),它首先开始运行所有 10 个请求。 When the orchestrator function then calls the Activity Function that does the main work, it only starts executing some of the requests (2-6 depending on my host.json), and waits around 5 minutes before running the activity function with the rest of the requests.当协调器 function 然后调用执行主要工作的活动 Function 时,它只开始执行一些请求(2-6 取决于我的 host.json),并等待大约 5 分钟,然后运行活动 function 和 rest要求。

It should be noted that my Activity Function takes roughly 3-3,5 minutes to run, and is a mix of both heavy CPU usage and I/O operations.应该注意的是,我的活动 Function 大约需要 3-3,5 分钟才能运行,并且是 CPU 使用率高和 I/O 操作的混合体。

I have tried tweaking my parameters a lot (setting them to 1, and setting them to maximum), but nothing seems to fix it.我试过多次调整我的参数(将它们设置为 1,并将它们设置为最大值),但似乎没有什么可以解决的。 My host.json looks like this:我的 host.json 看起来像这样:

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[2.*, 3.0.0)"
  },
  "functionTimeout": "00:10:00",
  "extensions": {
    "durableTask": {
      "maxConcurrentActivityFunctions": 10,
      "maxConcurrentOrchestratorFunctions": 20,
      "storageProvider": {
        "controlQueueBatchSize": 5,
        "controlQueueBufferThreshold": 5
      }
    },
    "http": {
      "routePrefix": "api",
      "maxConcurrentRequests": 5
    }
  }
}

And my Azure Configuration uses:而我的 Azure 配置使用:

FUNCTIONS_WORKER_PROCESS_COUNT: 10 FUNCTIONS_WORKER_PROCESS_COUNT:10

PYTHON_THREADPOOL_THREAD_COUNT: 10 PYTHON_THREADPOOL_THREAD_COUNT:10

My experience is that most of durable functions scalability comes at Activity level.我的经验是,大多数持久函数的可扩展性都来自 Activity 级别。

From what you've said it sounds like you have one Orchestrator which runs one long running activity and you're trying to get scalability at the orchestrator level.根据您所说的,听起来您有一个 Orchestrator 运行一项长时间运行的活动,并且您正在尝试在 orchestrator 级别获得可扩展性。

Is it possible in your scenario to have a single http request trigger represent several items of work (json payload contains enough data for several work items) which the orchestrator could then run in parallel using the well documented fan out-fan in pattern?在您的场景中是否有可能让一个 http 请求触发器代表多个工作项(json 有效负载包含多个工作项的足够数据),然后编排器可以使用记录良好的扇出扇入模式并行运行?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM