我有一个.Net应用程序托管为Azure应用服务(webjob),它从一个事件中心读取并对这些消息执行一些操作。这个应用程序不是CPU或内存绑定,而是我想根据传入消息的数量来扩展到事件中心。
查看事件中心的传入和传出消息度量标准我已确定该应用程序每个实例每分钟可处理大约12k条消息。
但我不明白如何将其变成自动缩放设置。鉴于上述情况,我尝试将其设置为当传入的消息超过10000时将实例数增加1.但是,当事件中心的度量标准下的传入消息大约为45000并且我的实例计数为3时,没有任何反应。我希望它能够扩大规模,但它没有。为什么?
这是我的比例设置的样子:
{
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT5M"
},
"metricTrigger": {
"metricName": "EHINMSGS",
"metricNamespace": "",
"metricResourceUri": "my eventhubs",
"operator": "GreaterThan",
"statistic": "Average",
"threshold": 10000,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT5M"
}
},
{
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT5M"
},
"metricTrigger": {
"metricName": "EHINMSGS",
"metricNamespace": "",
"metricResourceUri": "my eventhubs",
"operator": "LessThan",
"statistic": "Average",
"threshold": 1000,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT5M"
}
}
我不确定它是否是一个答案,但对于Azure功能,您可以拥有尽可能多的并行运行的功能实例,因为许多事件中心都有分区。因此,例如,如果您的事件集线器有两个分区,那么同时只能有两个作业。
你可以在这里阅读更多:https://medium.com/@jeffhollan/in-order-event-processing-with-azure-functions-bb661eb55428