Azure / Azure/azure-functions-host
Improve Host Lock Renewals
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
Currently the host lock we take in PrimaryHostCoordinator has a very simple renewal strategy in place - it attempts to renew the lease just 3 seconds before the 15 second lease expires. Waiting so long might be error prone - e.g. if a network delay happens we might miss the renewal.
In the core WebJobs SDK for leases we employ a more sophisticated retry mechanism. At the half way point in the lease we start trying to renew, and on failure, we linearly speed up the retry attempts (code [here](https://github.com/Azure/azure-webjobs-sdk/blob/4f339cfab44bbf1786843a71a031594cc27ed811/src/Microsoft.Azure.WebJobs.Host/Singleton/SingletonManager.cs#L140)).
We should consider doing something similar in the Functions runtime.
Contributor guide
Research direction
Start at PrimaryHostCoordinator and compare its current host-lock renewal timing with the retry approach in SingletonManager.cs around line 140 of the linked Azure WebJobs SDK commit. The work should begin renewal at the lease midpoint and retry failures with linearly shorter intervals, while preserving reliable renewal of the 15-second lease.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud, distributed-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100