Azure Function CosmosDBTrigger无法缩放 [英] Azure Function CosmosDBTrigger unscaleable

查看:76
本文介绍了Azure Function CosmosDBTrigger无法缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有CosmosDBTrigger的Azure功能,该功能正在使用Application Insights监视消费过程.被监视的集合在变更feed中插入了500,000.消费计划会在几分钟内将实例数增加到15,但是只有第一个实例能够处理任何更改.

I have a Azure Function with a CosmosDBTrigger working on a consumption play monitored with Application Insights. The collection being monitored has 500,000 inserts in the change feed. The consumption plan scales up the number of instances to 15 within a few minutes but only the first instance is able to process any changes.

我认为这是因为租约是由一审保留的.我基本上是为14实例付出任何代价.

I assume this is because of the lease is kept by the first instance. I am essentially paying for 14 instances to do nothing.

我注意到您应该能够在CosmosDBTrigger上设置一个名为LeaseOptions的属性,但是当我尝试进行操作时,我目前会收到错误消息:"Error CS0655 'LeaseOptions' is not a valid named attribute argument because it is not a valid attribute parameter type"

I noticed you are supposed to be able to set a property on CosmosDBTrigger called LeaseOptions but I currently get an error whenever I try: "Error CS0655 'LeaseOptions' is not a valid named attribute argument because it is not a valid attribute parameter type"

是否可以扩展CosmosDBTrigger Azure函数,以便一次可以由10, 20甚至200实例进行处理?

Is there a way to scale a CosmosDBTrigger Azure Function so it can be processed by 10, 20 or even 200 instances at a time?

推荐答案

如Drew所述,LeaseOptions不可配置,但这是

As Drew mentioned, the LeaseOptions are not configurable, but it's something that is coming soon.

关于扩展,触发器将在分区键范围,位于最多,每个实例将分配1个租约.在分区键范围内添加更多实例将不会添加更多并行处理.

As for the scaling, the Trigger will start sharing leases following the Change Feed Processor Library's design among the instances to balance the load. This happens within a couple of seconds that the instances appear and there is a limit on how many instances will be distributed based on the amount of leases. Since each lease represents a Partition Key Range, at maximum, they will be distributed 1 lease per instance. Adding more instances over the amount of Partition Key Ranges will not add more parallel processing.

可能是实例的创建/销毁时间早于算法可以共享租约的时间.

It could be that the instances are being created / destroyed sooner than the algorithm can share the leases.

500,000个插入片段分布在几个分区中还是全部位于同一分区中?函数是滞后于更改还是以良好的速度处理它们?您是否有其他功能(在本地或Azure中运行)使用相同的租约集合监视相同的集合?

Are the 500,000 inserts spread among several partitions or are all in the same partition? Is the Function lagging behind the changes or is it processing them at good speed? Do you have other Functions (either running locally or in Azure) monitoring the same collection using the same lease collection?

请注意,您无需支付实例数量,而是金额处死.

As a side note, you are not paying for the amount of instances, but the amount of executions.

这篇关于Azure Function CosmosDBTrigger无法缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆