Azure / azure-documentdb-changefeedprocessor-dotnet

This library provides a host for distributing change feed events in partitioned collection across multiple observers. Instances of the host can scale up (by adding) or down (by removing) dynamically, and the load will be automatically distributed among active instances in about-equal way.
Other
51 stars 22 forks source link

Introduce lease acquire reason #138

Closed aery-aery closed 5 years ago

aery-aery commented 5 years ago

Handling a situation with outdated lease state passed to load balancing strategy.

If GetAllLeasesAsync request takes few seconds, at the time it finishes returned lease state can be outdated. Load balancing algorithm can falsely consider leases expired in such cases which leads to unnecessary stealing leases from active owners. As a result cluster can experience a lot of re-balancing caused by latency/network issues while calling GetAllLeasesAsync.

Introduced a new interface ILeaseAcquireReasonProvider that allows to set acquire reason from partition load balancing strategy. If lease is expired, then no further updates are expected from the same owner, thus DocumentServiceLeaseStoreManager will not retry conflicts if AcquireReason is Expired. When conflict occurred, the decision about lease expiration needs to be re-evaluated on a next load balancing iteration.