在 Azure Spring Cloud 中缩放应用程序Scale an application in Azure Spring Cloud

本文档演示如何在 Azure 门户中使用 Azure Spring Cloud 仪表板缩放任何微服务应用程序。This documentation demonstrates how to scale any microservice application using the Azure Spring Cloud dashboard in the Azure portal.

上下缩放应用程序,方法是:修改其虚拟 CPU (vCPU) 数目和内存容量。Scale your application up and down by modifying its number of virtual CPUs (vCPUs) and amount of memory. 水平缩放应用程序,方法是:修改应用程序实例的数目。Scale your application in and out by modifying the number of application instances.

完成后,你会了解如何对服务中的每个应用程序进行快速的手动更改。After you finish, you'll know how to make quick manual changes to each application in your service. 缩放在数秒内生效,不需任何代码更改或重新部署。Scaling takes effect in seconds and doesn't require any code changes or redeployment.

先决条件Prerequisites

若要遵循这些过程进行操作,需要:To follow these procedures, you need:

  1. 登录 Azure 门户Sign in to the Azure portal.

  2. 转到 Azure Spring Cloud 的“概览”页。Go to your Azure Spring Cloud Overview page.

  3. 选择包含服务的资源组。Select the resource group that contains your service.

  4. 在页面左侧菜单中的“设置”下选择“应用”选项卡。 Select the Apps tab under Settings in the menu on the left side of the page.

  5. 选择要缩放的应用程序。Select the application you want to scale. 在此示例中,选择名为 account-service 的应用程序。In this example, select the application named account-service. 然后会看到应用程序的“概览”页。You should then see the application's Overview page.

  6. 转到页面左侧菜单中的“设置”下的“缩放”选项卡。 Go to the Scale tab under Settings in the menu on the left side of the page. 你应会看到以下部分中所示的缩放属性的选项。You should see options for the scaling the attributes shown in the following section.

缩放应用程序Scale your application

如果修改缩放属性,请记住以下注意事项:If you modify the scaling attributes, keep the following notes in mind:

  • CPU:每个应用程序实例的最大 CPU 数是 4。CPUs: The maximum number of CPUs per application instance is four. 一个应用程序的总 CPU 数是此处设置的值乘以应用程序实例数。The total number of CPUs for an application is the value set here multiplied by the number of application instances.

  • 内存/GB:每个应用程序实例的最大内存容量是 8 GB。Memory/GB: The maximum amount of memory per application instance is 8 GB. 一个应用程序的总内存量是此处设置的值乘以应用程序实例数。The total amount of memory for an application is the value set here multiplied by the number of application instances.

  • 应用实例计数:在“标准”层中,最多可横向扩展到 20 个实例。App instance count: In the Standard tier, you can scale out to a maximum of 20 instances. 此值更改微服务应用程序的单独运行实例的数目。This value changes the number of separate running instances of the microservice application.

确保选择“保存”,以应用缩放设置。Be sure to select Save to apply your scaling settings.

Azure 门户中的缩放服务

数秒钟后,所做的更改会显示在“概览”页上,更多详细信息在“应用程序实例”选项卡中提供。 缩放不需任何代码更改或重新部署。After a few seconds, the changes you made are displayed on the Overview page, with more details available in the Application instances tab. Scaling doesn't require any code changes or redeployment.

升级到标准层Upgrade to the Standard tier

如果在使用基本层,且受其中一项或多项限制约束,则可升级到标准层。If you are on the Basic tier and constrained by one or more of these limits, you can upgrade to the Standard tier. 若要执行此操作,请先选择“标准层”列,然后单击“升级”按钮,转到“定价层”菜单。To do this go to the Pricing tier menu by first selecting the Standard tier column and the clicking the Upgrade button.

后续步骤Next steps

本示例介绍了如何手动缩放 Azure Spring Cloud 应用程序。This example explained how to manually scale an Azure Spring Cloud application. 若要了解如何通过设置警报来监视应用程序,请参阅设置自动缩放To learn how to monitor an application by setting up alerts, see Set-up autoscale.