Azure服务总线在二头肌模板中的自动缩放



在我们的项目中,我们使用服务总线,对于作为代码的基础设施,我们使用二头肌模板来部署这个服务总线。最近我们得出结论,我们应该启用服务总线的可伸缩性,因为我们在单个消息单元的容量方面遇到了一些严重的问题。有人知道是否有办法在服务总线Azure资源的二头肌模板中添加自动缩放功能吗?我在微软的官方文档中找不到什么。

Google没有帮助…

如果你看一下文档,有一个ARM模板显示如何配置自动缩放:

  • 自动更新Azure服务总线命名空间的消息单元。

等效的bicep(使用az bicep反编译器)看起来像这样:

@description('Name of the Service Bus namespace')
param serviceBusNamespaceName string
@description('Name of the Queue')
param serviceBusQueueName string
@description('Name of the auto scale setting.')
param autoScaleSettingName string
@description('Location for all resources.')
param location string = resourceGroup().location
resource serviceBusNamespaceName_resource 'Microsoft.ServiceBus/namespaces@2021-11-01' = {
name: serviceBusNamespaceName
location: location
sku: {
name: 'Premium'
}
properties: {
}
}
resource serviceBusNamespaceName_serviceBusQueueName 'Microsoft.ServiceBus/namespaces/queues@2021-11-01' = {
parent: serviceBusNamespaceName_resource
name: '${serviceBusQueueName}'
properties: {
lockDuration: 'PT5M'
maxSizeInMegabytes: 1024
requiresDuplicateDetection: false
requiresSession: false
defaultMessageTimeToLive: 'P10675199DT2H48M5.4775807S'
deadLetteringOnMessageExpiration: false
duplicateDetectionHistoryTimeWindow: 'PT10M'
maxDeliveryCount: 10
autoDeleteOnIdle: 'P10675199DT2H48M5.4775807S'
enablePartitioning: false
enableExpress: false
}
}
resource autoScaleSettingName_resource 'Microsoft.Insights/autoscaleSettings@2021-05-01-preview' = {
name: autoScaleSettingName
location: 'East US'
tags: {
}
properties: {
name: autoScaleSettingName
enabled: true
predictiveAutoscalePolicy: {
scaleMode: 'Disabled'
scaleLookAheadTime: null
}
targetResourceUri: serviceBusNamespaceName_resource.id
profiles: [
{
name: 'Increase messaging units to 2 on weekends'
capacity: {
minimum: '2'
maximum: '2'
default: '2'
}
rules: []
recurrence: {
frequency: 'Week'
schedule: {
timeZone: 'Eastern Standard Time'
days: [
'Saturday'
'Sunday'
]
hours: [
6
]
minutes: [
0
]
}
}
}
{
name: '{"name":"Scale Out at 75% CPU and Scale In at 25% CPU","for":"Increase messaging units to 4 on weekends"}'
capacity: {
minimum: '1'
maximum: '8'
default: '2'
}
rules: [
{
scaleAction: {
direction: 'Increase'
type: 'ServiceAllowedNextValue'
value: '1'
cooldown: 'PT5M'
}
metricTrigger: {
metricName: 'NamespaceCpuUsage'
metricNamespace: 'microsoft.servicebus/namespaces'
metricResourceUri: serviceBusNamespaceName_resource.id
operator: 'GreaterThan'
statistic: 'Average'
threshold: 75
timeAggregation: 'Average'
timeGrain: 'PT1M'
timeWindow: 'PT10M'
dimensions: []
dividePerInstance: false
}
}
{
scaleAction: {
direction: 'Decrease'
type: 'ServiceAllowedNextValue'
value: '1'
cooldown: 'PT5M'
}
metricTrigger: {
metricName: 'NamespaceCpuUsage'
metricNamespace: 'microsoft.servicebus/namespaces'
metricResourceUri: serviceBusNamespaceName_resource.id
operator: 'LessThan'
statistic: 'Average'
threshold: 25
timeAggregation: 'Average'
timeGrain: 'PT1M'
timeWindow: 'PT10M'
dimensions: []
dividePerInstance: false
}
}
]
recurrence: {
frequency: 'Week'
schedule: {
timeZone: 'Eastern Standard Time'
days: [
'Saturday'
'Sunday'
]
hours: [
18
]
minutes: [
0
]
}
}
}
]
notifications: []
targetResourceLocation: 'East US'
}
}

最新更新