CosmosDB Change Feed Scaling

喜夏-厌秋 提交于 2021-02-07 21:53:39

问题


I have my Azure function with CosmosDB trigger, that listens to a collection using lease collection mechanism. This function is hosted on consumption plan.

I have noticed that under heavy load I tend to get updates to my function with a greater and greater delay. After reading documentation I did not find a way how to improve scaling of my setup. Is there a way to?


回答1:


Consumption Plan instances should grow based on how far behind your Function is lagging. If you are using Consumption Plan, if you are using App Service Plan, you can scale them yourself.

That being said, the current unit of work is based on the Partition Key value ranges. This means that, similar to Event Hub, the parallel processing has a soft limit based on your data distribution.

One way to detect this is to check your leases collection. If you see only one lease (disregard items with .info or .lock as their ids), that means your current data distribution yields one partition key value range, and only one instance can be processing that (not matter how many other instances get provisioned).

Logs can also show how scaling is behaving and how are instances picking up the different leases in case there are multiple.



来源:https://stackoverflow.com/questions/56273997/cosmosdb-change-feed-scaling

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!