|
| 1 | +# Scale an App Service web app to efficiently meet demand with App Service scale up and scale out |
| 2 | + |
| 3 | +## App Service plans and scalability |
| 4 | + |
| 5 | +A web app that runs in Azure typically uses Azure App Service to provide the hosting environment. App Service can arrange for multiple instances of the web app to run. It load balances incoming requests across these instances. Each instance runs on a virtual machine. |
| 6 | + |
| 7 | +An App Service plan defines the resources available to each instance. The App Service plan specifies the operating system (Windows or Linux), the hardware (memory, CPU processing capacity, disk storage, and so on), and the availability of services like automatic backup and restore. |
| 8 | + |
| 9 | +- The Free tier provides 1 GB of disk space and support for up to 10 apps, but only a single shared instance and no SLA for availability. Each app has a compute quota of 60 minutes per day. The Free service plan is suitable for app development and testing rather than production deployments. |
| 10 | +- The Shared tier provides support for more apps (up to 100) also running on a single shared instance. Apps have a compute quota of 240 minutes per day. There's no availability SLA. |
| 11 | +- The Basic tier supports an unlimited number of apps and provides more disk space. Apps can be scaled out to three dedicated instances. This tier provides an SLA of 99.95% availability. There are three levels in this tier that offer varying amounts of computing power, memory, and disk storage. |
| 12 | +- The Standard tier also supports an unlimited number of apps. This tier can scale to 10 dedicated instances and has an availability SLA of 99.95%. Like - the Basic tier, this tier has three levels that offer an increasingly powerful set of computing, memory, and disk options. |
| 13 | +- The Premium tier gives you up to 20 dedicated instances, an availability SLA of 99.95%, and multiple levels of hardware. |
| 14 | +- The Isolated tier runs in a dedicated Azure virtual network, which gives you a network and computes isolation. This tier can scale out to 100 instances and has an availability SLA of 99.95%. |
| 15 | + |
| 16 | +## Create an App Service plan and web app |
| 17 | + |
| 18 | +1. Sign in to the Azure portal. |
| 19 | + |
| 20 | +2. On the Azure portal menu or from the Home page, select Create a resource. The Create a resource pane appears. |
| 21 | + |
| 22 | +3. In the left menu pane, under Categories, select Web, search for and select Web App, and then select Create. The Create Web App pane appears. |
| 23 | + |
| 24 | +4. On the Basics tab, enter the following values for each setting. |
| 25 | + |
| 26 | +## Build and deploy the web app |
| 27 | + |
| 28 | +``` |
| 29 | +git clone https://github.com/MicrosoftDocs/mslearn-hotel-reservation-system.git |
| 30 | +``` |
| 31 | + |
| 32 | +``` |
| 33 | +cd mslearn-hotel-reservation-system/src |
| 34 | +``` |
| 35 | + |
| 36 | +``` |
| 37 | +dotnet build |
| 38 | +``` |
| 39 | + |
| 40 | +``` |
| 41 | +cd HotelReservationSystem |
| 42 | +dotnet publish -o website |
| 43 | +``` |
| 44 | + |
| 45 | +``` |
| 46 | +cd website |
| 47 | +zip website.zip * |
| 48 | +az webapp deployment source config-zip --src website.zip --name <your-webapp-name> --resource-group mslearn-scale |
| 49 | +``` |
| 50 | + |
| 51 | +``` |
| 52 | +cd ~/mslearn-hotel-reservation-system/src/HotelReservationSystemTestClient |
| 53 | +``` |
| 54 | + |
| 55 | +``` |
| 56 | +code App.config |
| 57 | +``` |
| 58 | + |
| 59 | +``` |
| 60 | +<?xml version="1.0" encoding="utf-8" ?> |
| 61 | +<configuration> |
| 62 | + <appSettings> |
| 63 | + <add key="NumClients" value="100" /> |
| 64 | + <add key="ReservationsServiceURI" value="https://<your-webapp-name>.azurewebsites.net/" /> |
| 65 | + <add key="ReservationsServiceCollection" value="api/reservations" /> |
| 66 | + </appSettings> |
| 67 | +</configuration> |
| 68 | +``` |
| 69 | + |
| 70 | +``` |
| 71 | +code HotelReservationSystemTestClient.csproj |
| 72 | +``` |
| 73 | + |
| 74 | +``` |
| 75 | +<Project Sdk="Microsoft.NET.Sdk"> |
| 76 | +
|
| 77 | + <PropertyGroup> |
| 78 | + <OutputType>Exe</OutputType> |
| 79 | + <TargetFramework>netcoreapp7.0</TargetFramework> |
| 80 | + </PropertyGroup> |
| 81 | +
|
| 82 | + <ItemGroup> |
| 83 | + <PackageReference Include="Newtonsoft.Json" Version="12.0.1" /> |
| 84 | + <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" /> |
| 85 | + </ItemGroup> |
| 86 | +
|
| 87 | + <ItemGroup> |
| 88 | + <ProjectReference Include="..\HotelReservationSystemTypes\HotelReservationSystemTypes.csproj" /> |
| 89 | + </ItemGroup> |
| 90 | +
|
| 91 | +</Project> |
| 92 | +``` |
| 93 | + |
| 94 | +``` |
| 95 | +dotnet build |
| 96 | +``` |
| 97 | + |
| 98 | +``` |
| 99 | +dotnet run |
| 100 | +``` |
| 101 | + |
| 102 | + |
0 commit comments