-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Make scalers into per-task hub singletons (#2967) This addresses an issue where the costs associated with polling storage resources increase substantially when an app has a large number of durable-trigger functions compared to apps that only have a small number. * Remove unnecesary #ifdef * Update nuget package versions
- Loading branch information
Showing
10 changed files
with
71 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,8 +16,6 @@ namespace Microsoft.Azure.WebJobs.Extensions.DurableTask | |
{ | ||
internal sealed class DurableTaskScaleMonitor : IScaleMonitor<DurableTaskTriggerMetrics> | ||
{ | ||
private readonly string functionId; | ||
private readonly string functionName; | ||
private readonly string hubName; | ||
private readonly StorageAccountClientProvider storageAccountClientProvider; | ||
private readonly ScaleMonitorDescriptor scaleMonitorDescriptor; | ||
|
@@ -27,23 +25,22 @@ internal sealed class DurableTaskScaleMonitor : IScaleMonitor<DurableTaskTrigger | |
private DisconnectedPerformanceMonitor performanceMonitor; | ||
|
||
public DurableTaskScaleMonitor( | ||
string functionId, | ||
string functionName, | ||
string hubName, | ||
StorageAccountClientProvider storageAccountClientProvider, | ||
ILogger logger, | ||
DurableTaskMetricsProvider durableTaskMetricsProvider, | ||
DisconnectedPerformanceMonitor performanceMonitor = null) | ||
{ | ||
this.functionId = functionId; | ||
this.functionName = functionName; | ||
this.hubName = hubName; | ||
this.storageAccountClientProvider = storageAccountClientProvider; | ||
this.logger = logger; | ||
this.performanceMonitor = performanceMonitor; | ||
this.durableTaskMetricsProvider = durableTaskMetricsProvider; | ||
|
||
this.scaleMonitorDescriptor = new ScaleMonitorDescriptor($"{this.functionId}-DurableTaskTrigger-{this.hubName}".ToLower(), this.functionId); | ||
string id = $"DurableTaskTrigger-{this.hubName}".ToLower(); | ||
// Scalers in Durable Functions are shared for all functions in the same task hub. | ||
Check warning on line 41 in src/WebJobs.Extensions.DurableTask/Listener/DurableTaskScaleMonitor.cs GitHub Actions / Analyze (csharp)
Check warning on line 41 in src/WebJobs.Extensions.DurableTask/Listener/DurableTaskScaleMonitor.cs GitHub Actions / Analyze (csharp)
|
||
// So instead of using a function ID, we use the task hub name as the basis for the descriptor ID. | ||
this.scaleMonitorDescriptor = new ScaleMonitorDescriptor(id: id, functionId: id); | ||
} | ||
|
||
public ScaleMonitorDescriptor Descriptor | ||
|
@@ -141,9 +138,10 @@ private ScaleStatus GetScaleStatusCore(int workerCount, DurableTaskTriggerMetric | |
if (writeToUserLogs) | ||
{ | ||
this.logger.LogInformation( | ||
$"Durable Functions Trigger Scale Decision: {scaleStatus.Vote.ToString()}, Reason: {scaleRecommendation?.Reason}", | ||
"Durable Functions Trigger Scale Decision for {TaskHub}: {Vote}, Reason: {Reason}", | ||
this.hubName, | ||
this.functionName); | ||
scaleStatus.Vote, | ||
scaleRecommendation?.Reason); | ||
} | ||
|
||
return scaleStatus; | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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