Lesson 4 of 6 Compute Solutions

Designing Web Hosting with Azure App Service

This lesson explains App Service plans, tiers and deployment slots from a design perspective.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain how plans share compute.
  • Choose a minimum tier for a capability.
  • Explain when an App Service Environment is justified.

What App Service provides

Azure App Service hosts web applications, REST APIs and mobile back ends, without the management of servers. It supports several languages on Windows and Linux, and it also runs containers. Built-in features include autoscale, TLS certificates, deployment slots, authentication and backups.

An application runs in an App Service plan, which defines the region, the number of instances and the size of machines. All apps in a plan share its compute, so they should be combined only if they have similar demand. Separating a busy application into its own plan prevents it from starving others.

Tiers

The plan's tier sets the available features, and scenarios frequently turn on the minimum tier that provides a capability.

Tier groupPlansDesign use
Shared computeFree, SharedDevelopment and experiments only
Dedicated computeBasicLow-traffic production without autoscale
Dedicated compute with scalingStandard, Premium v2, v3 and v4Production with autoscale and deployment slots
IsolatedIsolated v2App Service Environment, single-tenant isolation

Standard and above support autoscale and deployment slots, and Standard allows five slots. Premium v3 and v4 add larger instances and support zone redundancy. App Service also offers virtual network integration for outbound access and private endpoints for inbound access, which keep traffic off the public internet without requiring an isolated tier.

The following diagram shows the traffic path of a web application on an App Service plan and the plan features it uses.

A Premium v3 App Service plan for the university application. Access restrictions admit only the campus network, virtual network integration reaches the database's private endpoint, and autoscale, deployment slots and zone redundancy cover enrolment peaks, zero-downtime releases and a datacenter failure.
The scenario is illustrative.
Sort into groups

Minimum App Service tier

Exam skills 4.1.1

Identify the minimum App Service tier group for each requirement.

Log in to try this activity Interactive activities are free with an account.

App Service Environment

An App Service Environment (ASE) is a fully isolated deployment of App Service in a customer's virtual network, on single-tenant compute. Version 3 is the current version. It suits very high-scale workloads, or compliance requirements for single-tenant hosting. It is costlier than a multi-tenant plan, so it should not be selected merely to obtain private networking, which is available through private endpoints and virtual network integration.

Deployment slots

A deployment slot is a live application with its own hostname. A new version is deployed to a staging slot, warmed up and tested, and then swapped with production, which involves no downtime. If the release fails, a further swap restores the previous version. Slots can also route a percentage of traffic to a new version, for testing in production. Some settings can be marked as slot-specific, so that a staging connection string does not follow the code into production.

Put in order

A release with slots

Exam skills 4.1.1

Arrange a zero-downtime release using deployment slots.

Log in to try this activity Interactive activities are free with an account.

Scaling

App Service scales in two directions. Scaling up moves a plan to a larger tier or size, which adds CPU, memory and features. Scaling out adds instances, which all run every app in the plan. Rules-based autoscale adjusts the instance count according to metrics or a schedule, and automatic scaling on Premium plans lets the platform decide, based on HTTP traffic, with a minimum number of always ready instances. A schedule suits known peaks, such as a morning rush, whereas metric rules suit unpredictable demand.

Instances should be treated as disposable. Session state belongs in a shared cache, and uploaded files belong in Blob Storage, because a file saved to one instance's local disk is unavailable to the others. Session affinity, known as ARR affinity, can route a user back to one instance, but it reduces the benefit of scaling out, and it should be disabled for stateless applications.

Networking

App Service treats inbound and outbound traffic separately, and scenarios often test this. Inbound traffic reaches a public endpoint by default. Access restrictions can limit which addresses or subnets may connect, and a private endpoint gives the app a private address, after which public access can be disabled. Outbound traffic uses shared addresses by default. Virtual network integration sends it into a virtual network, so that the app can reach private endpoints and on-premises systems, and a NAT gateway on the integration subnet provides a static outbound address.

The two features are independent, and a common mistake is to assume that one provides the other. Virtual network integration does not make an app private, and a private endpoint does not allow an app to reach a private database. A fully private design needs both, as the following table recaps.

RequirementFeatureDirection
Allow only certain addresses to reach the appAccess restrictionsInbound
Give the app a private addressPrivate endpointInbound
Reach a private databaseVirtual network integrationOutbound
Use a static outbound addressNAT gateway on the integration subnetOutbound
Sort into groups

Inbound or outbound?

Exam skills 4.1.1

Decide which direction each App Service networking feature controls.

Log in to try this activity Interactive activities are free with an account.

Cost and sizing decisions

Several apps can share a plan, which is economical for small, related sites. A busy or business-critical application should have its own plan, so that it can scale independently and cannot be starved. Development and test apps should sit in separate, smaller plans, and they can be stopped outside working hours. Reserved instances on Premium v3 reduce cost for steady production use, and the Free and Shared tiers should never carry production traffic, because they share compute and lack an SLA.

Worked example

Choosing a hosting configuration

A university hosts a web application on App Service with a heavy load during enrolment periods. Releases must not cause downtime. The application must remain available if a datacenter fails. It must connect to a database through a private endpoint, and inbound access must be restricted to the campus network. There is no requirement for single-tenant hosting. What should you recommend?

A Premium v3 plan satisfies the requirements: autoscale handles enrolment peaks, deployment slots allow zero-downtime releases, and zone redundancy handles a datacenter failure. Virtual network integration reaches the database's private endpoint, and access restrictions or a private endpoint limit inbound traffic.

An App Service Environment would also meet these requirements, but single-tenant isolation is not needed, so its higher cost is not justified. Basic has no autoscale or slots, and hosting on virtual machines would add management work.

Check yourself

Why not place a busy application in the same plan as ten small ones?

Show answer

All apps in a plan share compute, so the busy application can starve the others.

Exam Tips

Remember for the exam

  • All apps in a plan share compute; separate busy applications.
  • Standard and above have autoscale and deployment slots.
  • App Service Environment v3 is for single-tenant isolation, not merely private networking.
  • Slot swaps give zero-downtime releases and fast rollback.