Reputation: 2896
I am using the .NET SDK V3 (3.26.0) for Cosmos DB.
According to the documentation, Cosmos DB Feed Change Processor should distribute traffic in parallel to multiple instances in the same deployment unit (same processor name and leasing container).
I have been trying to do that, running three (and more) instances, but only one instance receives calls, the others remain idle.
When the receiving instance is stopped, I would expect that another instance picks up almost immediately, instead several seconds (30-60) pass before another instance begins receiving messages
Questions:
Upvotes: 0
Views: 817
Reputation: 15603
That documentation says that:
the change feed processor will, using an equal distribution algorithm, distribute all the leases in the lease container across all running instances of that deployment unit and parallelize compute
How many leases are in your lease collection? Leases are documents that contain an "Owner" property and start with and id
that matches your processorName
.
The time it takes for running instances to detect a crash or sudden stop of another instance is governed by the acquireInterval
(https://learn.microsoft.com/dotnet/api/microsoft.azure.cosmos.changefeedprocessorbuilder.withleaseconfiguration?view=azure-dotnet#microsoft-azure-cosmos-changefeedprocessorbuilder-withleaseconfiguration(system-nullable((system-timespan))-system-nullable((system-timespan))-system-nullable((system-timespan)))) which defaults to 17 seconds (how long it takes for any instance to scan for potential leases that have been dropped) and the expirationInterval
which defaults to 60 seconds (how long does it take for a lease is considered expired/with no owner).
Upvotes: 1