From c75cc0ec162935b0dc072031e4a171210d37b532 Mon Sep 17 00:00:00 2001 From: Alexey Rodionov Date: Wed, 10 Jan 2024 14:45:44 -0800 Subject: [PATCH 1/4] Fixing target base scale instance concurrency for queues --- .../src/Shared/Queues/QueueTargetScaler.cs | 2 +- .../tests/QueueTargetScalerTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs index 6da40f64a5b6b..c5d207403333d 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs @@ -55,7 +55,7 @@ public async Task 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) { diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTargetScalerTests.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTargetScalerTests.cs index 410be2e6e7494..cb69be0ca7774 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTargetScalerTests.cs +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/tests/QueueTargetScalerTests.cs @@ -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 { From f24c493db0aa0a9b134d1c555bac1ae40743c69b Mon Sep 17 00:00:00 2001 From: alrod Date: Wed, 19 Jun 2024 16:23:53 -0700 Subject: [PATCH 2/4] New commit --- .../src/Shared/Queues/QueueTargetScaler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs index c5d207403333d..d89c8fab535a4 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Common/src/Shared/Queues/QueueTargetScaler.cs @@ -59,7 +59,7 @@ internal TargetScalerResult GetScaleResultInternal(TargetScalerContext context, 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); From dd37dd077fffa4ace46a5ddd3889f9ce9fcb8d9a Mon Sep 17 00:00:00 2001 From: alrod Date: Thu, 20 Jun 2024 16:57:58 -0700 Subject: [PATCH 3/4] Adding changelog notes --- .../CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md index 2daf625f3628a..c528f4dd6aa2b 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md @@ -7,6 +7,8 @@ ### Breaking Changes ### Bugs Fixed +- Rely on PeekMessagesAsync when calculating message queue length +- Fixing target base scale instance concurrency for queues ### Other Changes From 6c32b24166144cedf72e9389c2e1e3e602faed94 Mon Sep 17 00:00:00 2001 From: alrod Date: Fri, 21 Jun 2024 17:23:40 -0700 Subject: [PATCH 4/4] Fix --- .../CHANGELOG.md | 9 ++------- .../CHANGELOG.md | 5 ----- .../CHANGELOG.md | 9 ++------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs/CHANGELOG.md b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs/CHANGELOG.md index 7e526da586302..76e9e3afa23c5 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs/CHANGELOG.md +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs/CHANGELOG.md @@ -1,14 +1,9 @@ # Release History ## 5.4.0-beta.1 (Unreleased) - -### Features Added - -### Breaking Changes - ### Bugs Fixed - -### Other Changes +- Rely on PeekMessagesAsync when calculating message queue length +- Fixing target base scale instance concurrency for queues ## 5.3.0 (2024-04-18) - Includes all features from 5.3.0-beta.1. diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md index c528f4dd6aa2b..67d7aaa33d8f0 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md @@ -1,11 +1,6 @@ # Release History ## 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 diff --git a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage/CHANGELOG.md b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage/CHANGELOG.md index 9856fffaa65ca..b0c383afbf093 100644 --- a/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage/CHANGELOG.md +++ b/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage/CHANGELOG.md @@ -1,14 +1,9 @@ # Release History ## 5.4.0-beta.1 (Unreleased) - -### Features Added - -### Breaking Changes - ### Bugs Fixed - -### Other Changes +- Rely on PeekMessagesAsync when calculating message queue length +- Fixing target base scale instance concurrency for queues ## 5.3.0 (2024-04-18) Please refer to [`Microsoft.Azure.WebJobs.Extension.Storage.Blobs`](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Blobs/CHANGELOG.md) and [`Microsoft.Azure.WebJobs.Extension.Storage.Queues`](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/storage/Microsoft.Azure.WebJobs.Extensions.Storage.Queues/CHANGELOG.md) for detailed list of changes.