Azure 应用服务计划概述Azure App Service plan overview

在应用服务中,应用在应用服务计划中运行。In App Service, an app runs in an App Service plan. 应用服务计划为要运行的 Web 应用定义一组计算资源。An App Service plan defines a set of compute resources for a web app to run. 这些计算资源类似于传统 Web 托管方案中的服务器场These compute resources are analogous to the server farm in conventional web hosting. 可将一个或多个应用配置为在相同的计算资源中(或相同的应用服务计划中)运行。One or more apps can be configured to run on the same computing resources (or in the same App Service plan).

在特定的区域(例如“中国东部”)中创建应用服务计划时,将为该区域中的该计划创建一组计算资源。When you create an App Service plan in a certain region (for example, China East), a set of compute resources is created for that plan in that region. 放入此应用服务计划的任何应用都在应用服务计划定义的这些计算资源中运行。Whatever apps you put into this App Service plan run on these compute resources as defined by your App Service plan. 每个应用服务计划定义:Each App Service plan defines:

  • 区域(中国东部、中国北部)Region (China East, China North)
  • VM 实例数Number of VM instances
  • VM 实例大小(“小型”、“中型”、“大型”)Size of VM instances (Small, Medium, Large)
  • 定价层(免费、共享、基本、标准、高级)Pricing tier (Free, Shared, Basic, Standard, Premium)

应用服务计划的定价层确定了所提供的应用服务功能和计划费用。The pricing tier of an App Service plan determines what App Service features you get and how much you pay for the plan. 定价层有以下几个类别:There are a few categories of pricing tiers:

  • 共享计算:“免费”和“共享”,这两个基本层在其他应用服务应用(包括其他客户的应用)所在的同一个 Azure VM 上运行应用。Shared compute: Free and Shared, the two base tiers, runs an app on the same Azure VM as other App Service apps, including apps of other customers. 这些层为共享资源中运行的每个应用分配 CPU 配额,且资源不可横向扩展。These tiers allocate CPU quotas to each app that runs on the shared resources, and the resources cannot scale out.
  • 专用计算:“基本”、“标准”、“高级”层在专用的 Azure VM 上运行应用。Dedicated compute: The Basic, Standard, Premium tiers run apps on dedicated Azure VMs. 只有同一应用服务计划中的应用可以共享相同的计算资源。Only apps in the same App Service plan share the same compute resources. 层越高,可用于横向扩展的 VM 实例就越多。The higher the tier, the more VM instances are available to you for scale-out.

Note

应用服务免费和共享(预览)托管计划是基本层,与其他应用服务应用在相同的 Azure VM 上运行。App Service Free and Shared (preview) hosting plans are base tiers that run on the same Azure VM as other App Service apps. 某些应用可能属于其他客户。Some apps may belong to other customers. 这些层仅旨在用于开发和测试目的。These tiers are intended to be used only for development and testing purposes.

每个层还提供应用服务功能的特定子集。Each tier also provides a specific subset of App Service features. 这些功能包括自定义域和 SSL 证书、自动缩放、部署槽位、备份、流量管理器集成,等等。These features include custom domains and SSL certificates, autoscaling, deployment slots, backups, Traffic Manager integration, and more. 层越高,可用的功能越多。The higher the tier, the more features are available. 若要了解每个定价层支持的功能,请参阅应用服务计划详细信息To find out which features are supported in each pricing tier, see App Service plan details.

应用如何运行和缩放?How does my app run and scale?

在“免费”和“共享”层中,应用遵循共享 VM 实例上的 CPU 分钟配额,且不能横向扩展。在其他层中,应用按如下所述运行和缩放。In the Free and Shared tiers, an app receives CPU minutes on a shared VM instance and cannot scale out. In other tiers, an app runs and scales as follows.

在应用服务中创建某个应用时,该应用将被放入应用服务计划。When you create an app in App Service, it is put into an App Service plan. 该应用运行时,将在应用服务计划中配置的所有 VM 实例上运行。When the app runs, it runs on all the VM instances configured in the App Service plan. 如果同一应用服务计划中包含多个应用,这些应用将共享相同的 VM 实例。If multiple apps are in the same App Service plan, they all share the same VM instances. 如果对某个应用使用多个部署槽位,所有部署槽位也在相同的 VM 实例上运行。If you have multiple deployment slots for an app, all deployment slots also run on the same VM instances. 如果启用诊断日志、执行备份或运行 Web 作业,它们也使用这些 VM 实例上的 CPU 周期和内存。If you enable diagnostic logs, perform backups, or run WebJobs, they also use CPU cycles and memory on these VM instances.

于是,应用服务计划便成了应用服务应用的缩放单元。In this way, the App Service plan is the scale unit of the App Service apps. 如果将计划配置为运行五个 VM 实例,该计划中的所有应用将在所有五个实例上运行。If the plan is configured to run five VM instances, then all apps in the plan run on all five instances. 如果为计划配置了自动缩放,该计划中的所有应用将会根据自动缩放设置一起横向扩展。If the plan is configured for autoscaling, then all apps in the plan are scaled out together based on the autoscale settings.

有关横向扩展应用的信息,请参阅手动或自动缩放实例计数For information on scaling out an app, see Scale instance count manually or automatically.

应用服务计划的费用是多少?How much does my App Service plan cost?

本部分介绍应用服务应用的计费方式。This section describes how App Service apps are billed. 有关区域特定的详细定价信息,请参阅应用服务定价For detailed, region-specific pricing information, see App Service Pricing.

除“免费”层外,应用服务计划会根据所用的计算资源量产生小时费用。Except for Free tier, an App Service plan carries an hourly charge on the compute resources it uses.

  • 在“共享”层中,每个应用遵循 CPU 分钟配额,因此,每个应用会根据 CPU 配额产生小时费用。In the Shared tier, each app receives a quota of CPU minutes, so each app is charged hourly for the CPU quota.

  • 在专用计算层(“基本”、“标准”、“高级”)中,应用服务计划定义了应用可缩放到的 VM 实例数,因此,应用服务计划中的每个 VM 实例会产生小时费用。In the dedicated compute tiers (Basic, Standard, Premium), The App Service plan defines the number of VM instances the apps are scaled to, so each VM instance in the App Service plan has an hourly charge. 不管这些 VM 实例上运行了多少个应用,其计费方式都是相同的。These VM instances are charged the same regardless how many apps are running on them. 为了避免意外的费用,请参阅清理应用服务计划To avoid unexpected charges, see Clean up an App Service plan. 使用随附的应用服务功能(配置自定义域、SSL 证书、部署槽位、备份等)不会产生费用。You don't get charged for using the App Service features that are available to you (configuring custom domains, SSL certificates, deployment slots, backups, etc.). 例外情况包括:The exceptions are:

  • 应用服务域 - 在 Azure 中购买以及每年续订时付费。App Service Domains - you pay when you purchase one in Azure and when you renew it each year.

  • 应用服务证书 - 在 Azure 中购买以及每年续订时付费。App Service Certificates - you pay when you purchase one in Azure and when you renew it each year.

  • 基于 IP 的 SSL 连接 - 每个基于 IP 的 SSL 连接会产生小时费用,但“标准”或更高类别的某些层免费提供了一个基于 IP 的 SSL 连接。IP-based SSL connections - There's an hourly charge for each IP-based SSL connection, but some Standard tier or above gives you one IP-based SSL connection for free. 基于 SNI 的 SSL 连接免费。SNI-based SSL connections are free.

Note

如果将应用服务与其他 Azure 服务集成,可能需要考虑这些服务的费用。If you integrate App Service with another Azure service, you may need to consider charges from these other services. 例如,如果使用 Azure 流量管理器在特定的地理位置缩放应用,则 Azure 流量管理器也会根据用量收取费用。For example, if you use Azure Traffic Manager to scale your app geographically, Azure Traffic Manager also charges you based on your usage. 若要估算 Azure 中的跨服务费用,请参阅定价计算器To estimate your cross-services cost in Azure, see Pricing calculator.

如果应用需要更多的功能怎么办?What if my app needs more capabilities or features?

随时可以提高和降低应用服务计划。Your App Service plan can be scaled up and down at any time. 只需更改计划的定价层即可。It is as simple as changing the pricing tier of the plan. 一开始可以选择一个较低的定价层,以后需要更多的应用服务功能时,可以提高层。You can choose a lower pricing tier at first and scale up later when you need more App Service features.

例如,可以在“免费”应用服务计划中开始免费测试 Web 应用。For example, you can start testing your web app in a Free App Service plan and pay nothing. 想要将自定义 DNS 名称添加到 Web 应用时,只需将计划提高到“共享”层。When you want to add your custom DNS name to the web app, just scale your plan up to Shared tier. 以后想要添加自定义 SSL 证书时,可将计划提高到“基本”层。Later, when you want to add a custom SSL certificate, scale your plan up to Basic tier. 想要部署过渡环境时,可提高到“标准”层。When you want to have staging environments, scale up to Standard tier. 需要更多的核心、内存或存储时,可提高到同一层中的更大 VM 大小。When you need more cores, memory, or storage, scale up to a bigger VM size in the same tier.

反之亦然。The same works in the reverse. 如果觉得自己不再需要较高层的功能,可以降低到更低的层,从而节省资金。When you feel you no longer need the capabilities or features of a higher tier, you can scale down to a lower tier, which saves you money.

有关提高应用服务计划的信息,请参阅纵向扩展 Azure 中的应用For information on scaling up the App Service plan, see Scale up an app in Azure.

如果你的应用与其他应用在同一个应用服务计划中,可以通过隔离计算资源来提高你的应用的性能。If your app is in the same App Service plan with other apps, you may want to improve the app's performance by isolating the compute resources. 为此,可将应用移到单独的应用服务计划中。You can do it by moving the app into a separate App Service plan. 有关详细信息,请参阅将应用移到另一个应用服务计划For more information, see Move an app to another App Service plan.

应该将应用放入新计划还是现有计划中?Should I put an app in a new plan or an existing plan?

由于应用服务计划分配的计算资源会产生费用(请参阅应用服务计划的费用是多少?),将多个应用放入一个应用服务计划可能会节省资金。Since you pay for the computing resources your App Service plan allocates (see How much does my App Service plan cost?), you can potentially save money by putting multiple apps into one App Service plan. 只要现有的计划能够提供足够的资源来处理负载,就可以持续将应用添加到该计划。You can continue to add apps to an existing plan as long as the plan has enough resources to handle the load. 但请记住,同一应用服务计划中的所有应用共享相同的计算资源。However, keep in mind that apps in the same App Service plan all share the same compute resources. 若要确定新的应用是否能够获得所需的资源,需要了解现有应用服务计划的容量,以及新应用预期的负载。To determine whether the new app has the necessary resources, you need to understand the capacity of the existing App Service plan, and the expected load for the new app. 应用服务计划过载可能会导致新应用和现有应用停机。Overloading an App Service plan can potentially cause downtime for your new and existing apps.

在以下情况下,请将应用隔离到新应用服务计划中:Isolate your app into a new App Service plan when:

  • 该应用占用大量资源。The app is resource-intensive.
  • 想要独立于现有计划中的其他应用缩放该应用。You want to scale the app independently from the other apps the existing plan.
  • 该应用需要其他地理区域中的资源。The app needs resource in a different geographical region.

这样一来,可以为应用分配新的资源集,并更好地控制应用。This way you can allocate a new set of resources for your app and gain greater control of your apps.

管理应用服务计划Manage an App Service plan