限制并发逻辑应用程序(标准)工作流程实例

发布于 2025-02-13 11:05:15 字数 749 浏览 1 评论 0 原文

我有一个场景,我从服务总线接收消息来触发工作流程。该工作流程进行了一些处理,但最终将一些数据插入SQL DB中。当100,000个消息立即出现时,数据库就会不知所措。

有没有一种方法可以限制并发实例的数量?

这是我的测试

“

这会收到一条非会话消息,有2分钟的延迟,然后A组成只是为了进行最终活动。

如果我提交10条消息,请启用工作流程,立即使所有10条消息都会导致10个工作流激活。

这是我的host.json文件

I have a scenario where I receive messages from service bus to trigger a workflow. This workflow does some processing but ultimately inserts some data into SQL DB. When 100,000's of messages appear at once, the DB gets overwhelmed.

Is there a way of restricting the number of concurrent instances?

Here is my test

workflow

This receives a non session message, has a 2 minute delay, then a compose just to ad an end activity.

If I submit 10 messages, enable the workflow, immediately all 10 messages cause 10 workflows to activate.

enter image description here

Here is my host.json file

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

万劫不复 2025-02-20 11:05:15

逻辑应用标准在Azure函数上运行,因此您应该能够使用 host.json 设置:

{
    "version": "2.0",
    "extensions": {
        "serviceBus": {
            "clientRetryOptions":{
                "mode": "exponential",
                "tryTimeout": "00:01:00",
                "delay": "00:00:00.80",
                "maxDelay": "00:01:00",
                "maxRetries": 3
            },
            "prefetchCount": 0,
            "transportType": "amqpWebSockets",
            "webProxy": "https://proxyserver:8080",
            "autoCompleteMessages": true,
            "maxAutoLockRenewalDuration": "00:05:00",
            "maxConcurrentCalls": 16,
            "maxConcurrentSessions": 8,
            "maxMessageBatchSize": 1000,
            "sessionIdleTimeout": "00:01:00",
            "enableCrossEntityTransactions": false
        }
    }
}

您还可以使用AppSettings设置此设置(请参见现有答案):

AzureFunctionsJobHost__extensions__serviceBus__maxConcurrentCalls

Logic App standard runs on Azure Function so you should be able to limit the numbers of concurrent calls using host.json settings:

{
    "version": "2.0",
    "extensions": {
        "serviceBus": {
            "clientRetryOptions":{
                "mode": "exponential",
                "tryTimeout": "00:01:00",
                "delay": "00:00:00.80",
                "maxDelay": "00:01:00",
                "maxRetries": 3
            },
            "prefetchCount": 0,
            "transportType": "amqpWebSockets",
            "webProxy": "https://proxyserver:8080",
            "autoCompleteMessages": true,
            "maxAutoLockRenewalDuration": "00:05:00",
            "maxConcurrentCalls": 16,
            "maxConcurrentSessions": 8,
            "maxMessageBatchSize": 1000,
            "sessionIdleTimeout": "00:01:00",
            "enableCrossEntityTransactions": false
        }
    }
}

You could also set this setting using appsettings (see existing answer):

AzureFunctionsJobHost__extensions__serviceBus__maxConcurrentCalls
笑梦风尘 2025-02-20 11:05:15

您可以在应用程序级别应用并发控制(与托马斯建议的类似概念相似,但是逻辑应用程序有特定的切换)。下面的链接指向这些值:

https://learn.microsoft.com/en-us/azure/logic-apps/edit-app-settings-host-settings?tabs=visual-studio-code#trigger-conconcorrency

值您正在寻找的是runtime.trigger.maximumrunco​​ncurrency(这在hosts.json中应用)。文档中有一些有关如何设置主机的指导(滚动一点)。

另一个选项是删除拆分,因此您会收到一个带有所有消息的数组,并使用for-each循环,在该循环中,您可以在循环并发上获得更多控制。

我希望这会有所帮助。

欢呼,瓦格纳。

You can apply concurrency control at the app level (similar concept to what Thomas suggested, but there are specific toggles for Logic Apps). The link below points to those values:

https://learn.microsoft.com/en-us/azure/logic-apps/edit-app-settings-host-settings?tabs=visual-studio-code#trigger-concurrency

The value you are looking is Runtime.Trigger.MaximumRunConcurrency (and this is applied in the hosts.json). There is some guidance in the document on how to setup host.json (scroll up a bit).

Another option is to remove the split on, so you receive an array with all the messages and use a for-each loop, where you have more control on loop concurrency.

I hope this helps.

Cheers, Wagner.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文