Cloud Services vs. Web Apps Boston Code Camp - November 2016 Jason Haley
Hosting multi-tier web applications The three ways to host your applications on the Microsoft Azure Platform Hosting multi-tier web applications Infrastructure as a Service IaaS Platform as a Service PaaS Making the point that Virtual Machines is IaaS while both CloudServices, Websites and Service Fabric are PaaS. Compare to personal transportation: IaaS – own and operate your own car PaaS – rent a car
Cloud Services Worker or Web Roles Various machine sizes Support for multiple languages Designed to scale horizontally A lot of control to configure Support for Java, Node.js, PHP, Python, .NET, and Ruby
Demo: Cloud Service Creation
App Services – Web Apps Designed for hosting web sites with web jobs Various machine sizes (even a free tier) Support for multiple languages Designed to scale vertically/horizontally Near-instant deployment Supports .NET, Java, PHP, Node.js, and Python
Demo: Web App Creation
Common Features
General Host web tier of multi-tier architecture Integrated endpoint monitoring Host middle tier of a multi-tier architecture SSL/TLS support Various machine sizes
Development Multiple languages Continuous delivery with VSTS Visual Studio tooling Access to services like Service Bus, Storage, SQL Database, Redis, Key Vault, etc. Remote debugging Web Apps can add ruby support with Site Extension
Deployment Multiple deployment environments Automatic OS updates Traffic Manager Scale instances without redeploy Network isolation* Can be 32 or 64 bit Configuration settings in cloud * If you need more than ability for Web site to connect to VNet via VPN, then need to go to App Service Environment for Web Apps to get network isolation.
Two Tier App
Two Tier web site or app Examples: Deployed as a single web site No database or external services Could use local database or data files UI Layer http/https Business Layer Examples: Marketing site Blogging site with local data files
Two Tier with Cloud Services Pros Cons Easy to add to web project in Visual Studio Can RDP to machine Can run startup scripts as elevated user Small changes require redeploy Deployment is slow Need two instances for SLA Other Pros: Other Cons: - Staging slot name is guid
Two Tier with Web Apps Pros Cons Small changes don’t require redeploy Only need one instance for SLA Can have more than two deployment slots Cannot RDP to machine Cannot run startup scripts as elevated user Other Pros: Easy A/B testing between slots Can scale up/down machine size without redeploying Many templates to choose from for blogs, etc. Free plan available Other Cons:
N Tier App
N Tier web app with background processing Web site Worker Web site(s) and worker(s) processes External database or external services Worker could be a service tier Web site and worker may communicate using a queue UI Layer http/https Business Layer Examples: ASP.Net MVC web application with database Web application with worker services that offload time intensive processing (like OCR, email sending, video processing, etc.) Web application with service layer (‘worker’ could be another site with just apis) used to separate UI -> Business -> Data
N Tier with Cloud Services Pros Cons Easy to deploy multiple roles in single package Worker roles are independent from web role resources Can have internal and other tcp/udp endpoints Worker role means paying for another machine 24/7 Need two instances for SLA More roles mean bigger package which means slower deployment Other Pros Can have reserved static ip address Other Cons
N Tier with Web Apps Pros Cons WebJob SDK make worker type logic quick to write Always On keeps site warm Only need one instance for SLA WebJobs use same resources as site Publishing multiple sites in single deployment is not easy out of the box Only port 80 and 443 open Other Pros Other Cons - Unless using ASE ip addresses are from a pool of 4 addresses when making calls over the internet (ex. other 3rd party service apis)
N Tier App + DMZ DMZ (demilitarized zone) refers to a perimeter network which is a logical subnetwork that contains and exposes an organizations external facing services to a larger and untrusted network (usually the internet).
N Tier web app with background processing plus DMZ Web site Services No direct path from internet to services or db Perimeter network, subnets for tiers Inbound and outbound traffic rules App components are deployed in subnets Could add security appliance like firewall or Web Application Firewall UI Layer Business Layer https Data Layer DMZ (demilitarized zone) refers to a perimeter network which is a logical subnetwork that contains and exposes an organizations external facing services to a larger and untrusted network (usually the internet). Examples: Same examples as other tier scenarios but this one has full control over access to application components and how data flows. Web application that needs a Web Application Firewall (WAF) in front of it.
N Tier + DMZ with Cloud Services Pros Cons May need less resources in comparison to Web Apps Define which subnets the roles belong to in cscfg file Cloud Services have to be added to the network High density resource usage is harder to achieve
App Service Terms App Service Plan (ASP) – Free, Shared, Basic, Standard, Premium levels. App Service Environment (ASE) – Premium service plan option of a fully isolated and dedicated environment. Designed for high RPS (Requests per Second) and high security scenarios.
N Tier + DMZ with Web Apps Pros Cons Once setup is mostly like web apps (faster deploy) An ASE is always deployed in a VNet Easier to get higher density resource usage Have to use an App Service Environment (ASE) for each tier NSG rules are between ASE’s not specific apps Scaling is a slow process
Summary
General Advice Start with web apps unless you can’t If you can’t afford ASE but need N Tier + DMZ, go with cloud services
Use Cloud Services When You … need machine level access need startup tasks need ETW access need to receive traffic from ports other than 80/443
Use Web Apps When You … have an http(s) app and/or background processing need fast deployment of assets need the ability to scale vertically without redeploying find the additional tools provided by the portal are worth it Additional tools with Web Aps that Cloud Services doesn’t have: WebJobs and WebJobs SDK Multiple Deployment Slots and ability to do A/B testing Extra deployment options (like local git, etc.) Ftp Authentication/Authorization Kudu (can even drag and drop files on server)
Questions? Contact Me Email: jason@jasonhaley.com Blog: http://jasonhaley.com Twitter: @haleyjason North Boston Azure User Group Meets Here on last Tuesday of the month