Skip to content

Keep active work-item messages in scaling metrics - #1428

Merged
sophiatev merged 3 commits into
mainfrom
stevosyan/fix-scaling-down-active-work
Oct 29, 2026
Merged

sophiatev merged 3 commits into
mainfrom
stevosyan/fix-scaling-down-active-work

Conversation

@sophiatev

Copy link
Copy Markdown
Contributor

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.

Copilot AI balanced review requested due to automatic review settings October 29, 2026 17:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Copilot AI balanced review requested due to automatic review settings October 29, 2026 18:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the update to account for in-flight activity messages in scaling decisions.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings October 29, 2026 18:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Scale-in can still remove busy workers because running activities cannot migrate to unused concurrency slots on remaining workers, risking interruption and restart of long-running work.

1 open issue

Review effort: Balanced

@sophiatev
sophiatev merged commit 888b1c4 into main Oct 29, 2026
49 checks passed
@sophiatev
sophiatev deleted the stevosyan/fix-scaling-down-active-work branch October 29, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants