0

我有一个应用服务计划,按以下方式扩展:

  • 范围:2-20 个实例
  • CPU > 20%:扩展到 20 个实例
  • CPU < 15%:扩展到 2 个实例

随着时间的推移,我看到的实际实例数如下:

  • 20 个实例
  • (CPU ~ 0%)
  • 缩减到 2 个实例
  • (负载开始:CPU > 50%)
  • 最多 20 个实例(约 5 分钟)
  • (加载完成:CPU ~ 0%)
  • 最多 15 个实例(约 5 分钟)
  • 最多 12 个实例(约 5 分钟)
  • 最多 5 个实例(约 5 分钟)
  • 最多 2 个实例(约 5 分钟)

如何使其立即扩展到 2 个实例,而无需额外的步骤?

此外,有时,从 2 个实例扩展到 20 个实例会失败,并且 2 个实例仍处于巨大负载状态。是否可以告诉 azure 扩展到尽可能多的实例,而不是在巨大负载期间为用户留下 2 个实例?

更新:添加比例设置 JSON。

更新:添加比例设置屏幕截图。

整体比例设置: 比例设置和图表

如何扩大规模: 放大

它是如何缩小的: 缩小

{
  "id": "...",
  "name": "...",
  "type": "Microsoft.Insights/autoscaleSettings",
  "location": "westus",
  "tags": {
    "$type": "...",
    "...": "Resource"
  },
  "properties": {
    "profiles": [
      {
        "name": "Default",
        "capacity": {
          "minimum": "2",
          "maximum": "20",
          "default": "2"
        },
        "rules": [
          {
            "metricTrigger": {
              "metricName": "CpuPercentage",
              "metricNamespace": "",
              "metricResourceUri": "...",
              "timeGrain": "PT1M",
              "statistic": "Average",
              "timeWindow": "PT5M",
              "timeAggregation": "Maximum",
              "operator": "GreaterThan",
              "threshold": 20
            },
            "scaleAction": {
              "direction": "Increase",
              "type": "ExactCount",
              "value": "20",
              "cooldown": "PT1M"
            }
          },
          {
            "metricTrigger": {
              "metricName": "CpuPercentage",
              "metricNamespace": "",
              "metricResourceUri": "...",
              "timeGrain": "PT1M",
              "statistic": "Average",
              "timeWindow": "PT5M",
              "timeAggregation": "Average",
              "operator": "LessThan",
              "threshold": 15
            },
            "scaleAction": {
              "direction": "Decrease",
              "type": "ExactCount",
              "value": "2",
              "cooldown": "PT1M"
            }
          }
        ]
      }
    ],
    "enabled": true,
    "name": "...",
    "targetResourceUri": "...",
    "notifications": [
      {
        "operation": "Scale",
        "email": {
          "sendToSubscriptionAdministrator": false,
          "sendToSubscriptionCoAdministrators": false,
          "customEmails": [
            "..."
          ]
        },
        "webhooks": null
      }
    ]
  }
4

1 回答 1

1

您可以自定义 Web 应用程序的自动缩放设置以满足您的要求。

如果您使用的是 C#,则可以利用Azure 监控服务管理库。否则,您也可以使用您使用的语言中的 REST API 来管理自动缩放设置。设置元素的详细说明可以参考https://msdn.microsoft.com/en-us/library/azure/dn510367.aspx

请参阅https://github.com/Azure/azure-content/blob/master/articles/best-practices-auto-scaling.md了解更多信息。

更新

根据Use Azure Autoscale的最后一段:

当您配置多个策略和规则时,它们可能会相互冲突。Autoscale 使用以下冲突解决规则来确保始终有足够数量的实例在运行:

  • 横向扩展操作始终优先于横向扩展操作。
  • 当横向扩展操作发生冲突时,启动实例数量增加最多的规则优先。
  • 当操作规模发生冲突时,启动实例数量减少最小的规则优先。
于 2016-08-16T05:56:36.923 回答