Repository navigation
Keep active work-item messages in scaling metrics - #1428
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Both recommendation paths still ignore the retained work-item count, allowing scale-in while invisible activities are running, and the regression test does not cover this scenario.
1 open issue
What changed in this PR
This PR preserves in-flight activity messages in Azure Storage scaling metrics to address premature scale-down of workers executing long-running activities.
Changes:
- Retains work-item queue counts when all messages are invisible, while keeping latency at zero.
- Preserves existing control-queue behavior for timers that are not yet due.
- Adds regression coverage for queued, running, newly added, and completed activity messages.
| File | Description |
|---|---|
| test/DurableTask.AzureStorage.Tests/AzureStorageScaleTests.cs | Tests queue metrics throughout the activity-message lifecycle. |
| src/DurableTask.AzureStorage/Monitoring/DisconnectedPerformanceMonitor.cs | Includes invisible work-item messages in queue-length metrics. |
Review effort: Balanced
Naiyuan Tian (nytian)
previously approved these changes
Oct 29, 2026
Naiyuan Tian (nytian)
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


We currently have a bug where we disregard active work being down and issue scale down of hosts that are actively executing work items. This can be very detrimental for long-running Activities in particular - the hosts executing them are scaled down, their Activity work items become visible again at which point hosts are provisioned again and the work items start again, etc. leading to oscillation and a constant start-stop-start pattern.