【发布时间】:2018-09-20 11:04:54
【问题描述】:
我的应用服务在横向扩展后未能横向扩展。这似乎是我几个月来一直试图排除故障的一种模式。
我尝试了以下方法,但都没有奏效:
我的缩放条件基于 CPU 和内存。但是,我从未见过 CPU 超过 12%,所以我假设它实际上是基于内存进行扩展的。
将横向扩展条件设置为内存超过 90%,平均 5 分钟和 10 分钟。平均 5 分钟内,内存低于 70% 的冷却和扩展条件。这似乎没有意义,因为如果我的内存利用率已经达到 90%,那么我确实存在潜在的内存泄漏并且应该已经向外扩展了。
将横向扩展条件设置为内存超过 80%,平均 60 分钟和 10 分钟。平均 5 分钟内,内存低于 60% 的冷却和扩展条件。这更有意义,因为我已经看到内存使用量在几个小时内突然下降。
预期行为:应用服务自动缩放将在内存使用率降至 60% 以下的 5 分钟后减少实例计数。
问题:
如果我的基准 CPU 大致保持在平均 6% 并且内存保持在 53%,那么平滑扩展的指标的理想阈值是多少?意思是,在不担心反模式(例如摆动)的情况下,可以缩小的最佳最小值和扩大的最佳最大值是多少? 20% 差异的较大阈值对我来说更有意义。
替代方案:
考虑到与“按钮缩放”一样简单的营销所涉及的故障排除数量,几乎不值得为配置模糊而头疼(如果没有自定义 powershell,您甚至无法使用连接计数等 IIS 指标脚本!)。我正在考虑禁用自动缩放,因为它的不可预测性,只保持 2 个实例运行以实现自动负载平衡和手动缩放。
自动缩放配置:
{
"location": "East US 2",
"tags": {
"$type": "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"
},
"properties": {
"name": "CPU and Memory Autoscale",
"enabled": true,
"targetResourceUri": "/redacted",
"profiles": [
{
"name": "Auto created scale condition",
"capacity": {
"minimum": "1",
"maximum": "10",
"default": "1"
},
"rules": [
{
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT10M"
},
"metricTrigger": {
"metricName": "MemoryPercentage",
"metricNamespace": "",
"metricResourceUri": "/redacted",
"operator": "GreaterThanOrEqual",
"statistic": "Average",
"threshold": 80,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT1H"
}
},
{
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT5M"
},
"metricTrigger": {
"metricName": "MemoryPercentage",
"metricNamespace": "",
"metricResourceUri": "/redacted",
"operator": "LessThanOrEqual",
"statistic": "Average",
"threshold": 60,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT10M"
}
},
{
"scaleAction": {
"direction": "Increase",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT5M"
},
"metricTrigger": {
"metricName": "CpuPercentage",
"metricNamespace": "",
"metricResourceUri": "/redacted",
"operator": "GreaterThanOrEqual",
"statistic": "Average",
"threshold": 60,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT1H"
}
},
{
"scaleAction": {
"direction": "Decrease",
"type": "ChangeCount",
"value": "1",
"cooldown": "PT5M"
},
"metricTrigger": {
"metricName": "CpuPercentage",
"metricNamespace": "",
"metricResourceUri": "/redacted",
"operator": "LessThanOrEqual",
"statistic": "Average",
"threshold": 40,
"timeAggregation": "Average",
"timeGrain": "PT1M",
"timeWindow": "PT10M"
}
}
]
}
],
"notifications": [
{
"operation": "Scale",
"email": {
"sendToSubscriptionAdministrator": false,
"sendToSubscriptionCoAdministrators": false,
"customEmails": [
"redacted"
]
},
"webhooks": []
}
],
"targetResourceLocation": "East US 2"
},
"id": "/redacted",
"name": "CPU and Memory Autoscale",
"type": "Microsoft.Insights/autoscaleSettings"
}
【问题讨论】:
标签: azure azure-web-app-service autoscaling azure-app-service-plans