I would like to understand how partition distribution is handled behind the Azure functions cosmosDb trigger. I have two Azure functions with same lease prefix listening to the change feed. Let's say the container has N partitions, how exactly the partition distributes among the two function apps. I read that the apps try to acquire the lease over the partitions. What's preventing a single function app to acquire lease over all partition and make the other app sit idle ? Does the change feed processor library underneath the functions communicate via the lease container to prevent this ?
Azure functions cosmosDB trigger lease reservation over partition
129 Views Asked by DxG At
1
There are 1 best solutions below
Related Questions in AZURE-FUNCTIONS
- Azure Function: switch from consumption to premium plan for 1 hour daily automatically?
- mutual tls authentication between app service and function app
- Azure Application Insights Not Displaying Custom Logs for Azure Functions with .NET 8
- Encountered an error (ServiceUnavailable) from host runtime on Azure Function App
- How to migrate from Azure Static Web Apps to Azure App Service?
- Logic Apps and long running Azure Function (Powershell)
- Not getting Information or Trace logs in Application Insights in .NET 8 function
- Azure Queue Functions | Trigger when multiple queue functions executions with a specific message property ends
- No HTTP Trigger Found In Azure function
- Python middleware for azure function warmup
- Problem deploying an Azure Function to a Function App
- Logic App Function App reading and writing Binary Files
- SwaggerUI on Azure Functions (.NET 8 Update)
- Azure Function Javascript Invocation hooks usage with HTTP triggers
- Error indexing method 'IntegrationFunction' Can't convert from type 'Microsoft.Azure.EventHubs.EventData
Related Questions in AZURE-COSMOSDB
- How to enable log to console Cosmos Client SDK requests
- Fetch non-structured data in Synapse for Cosmos DB NoSQL?
- How to handle multiple cosmos db accounts with a single cosmosclient. Questions on multi tenancy
- SQL Query not returning expected output from cosmos container
- How is `Task` run only when awaited in C#?
- Rust return a result from a function
- getting : 'The SSL connection could not be established, see inner exception.' with cosmosclient.CreateDatabaseIfNotExistsAsync method
- Error creating CosmosDB Mongo Collections via bicep
- How to connect to 2 different cosmos Databases in Java?
- Cosmos Deserializes On ReadItemAsync Even Through No Results
- What lifetime does continuationToken have in Azure CosmosDB?
- Azure RBAC permission to write Cosmos DB index policy but not create container
- cosmos Change feed listener in java
- Impact of number of physical partitions on Cosmos DB performance
- How to insert-or-replace an entity in Cosmos DB atomically?
Related Questions in COSMOSDBTRIGGER
- CosmosDB Trigger is not working with WebJobs
- CosmosDB trigger fails when deployed with this error "The listener for function 'x' was unable to start. The listener is already starting."
- Setting bool value in azure function trigger via app settings
- Astronomer.Cosmos -> AirFlow -> Dbt (DbtTaskGroup) error
- Disable certain types of credentials for CosmosDBTrigger when running locally
- Azure Function CosmosDB Trigger does not pick-up the changes in one partition
- CosmosDB trigger invoked without changes
- Azure functions cosmosDB trigger lease reservation over partition
- How to identify "insert" vs "update" diff in Azure Cosmos DB trigger?
- Azure Function cosmosDB trigger managed identity not working
- AzureFunction with CosmosDbTrigger+RetryPolicy won't retry after function restart
- Cosmos DB Trigger Azure Function misses some change feed
- How to handle different document types when listening to change feeds in Azure Functions Cosmos Db Triggers Extensions v4?
- How to configure non-string values in CosmosDBTrigger (or any other Trigger) attribute
- How to access etag header from response in Cosmos DB post-trigger
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can see the source code on github.
The PartitionLoadBalancer runs in a loop and periodically checks for leases to take.
For EqualPartitionsBalancingStrategy this calculates a target number of leases to process based on the number of leases (physical partitions) and the number of other hosts recorded in the leases collection as lease owners.
If the host already owns sufficient leases for its target it doesn't take any. Otherwise it will try and get up to its target from taking leases that have no owner or that have expired. Only if that comes up empty will it steal a single lease that the busiest other processor already owns.
This process will run again after a delay of LeaseAcquireInterval
I haven't dug in that deep but assume the "theft" is just communicated by updating the relevant lease in the leases collection and the original owner comes to notice it next time they try and update it.