Примечание
Для доступа к этой странице требуется авторизация. Вы можете попробовать войти или изменить каталоги.
Для доступа к этой странице требуется авторизация. Вы можете попробовать изменить каталоги.
Примечание.
The Basic, Standard, and Enterprise plans entered a retirement period on March 17, 2025. Дополнительные сведения см. в объявлении о выходе на пенсию в Azure Spring Apps.
The Standard consumption and dedicated plan entered a retirement period on September 30, 2024, with a complete shutdown by the end of March 2025. For more information, see Migrate Azure Spring Apps Standard consumption and dedicated plan to Azure Container Apps.
Эта статья относится к:✅ Java ✅ C#
Эта статья относится к:✅ Basic/Standard ✅ Enterprise
This article describes how to set up autoscale settings for your applications using the Microsoft Azure portal or the Azure CLI.
Автомасштабирование — это встроенная функция Azure Spring Apps, которая обеспечивает оптимальную работу приложений при изменении нагрузки. Azure Spring Apps поддерживает масштабирование наружу и внутрь, в том числе изменение количества экземпляров приложений и балансировку нагрузки.
Предварительные условия
- Подписка Azure. Если у вас еще нет подписки Azure, создайте бесплатную учетную запись, прежде чем начинать работу.
- Развернутый экземпляр службы Azure Spring Apps. Дополнительные сведения см. в статье Краткое руководство. Развертывание первого приложения Azure Spring Apps.
- At least one application already created in your service instance.
Перейдите на страницу автомасштабирования на портале Azure
Use the following steps to access the autoscale settings:
- Войдите на портал Azure.
- Go to the Azure Spring Apps Overview page.
- In the navigation pane, under Settings, select the Apps.
- Select the application for which you want to set up autoscale. If set up your Azure Spring Apps instance by following the directions in Quickstart: Deploy your first application to Azure Spring Apps, select the application named demo. После этого отобразится страница обзора приложения.
- In the navigation pane, under Settings, select Scale out.
Set up autoscale settings for your application in the Azure portal
Autoscale demand management provides the following options:
- Масштабирование вручную: поддерживает число фиксированных экземпляров. In the Standard plan, you can scale out to a maximum of 500 instances. Это значение изменяет количество отдельных работающих экземпляров приложения.
- Настраиваемое автомасштабирование: масштабирование по любому расписанию на основе любых метрик.
На портале Azure выберите способ масштабирования. На следующем рисунке показан параметр Пользовательское автомасштабирование и настройки режима.
Set up autoscale settings for your application in Azure CLI
You can also set autoscale modes using the Azure CLI. The following commands create an autoscale setting and an autoscale rule. Be sure to replace the <...>
placeholders with your own values.
To create an autoscale setting, use the following command:
az monitor autoscale create \ --resource-group <resource-group-name> \ --name <autoscale-setting-name> \ --resource /subscriptions/<subscription-id>/resourcegroups/<resource-group-name>/providers/Microsoft.AppPlatform/Spring/<service-instance-name>/apps/<app-name>/deployments/<deployment-name> \ --min-count 1 \ --max-count 5 \ --count 1
To create an autoscale rule, use the following command:
az monitor autoscale rule create \ --resource-group <resource-group-name> \ --autoscale-name <autoscale-setting-name> \ --scale out 1 \ --cooldown 1 \ --condition "tomcat.global.request.total.count > 100 avg 1m where AppName == <app-name> and Deployment == <deployment-name>"
Сведения о доступных метриках см. в подразделе Параметры пользовательских метрик в разделе Метрики для Azure Spring Apps.
Set up autoscale settings for blue-green deployments
Use the following steps to set up metrics-based autoscale settings for blue-green deployments:
Это важно
Create separate autoscale rules for each deployment. Set up one rule for the blue deployment, and a separate rule for the green deployment.
- In the Azure portal, navigate to the Autoscale setting page as described previously.
- Select Custom autoscale.
- Within a scale condition, select Add a rule.
- Choose values for the App dimension.
- For the Deployment dimension, set the value to either the blue or the green deployment name, not to All values.
- For the Instance dimension, set the value to All values. This ensures that the rule applies to all instances within the selected deployment.
This setup enables each deployment to scale based on its own metrics, avoiding conflicts or unexpected behavior during rollouts.
Обновление до стандартного плана
Если вы используете базовый план и ограничиваетесь одним или несколькими из этих ограничений, вы можете перейти к стандартному плану. Чтобы обновить, перейдите в меню "Тарифный план" , сначала выбрав столбец уровня "Стандартный", а затем нажмите кнопку "Обновить ".