什么是虚拟机规模集?What are virtual machine scale sets?

使用 Azure 虚拟机规模集可以创建并管理一组负载均衡的 VM。Azure virtual machine scale sets let you create and manage a group of load balanced VMs. 可以根据需求或定义的计划自动增减 VM 实例的数目。The number of VM instances can automatically increase or decrease in response to demand or a defined schedule. 规模集为应用程序提供高可用性,用于集中管理、配置和更新大量 VM。Scale sets provide high availability to your applications, and allow you to centrally manage, configure, and update a large number of VMs. 可以使用虚拟机规模集为计算、大数据和容器工作负荷等领域构建大规模的服务。With virtual machine scale sets, you can build large-scale services for areas such as compute, big data, and container workloads.

为何使用虚拟机规模集?Why use virtual machine scale sets?

为了提供冗余性并改进性能,通常会跨多个实例来分发应用程序。To provide redundancy and improved performance, applications are typically distributed across multiple instances. 客户可能会通过负载均衡器来访问应用程序,由负载均衡器负责将请求分发到某个应用程序实例。Customers may access your application through a load balancer that distributes requests to one of the application instances. 如果你需要进行维护或更新某个应用程序实例,则必须将客户分发到其他可用的应用程序实例。If you need to perform maintenance or update an application instance, your customers must be distributed to another available application instance. 为了满足客户的额外需求,可能需要增加运行应用程序的应用程序实例的数量。To keep up with additional customer demand, you may need to increase the number of application instances that run your application.

Azure 虚拟机规模集为跨多个 VM 运行的应用程序提供管理功能,可以自动缩放资源,还可以对流量进行负载均衡。Azure virtual machine scale sets provide the management capabilities for applications that run across many VMs, automatic scaling of resources, and load balancing of traffic. 规模集具有下述主要优势:Scale sets provide the following key benefits:

  • 易于创建和管理多个 VMEasy to create and manage multiple VMs

    • 有多个运行应用程序的 VM 时,必须在整个环境中维持一致的配置。When you have many VMs that run your application, it's important to maintain a consistent configuration across your environment. 为了确保应用程序性能可靠,所有 VM 的 VM 大小、磁盘配置和应用程序安装都应匹配。For reliable performance of your application, the VM size, disk configuration, and application installs should match across all VMs.
    • 使用规模集时,所有 VM 实例都是根据相同的基础 OS 映像和配置来创建的。With scale sets, all VM instances are created from the same base OS image and configuration. 使用这种方法可以轻松地管理数百个 VM,不需执行其他的配置任务或网络管理。This approach lets you easily manage hundreds of VMs without additional configuration tasks or network management.
    • 规模集支持使用 Azure 负载均衡器进行基本的第 4 层流量分发操作,以及使用 Azure 应用程序网关进行更高级的第 7 层流量分发和 TLS 终止操作。Scale sets support the use of the Azure load balancer for basic layer-4 traffic distribution, and Azure Application Gateway for more advanced layer-7 traffic distribution and TLS termination.
  • 提供高可用性和应用程序复原能力Provides high availability and application resiliency

    • 规模集用于运行应用程序的多个实例。Scale sets are used to run multiple instances of your application. 如果某个 VM 实例出现问题,客户可以继续通过其他 VM 实例来访问应用程序,将中断的可能性降至最低。If one of these VM instances has a problem, customers continue to access your application through one of the other VM instances with minimal interruption.
  • 允许应用程序随资源需求变化自动进行缩放Allows your application to automatically scale as resource demand changes

    • 客户对应用程序的需求可能会在一天或一周内变化。Customer demand for your application may change throughout the day or week. 规模集可以遵循客户需求,在应用程序需求增加时自动增加 VM 实例数,在需求减少时减少 VM 实例数。To match customer demand, scale sets can automatically increase the number of VM instances as application demand increases, then reduce the number of VM instances as demand decreases.
    • 另外,自动缩放还可以尽量降低在需求较低时运行应用程序的不必要的 VM 实例数,并可让客户在需求增加时继续享受可以接受的性能级别,而且会自动添加更多的 VM 实例。Autoscale also minimizes the number of unnecessary VM instances that run your application when demand is low, while customers continue to receive an acceptable level of performance as demand grows and additional VM instances are automatically added. 此功能有助于降低成本,并根据需要高效地创建 Azure 资源。This ability helps reduce costs and efficiently create Azure resources as required.
  • 大规模工作Works at large-scale

    • 规模集最多支持 1,000 个 VM 实例。Scale sets support up to 1,000 VM instances. 如果创建和上传自己的自定义 VM 映像,则该限制为 600 个 VM 实例。If you create and upload your own custom VM images, the limit is 600 VM instances.
    • 若要尽量提高生产工作负荷的性能,请使用 Azure 托管磁盘For the best performance with production workloads, use Azure Managed Disks.

虚拟机和规模集的差异Differences between virtual machines and scale sets

规模集是使用虚拟机构建的。Scale sets are built from virtual machines. 使用规模集时,会提供管理层和自动层来运行和缩放应用程序。With scale sets, the management and automation layers are provided to run and scale your applications. 可以改用手动方式来创建和管理单个 VM,也可以集成现有的工具,以便构建类似级别的自动化。You could instead manually create and manage individual VMs, or integrate existing tools to build a similar level of automation. 下表概述了规模集的优势(与手动管理多个 VM 实例相比)。The following table outlines the benefits of scale sets compared to manually managing multiple VM instances.

方案Scenario VM 的手动组Manual group of VMs 虚拟机规模集Virtual machine scale set
添加额外的 VM 实例Add additional VM instances 用于创建、配置和确保符合性的手动过程Manual process to create, configure, and ensure compliance 自动根据中心配置进行创建Automatically create from central configuration
流量均衡和分发Traffic balancing and distribution 用于创建和配置 Azure 负载均衡器或应用程序网关的手动过程Manual process to create and configure Azure load balancer or Application Gateway 可以自动创建 Azure 负载均衡器或应用程序网关以及与之集成Can automatically create and integrate with Azure load balancer or Application Gateway
高可用性和冗余性High availability and redundancy 手动创建可用性集,或者跨可用性区域分发和跟踪 VMManually create Availability Set or distribute and track VMs across Availability Zones 跨可用性区域或可用性集自动分发 VM 实例Automatic distribution of VM instances across Availability Zones or Availability Sets
VM 缩放Scaling of VMs 手动监视和 Azure 自动化Manual monitoring and Azure Automation 根据主机指标、来宾中指标、Application Insights 或计划自动缩放Autoscale based on host metrics, in-guest metrics, Application Insights, or schedule

规模集不需额外付费。There is no additional cost to scale sets. 只需为基础的计算资源(例如 VM 实例、负载均衡器或托管磁盘存储)付费。You only pay for the underlying compute resources such as the VM instances, load balancer, or Managed Disk storage. 在使用 VM 的过程中,管理和自动化功能(例如自动缩放和冗余性)不需额外付费。The management and automation features, such as autoscale and redundancy, incur no additional charges over the use of VMs.

如何监视规模集How to monitor your scale sets

使用 Application Insights 启用对虚拟机规模集应用程序的监视,以收集有关应用程序的详细信息,包括页面视图、应用程序请求和异常。Enable monitoring for your virtual machine scale set application with Application Insights to collect detailed information about your application including page views, application requests, and exceptions. 通过配置可用性测试来模拟用户流量,进一步验证应用程序的可用性。Further verify the availability of your application by configuring an availability test to simulate user traffic.

后续步骤Next steps

若要开始,请在 Azure 门户中创建第一个虚拟机规模集。To get started, create your first virtual machine scale set in the Azure portal.