azureazure-cosmosdbazure-cosmosdb-sqlapiazure-cosmosdb-changefeed

Change Feed Processor: multi-region deployment units


I have microservices (Kubernetes pods) running in multiple regions. I have one monitored collection. (all regions will be monitoring the same collection; each region has multiple pods)

I want each document (that was updated) to be processed independently by the deployment-units in each region. Here's how I plan to make this work:

Questions:

the number of instances should not be greater than the number of leases.

Other than the fact that some pods could be sitting idle, does having more instances than leases, cause any other issues? (particularly issues in the lease state, or in acquiring/renewing leases, etc.)


Solution

    1. Yes. As long as they are different Deployment Units (https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/change-feed-processor?tabs=dotnet#deployment-unit) it doesn't matter where they are physically located, each Deployment Unit will receive the changes.
    2. Correct. Each Deployment Unit will create it's own independent set of leaes.
    3. You cannot. The distribution of leases-per-machine is by design, there is no configuration to force it.
    4. That is the ideal scenario, the reason is that all machines (using the LeaseAcquireInterval) frequently check if they can acquire a new lease. If the machine currently owning it releases it (for an unhandled error for example) then the lease could jump to any other machine. Depending on your telemetry, that might be undesirable.