Skip to content

Commit

Permalink
Fixing target base scale instance concurrency for queues (#44661)
Browse files Browse the repository at this point in the history
* Fixing target base scale instance concurrency for queues

* New commit

* Adding changelog notes

* Fix

---------

Co-authored-by: Amanda Nguyen <amnguye@microsoft.com>
  • Loading branch information
alrod and amnguye authored Jul 16, 2024
1 parent 1de7cef commit 0984ae3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

## 5.4.0-beta.1 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed
- Rely on PeekMessagesAsync when calculating message queue length
- Fixing target base scale instance concurrency for queues
- Bumped version of Azure.Storage.Blobs to resolve issue where Blob Path was being truncated at '#' character.

### Other Changes

## 5.3.0 (2024-04-18)
- Includes all features from 5.3.0-beta.1.
- Bumped Azure.Identity dependency to 1.11.1 to resolve secruity vulnerability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public async Task<TargetScalerResult> GetScaleResultAsync(TargetScalerContext co

internal TargetScalerResult GetScaleResultInternal(TargetScalerContext context, int queueLength)
{
int concurrency = !context.InstanceConcurrency.HasValue ? _options.BatchSize : context.InstanceConcurrency.Value;
int concurrency = !context.InstanceConcurrency.HasValue ? _options.BatchSize + _options.NewBatchThreshold : context.InstanceConcurrency.Value;

if (concurrency < 0)
{
throw new ArgumentOutOfRangeException($"Concurrency value='{concurrency}' used for target based scale must be > 0");
throw new ArgumentOutOfRangeException($"Concurrency value='{concurrency}' used for target based scale must be > 0.");
}

int targetWorkerCount = (int)Math.Ceiling(queueLength / (decimal)concurrency);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

## 5.4.0-beta.1 (Unreleased)

### Features Added

### Breaking Changes

### Bugs Fixed
- Rely on PeekMessagesAsync when calculating message queue length
- Fixing target base scale instance concurrency for queues
- When grabbing Queue Metrics for amount of messages, will now use the QueueTriggerMetrics.QueueLength instead of the ApproximateMessagesCount for less stale metrics.
### Other Changes

## 5.3.0 (2024-04-18)
- Includes all features from 5.3.0-beta.1.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void Setup()
[TestCase(160, 20, 8)]
public void QueueTargetScaler_Returns_Expected(int queueLength, int? concurrency, int expectedTargetWorkerCount)
{
QueuesOptions options = new QueuesOptions { BatchSize = 16 };
QueuesOptions options = new QueuesOptions { BatchSize = 8, NewBatchThreshold = 8 };

TargetScalerContext context = new TargetScalerContext
{
Expand Down

0 comments on commit 0984ae3

Please sign in to comment.