Skip to content

Commit a49ab6a

Browse files
authored
[Functions] Event Hubs: Adjust default batch size (Azure#38456)
The focus of these changes is to increase the default for the maximum batch size from 10 to 100. This setting represents the maximum number of events from Event Hubs that the function can receive when it's invoked. The decision to change the default was based on developer feedback, testing, and a desire to match the defaults used by the Azure SDK for Event Hubs. This change will be beneficial to the average scenario by helping to improve performance as well as lower costs due to fewer function executions.
1 parent 437b60e commit a49ab6a

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Release History
22

3-
## 5.6.0-beta.1 (Unreleased)
4-
5-
### Features Added
3+
## 6.0.0 (2023-09-06)
64

75
### Breaking Changes
86

9-
### Bugs Fixed
7+
- The default batch size has changed to 100 events. Previously, the default batch size was 10.
8+
9+
This setting represents the maximum number of events from Event Hubs that the function can receive when it's invoked. The decision to change the default was based on developer feedback, testing, and a desire to match the defaults used by the Azure SDK for Event Hubs. This change will be beneficial to the average scenario by helping to improve performance as well as lower costs due to fewer function executions.
1010

11-
### Other Changes
11+
We recommend testing to ensure no breaking changes are introducing to your function app before updating existing applications to version 6.0.0 or newer of the Event Hubs extension, especially if you have code code that was written to expect 10 as the max event batch size.
1212

1313
## 5.5.0 (2023-08-11)
1414

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Config/EventHubOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class EventHubOptions : IOptionsFormatter
1818
{
1919
public EventHubOptions()
2020
{
21-
MaxEventBatchSize = 10;
21+
MaxEventBatchSize = 100;
2222
MinEventBatchSize = 1;
2323
MaxWaitTime = TimeSpan.FromSeconds(60);
2424
ConnectionOptions = new EventHubConnectionOptions()
@@ -118,7 +118,7 @@ public int BatchCheckpointFrequency
118118

119119
/// <summary>
120120
/// Gets or sets the maximum number of events delivered in a batch. This setting applies only to functions that
121-
/// receive multiple events. Default 10.
121+
/// receive multiple events. Default 100.
122122
/// </summary>
123123
public int MaxEventBatchSize
124124
{

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/src/Microsoft.Azure.WebJobs.Extensions.EventHubs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.0</TargetFrameworks>
55
<Description>Microsoft Azure WebJobs SDK EventHubs Extension</Description>
6-
<Version>5.6.0-beta.1</Version>
6+
<Version>6.0.0</Version>
77
<!--The ApiCompatVersion is managed automatically and should not generally be modified manually.-->
88
<ApiCompatVersion>5.5.0</ApiCompatVersion>
99
<NoWarn>$(NoWarn);AZC0001;CS1591;SA1636</NoWarn>

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/EventHubTriggerAttributeBindingProviderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public EventHubTriggerAttributeBindingProviderTests()
6060

6161
[Test]
6262
[TestCase(nameof(SingleDispatch), 1)]
63-
[TestCase(nameof(MultipleDispatch), 10)]
63+
[TestCase(nameof(MultipleDispatch), 100)]
6464
public async Task TryCreateAsync_BatchCountsDefaultedCorrectly(string function, int expectedBatchCount)
6565
{
6666
ParameterInfo parameter = GetType().GetMethod(function, BindingFlags.NonPublic | BindingFlags.Static).GetParameters()[0];

sdk/eventhub/Microsoft.Azure.WebJobs.Extensions.EventHubs/tests/EventHubsTargetScalerTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public void ThrottleScaleDownIfNecessaryInternal_ReturnsExpected(int currentTarg
7676
}
7777

7878
[Test]
79-
// Using default concurrency of 10.
79+
// Using concurrency of 10.
8080
[TestCase(10, 10, 1)]
8181
[TestCase(20, 10, 2)]
8282
[TestCase(30, 10, 3)]
@@ -85,15 +85,15 @@ public void ThrottleScaleDownIfNecessaryInternal_ReturnsExpected(int currentTarg
8585
[TestCase(150, 10, 10)]
8686
public void GetScaleResultInternal_ReturnsExpected(long eventCount, int partitionCount, int expectedTargetWorkerCount)
8787
{
88-
TargetScalerResult result = _targetScaler.GetScaleResultInternal(new TargetScalerContext { }, eventCount, partitionCount);
88+
TargetScalerResult result = _targetScaler.GetScaleResultInternal(new TargetScalerContext { InstanceConcurrency = 10 }, eventCount, partitionCount);
8989
Assert.AreEqual(expectedTargetWorkerCount, result.TargetWorkerCount);
9090
}
9191

9292
[Test]
9393
[TestCase(10, 20, 30, 10)] // InstanceConcurrency defined in TargetScalerContext takes precedence
9494
[TestCase(null, 20, 30, 30)] // TargetUnprocessedEventThreshold takes second precendence
9595
[TestCase(null, 20, null, 20)] // Finally MaxEventBatchSize is only used if InstanceConcurrency and TargetUnprocessedEventThreshold are both undefined
96-
[TestCase(null, null, null, 10)] // Using default value of MaxEventBatchSize
96+
[TestCase(null, null, null, 100)] // Using default value of MaxEventBatchSize
9797
public void GetDesiredConcurrencyInternal_ReturnsExpected(int? instanceConcurrency, int? maxEventBatchSize, int? targetUnprocessedEventThreshold, int expectedConcurrency)
9898
{
9999
TargetScalerContext context = new TargetScalerContext() { InstanceConcurrency = instanceConcurrency };

0 commit comments

Comments
 (0)