针对 Azure Stack Hub 中的应用服务服务器角色的容量计划Capacity planning for App Service server roles in Azure Stack Hub

若要在 Azure Stack Hub 上设置 Azure 应用服务的生产就绪部署,必须计划你期望系统支持的容量。To set up a production-ready deployment of Azure App Service on Azure Stack Hub, you must plan for the capacity you expect the system to support.

本文提供了有关应当为任何生产部署使用的最少计算实例和计算 SKU 数量的指南。This article provides guidance for the minimum number of compute instances and compute SKUs you should use for any production deployment.

备注

建议用于角色的计算 SKU 的相关指南已随 Azure Stack Hub 上的 2020.Q2 版 Azure 应用服务进行更新,使标准部署与 Azure 部署保持一致。The guidance on recommended compute SKU for roles was updated with the 2020.Q2 release of Azure App Service on Azure Stack Hub to bring standard deployments in line with Azure deployments.

可以使用这些准则来计划应用服务容量策略。You can plan your App Service capacity strategy using these guidelines.

应用服务服务器角色App Service server role 建议的最少实例数Minimum recommended number of instances 建议的计算 SKURecommended compute SKU
控制器Controller 22 A4v2A4v2
前端Front End 22 A4_v2A4_v2
管理Management 22 D3_v2D3_v2
发布者Publisher 22 A2_v2A2_v2
Web 辅助角色 - 共享Web Workers - shared 22 A4_v2A4_v2
Web 辅助角色 - 专用 - 小型Web Workers - dedicated - small 每层 2 个2 per tier A1_v2A1_v2
Web 辅助角色 - 专用 - 中型Web Workers - dedicated - medium 每层 2 个2 per tier A2_v2A2_v2
Web 辅助角色 - 专用 - 大型Web Workers - dedicated - large 每层 2 个2 per tier A4_v2A4_v2

控制器角色Controller role

建议的最小值:两个 A4v2 实例Recommended minimum: Two instances of A4v2

Azure 应用服务控制器通常消耗较少的 CPU、内存和网络资源。The Azure App Service controller typically experiences low consumption of CPU, memory, and network resources. 但是,为了实现高可用性,必须具有两个控制器。However, for high availability, you must have two controllers. 两个控制器也是允许的最大控制器数。Two controllers are also the maximum number of controllers permitted. 在部署期间可以直接通过安装程序创建第二个网站控制器。You can create the second web sites controller direct from the installer during deployment.

前端角色Front-end role

建议的最小值:两个 A4v_2 实例Recommended minimum: Two instances of A4v_2

前端根据 Web 辅助角色可用性将请求路由到 Web 辅助角色。The front-end routes requests to web workers depending on web worker availability. 为实现高可用性,应配备一个以上前端,并且可以配备两个以上。For high availability, you should have more than one front end, and you can have more than two. 对于容量计划用途,请考虑每个核心每秒可以处理大约 100 个请求。For capacity planning purposes, consider that each core can handle approximately 100 requests per second.

管理角色Management role

建议的最小值:两个 D3v2 实例Recommended minimum: Two instances of D3v2

Azure 应用经典部署模型角色负责管理应用服务 Azure 资源管理器和 API 终结点、门户扩展(管理员门户、租户门户、Functions 门户)和数据服务。The Azure App classic deployment model role is responsible for the App Service Azure Resource Manager and API endpoints, portal extensions (admin, tenant, Functions portal), and the data service. 在生产环境中,管理服务器角色通常仅需要大约 4-GB RAM。The management server role typically requires only about 4-GB RAM in a production environment. 但是,当执行许多管理任务(例如创建网站)时,它可能会经历很高的 CPU 利用率水平。However, it may experience high CPU levels when many management tasks (such as web site creation) are performed. 为实现高可用性,应当将一台以上服务器分配给此角色,并且每台服务器至少两个核心。For high availability, you should have more than one server assigned to this role, and at least two cores per server.

发布服务器角色Publisher role

建议的最小值:两个 A2v2 实例Recommended minimum: Two instances of A2v2

如果许多用户同时发布,则发布服务器角色可能会经历很高的 CPU 使用率。If many users are publishing simultaneously, the publisher role may experience heavy CPU usage. 为实现高可用性,请务必提供多个发布服务器角色。For high availability, make sure more than one publisher role is available. 发布服务器仅处理 FTP/FTPS 流量。The publisher only handles FTP/FTPS traffic.

Web 辅助角色Web worker role

建议的最小值:两个 A4_v2 实例Recommended minimum: Two instances of A4_v2

为实现高可用性,应当配备至少四个 Web 辅助角色:两个用于共享网站模式,两个用于你计划提供的每个专用辅助角色层。For high availability, you should have at least four web worker roles: two for shared web site mode and two for each dedicated worker tier you plan to offer. 共享计算模式和专用计算模式向租户提供不同的服务级别。The shared and dedicated compute modes provide different levels of service to tenants. 如果你有符合下述情况的许多客户,则可能需要更多 Web 辅助角色:You might need more web workers if many of your customers are:

  • 使用专用的计算模式辅助角色层(资源密集型)。Using dedicated compute mode worker tiers (which are resource-intensive).
  • 在共享计算模式下运行。Running in shared compute mode.

在用户为专用计算模式 SKU 创建应用服务计划后,在该应用服务计划中指定的 Web 辅助角色将不再可供用户使用。After a user has created an App Service plan for a dedicated compute mode SKU, the number of web worker(s) specified in that App Service plan is no longer available to users.

若要在消耗计划模型下向用户提供 Azure Functions,则必须部署共享 Web 辅助角色。To provide Azure Functions to users in the consumption plan model, you must deploy shared web workers.

决定要使用的共享 Web 辅助角色数量时,请查看以下注意事项:When deciding on the number of shared web worker roles to use, review these considerations:

  • 内存:内存是对 Web 辅助角色最重要的资源。Memory: Memory is the most critical resource for a web worker role. 从磁盘交换虚拟内存时,内存不足会影响网站性能。Insufficient memory impacts web site performance when virtual memory is swapped from disk. 每台服务器的操作系统需要大约 1.2 GB 的 RAM。Each server requires about 1.2 GB of RAM for the operating system. 可以使用高于此阈值的 RAM 来运行网站。RAM above this threshold can be used to run web sites.

  • 活动网站的百分比:通常,在 Azure Stack Hub 部署中,Azure 应用服务中大约有 5% 的应用处于活动状态。Percentage of active web sites: Typically, about 5 percent of apps in an Azure App Service on Azure Stack Hub deployment are active. 但是,在任意给定时刻处于活动状态的应用所占百分比可能更高或更低。However, the percentage of apps that are active at any given moment can be higher or lower. 活动应用所占百分比为 5% 时,在 Azure Stack Hub 部署中,要放置在 Azure 应用服务中的最大应用数应当小于活动网站数的 20 倍 (5 x 20 = 100)。With an active app rate of 5 percent, the maximum number of apps to place in an Azure App Service on Azure Stack Hub deployment should be less than 20 times the number of active web sites (5 x 20 = 100).

  • 平均内存占用:在生产环境中观察到的应用平均内存占用大约为 70 MB。Average memory footprint: The average memory footprint for apps observed in production environments is about 70 MB. 使用此占用,按以下方式计算在所有 Web 辅助角色的计算机或 VM 中分配的内存:Using this footprint, the memory allocated across all web worker role computers or VMs is calculated as follows:

    Number of provisioned applications * 70 MB * 5% - (number of web worker roles * 1044 MB)

    例如,如果在运行 10 个 Web 辅助角色的环境中有 5,000 个应用,则每个 Web 辅助角色 VM 应当具有 7060 MB RAM:For example, if there are 5,000 apps on an environment running 10 web worker roles, each web worker role VM should have 7060-MB RAM:

    5,000 * 70 * 0.05 - (10 * 1044) = 7060 (= about 7 GB)

    有关添加更多辅助角色实例的信息,请参阅添加更多辅助角色For info on adding more worker instances, see Adding more worker roles.

专用辅助角色在升级和维护期间的其他注意事项Additional considerations for dedicated workers during upgrade and maintenance

在升级和维护辅助角色期间,Azure Stack Hub 上的 Azure 应用服务一次针对每个辅助角色层的 20% 的资源执行维护。During upgrade and maintenance of workers, Azure App Service on Azure Stack Hub will perform maintenance on 20% of each worker tier at any one time. 因此,云管理员始终必须为每个辅助角色层保持 20% 的未分配辅助角色池,以确保其租户不会在升级和维护期间遇到服务中断的情况。Therefore, cloud admins must always maintain a 20% pool of unallocated workers per worker tier to ensure their tenants don't experience any loss of service during upgrade and maintenance. 例如,如果辅助角色层包含 10 个辅助角色,则应确保其中有 2 个辅助角色尚未分配,以便进行升级和维护。For example, if you have 10 workers in a worker tier you should ensure that 2 are unallocated to allow upgrade and maintenance. 如果 10 个辅助角色全都分配出去,则应扩展辅助角色层,以维护包含未分配辅助角色的池。If the full 10 workers become allocated, you should scale the worker tier up to maintain a pool of unallocated workers.

在升级和维护期间,Azure 应用服务会将工作负荷转移到未分配的辅助角色,确保工作负荷继续正常运行。During upgrade and maintenance, Azure App Service will move workloads to unallocated workers to ensure the workloads will continue to operate. 但是,如果升级期间没有可用的未分配辅助角色,则租户工作负荷可能会停机。However, if there are no unallocated workers available during upgrade then there's potential for tenant workload downtime. 对于共享的辅助角色,客户无需预配额外的辅助角色,因为服务会自动在可用辅助角色内分配租户应用。With regards to shared workers, customers don't need to provision additional workers as the service will allocate tenant apps within available workers automatically. 若要确保高可用性,此层中至少要有两个辅助角色。For high availability, there's a minimum requirement of two workers in this tier.

云管理员可以在 Azure Stack Hub 管理员门户的“应用服务管理”区域中监视其辅助角色层分配。Cloud admins can monitor their worker tier allocation in the App Service admin area in the Azure Stack Hub administrator portal. 导航到“应用服务”,然后在左窗格中选择“辅助角色层”。Navigate to App Service and then select Worker Tiers in the left-hand pane. “辅助角色层”表会显示辅助角色层的名称、大小、使用的映像、可用辅助角色数目(未分配)、每层中的辅助角色总数,以及辅助角色层的整体状态。The Worker Tiers table shows worker tier name, size, image used, number of available workers (unallocated), total number of workers in each tier and the overall state of the worker tier.

应用服务管理 - 辅助角色层

文件服务器角色File server role

对于文件服务器角色,可以使用独立的文件服务器进行开发和测试。For the file server role, you can use a standalone file server for development and testing. 例如,当在 Azure Stack 开发工具包 (ASDK) 上部署 Azure 应用服务时,可以使用此模板For example, when deploying Azure App Service on the Azure Stack Development Kit (ASDK) you can use this template. 对于生产用途,应当使用预先配置的 Windows 文件服务器,或使用预先配置的非 Windows 文件服务器。For production purposes, you should use a pre-configured Windows file server, or a pre-configured non-Windows file server.

在生产环境中,文件服务器角色会经历密集的磁盘 I/O。In production environments, the file server role experiences intensive disk I/O. 因为它容纳着用户网站的所有内容和应用文件,因此应当为此角色预先配置以下资源之一:Because it houses all of the content and app files for user web sites, you should preconfigure one of the following resources for this role:

  • Windows 文件服务器Windows file server
  • Windows 文件服务器群集Windows file server cluster
  • 非 Windows 文件服务器Non-Windows file server
  • 非 Windows 文件服务器群集Non-Windows file server cluster
  • NAS(网络附加存储)设备NAS (Network Attached Storage) device

有关详细信息,请参阅预配文件服务器For more information, see Provision a file server.

后续步骤Next steps

在 Azure Stack Hub 上部署应用服务的先决条件Prerequisites for deploying App Service on Azure Stack Hub