Presentation as presented on the Global Azure bootcamp at Betabit Utrecht on 22 April 2017.
Size: 9.27 MB
Language: en
Added: May 14, 2017
Slides: 99 pages
Slide Content
Dagindeling 10:00 Start deel 1 12:00 Lunch 13:00 Start deel 2 16:30 Afsluiting (& prijsuitreiking!) 17:00 Einde Global Azure Bootcamp, locatie Betabit Utrecht
Agenda – Deel 1 Intro Use case Web Apps Web Jobs Hands-on Lab Functions Hands-on Lab Service Fabric
Intro
Even voorstellen Het team: Daniël te Winkel Bart Kemps Herbert Lindner Herman Lindner Raymond den Haan
Resiliency
Azure : services will fail Meerdere instanties van applicatie Gebruik een Load Balancer / Azure Application Gateway Gebruik Availability Sets Automatisch schalen om aan hogere vraag te kunnen voldoen Werk asynchroon waar mogelijk Gebruik ‘ resiliency patterns ’ voor externe communicatie
RTO, RPO & MTTR Recovery Time Objective Acceptabele maximum tijd dat een applicatie niet beschikbaar is na een incident Recovery Point Objective Acceptabele maximum tijd dat data verloren gaat tijdens een incident Mean Time To Recover Gemiddelde tijd die nodig is een applicatie te herstellen na een incident
Azure SLA SLA Downtime per week Downtime per month Downtime per year 99% 1.68 hours 7.2 hours 3.65 days 99.9% 10.1 minutes 43.2 minutes 8.76 hours 99.95% 5 minutes 21.6 minutes 4.38 hours 99.99% 1.01 minutes 4.32 minutes 52.56 minutes 99.999% 6 seconds 25.9 seconds 5.26 minutes
Azure App Service Family Web Apps Web apps that scale with your business Mobile Apps Build mobile apps for any device Logic Apps Automate business processes across SaaS and on-premises API Apps Build and consume APIs in the cloud
Azure Web Apps Support a variety of languages and platforms .NET, Java, Node.js, PHP, Python, and more Support scaling (manual or auto) and load balancing Support slots for staged deployments and A/B testing Support continuous integration Global Scale Scale up and down as needed, manually or automatically Enterprise Grade ISO-, SOC2-, and PCO-compliant with enterprise-level SLAs Familiar and Fast Leverage existing skills, plus languages, frameworks, and tools you're familiar with
Scaling - Cloud Computing Patterns Predictable Bursts Services with micro seasonality trends Peaks due to periodic increased demand IT complexity and wasted capacity Compute t Unpredictable Bursts Unexpected/unplanned peak in demand Sudden spike impacts performance Can’t over provision for extreme cases t Compute Growing Fast Successful services needs to grow/scale Keeping up w/ growth is big IT challenge Cannot provision hardware fast enough t Compute On and Off On & off workloads (e.g. batch job) Over provisioned capacity is wasted Time to market can be cumbersome t Compute Inactivity Period
Scaling Up vs. Scaling Out Scale Up Vary the VM size 1 Core w/ 1.75 GB RAM 2 Cores w/ 3.5 GB RAM 4 Cores w/ 7 GB RAM Scale Out Vary the VM count Max 3* instances Max 10 instances Max 20/50** instances
Manual Scaling vs. Auto-Scaling Auto – Schedule & Performance Rules Manual – Scale via portal or scripts Auto – CPU Percentage
Web App
Web App
Web App
Deployment Slots Use a Deploy-Confirm-Promote workflow Promote via “swap” through Azure portal http://sitename -slotname .azurewebsites.net
A/B Testing Test changes by routing requests to different deployment slots Use Traffic Routing to direct % of traffic to alternate slots
Continuous Integration Web apps can be deployed manually via FTP or WebDeploy Automate deployment using 3 rd party source-control providers Can also use a local Git repository from Azure Portal DropBox BitBucket GitHub CodePlex Visual Studio Team Services Git
Continuous Integration + Deployment Slots Developer commits code Automated process builds/compiles and deploys to staging slot Automated and other tests validate content in staging slot Staging content promoted to production Users see updated site Staging Production Test Source Control 1 2 3 4 5
App Service Plans Billing and provisioning for App Service resources Free Shared Basic Standard Premium # of Apps 10 100 Unlimited Unlimited Unlimited Shared Disk Space 1 GB 1 GB 10 GB 50 GB 500 GB Maximum Instances 1 1 3 10 50 Autoscale No No No Yes Yes Staging Environments 5 20 Custom Domains No Yes Yes Yes Yes SLA 99.95%
Resiliency tips & tricks Kies de juiste tier en scale out . Scale up kan reset veroorzaken Geef elke omgeving (OTAP) zijn eigen App Service Plan Scheidt web apps van web APIs voor afzonderlijke schaling Gebruik App Service backup niet voor SQL backup (creëert . bacpac , kost DTU’s ) Gebruik Deployment Slots
Web Jobs
Azure WebJobs “ Run programs or scripts in WebJobs in your Azure App Service web app in three ways: on demand, continuously, or on a schedule. There is no additional cost to use WebJobs . ”
Azure WebJobs Host and schedule lightweights job on an existing website Triggered once, by schedule or run continuously Support: batch (.exe/. cmd /.bat) bash (. sh ) javascript (. js as node.js) php (. php ) python (. py ) Dashboard Experience
Store & start WebJobs WebJobs are stored within the website Site\ wwwroot \ App_Data \jobs\{ job_type }\{ job_name } Will find the file to run by (first one found wins): First look for a file called run.{supported extension} If not found, look for any file with supported extension If not found, then not a runnable WebJob
Many Options for Deploying Azure Portal Visual Studio Visual Studio Team Services – Build FTP Dropbox Drag-n-drop in Kudu Others …
WebJobs SDK
WebJobs SDK “ The purpose of the WebJobs SDK is to simplify the code you write for common tasks that a WebJob can perform, such as image processing, queue processing, RSS aggregation, file maintenance, and sending emails. The WebJobs SDK has built-in features for working with Azure Storage and Service Bus, for scheduling tasks and handling errors, and for many other common scenarios. ”
WebJobs SDK components NuGet packages. NuGet packages that you add to a Visual Studio Console Application project provide a framework that your code uses by decorating your methods with WebJobs SDK attributes. Dashboard. Part of the WebJobs SDK is included in Azure App Service and provides rich monitoring and diagnostics for programs that use the NuGet packages. You don't have to write code to use these monitoring and diagnostics features.
Triggers Poll queue & create blob for each message :
Scheduling TimerTrigger can be used to run WebJob on a schedule Schedule WebJob as a whole ( through Azure ) Use TimerTrigger to schedule individual functions of a WebJob
Dashboard features Invoke functions Replay functions View logs Linked to WebJob ( Console.Out , Trace , etc.) Linked to function invocation
Azure Functions
Azure Functions Create a “serverless” event-driven experience that extends the existing Azure App Service platform by building “nanoservices” that can scale based on demand
Supported Languages and Tools Create functions in JavaScript, C#, Python, and PHP, as well as scripting options such as Bash, Batch, and PowerShell, that can be triggered by virtually any event in Azure, 3rd party services, or on premise systems
Common Scenarios Your App or Service Office 365 Office Graph Azure Storage Other Functions Legacy Systems Web Services Timer-based processing Azure service event processing SaaS event processing Serverless web application architectures Serverless mobile backends Real-time stream processing Real-time bot messaging
Function App Templates Function App templates are categorized into general areas of Timer, Data Processing, and Webhook & API BlobTrigger EventHubTrigger Generic webhook GitHub webhook HTTPTrigger QueueTrigger ServiceBusQueueTrigger ServiceBusTopicTrigger TimerTrigger Blank & Experimental
Timer Function Apps Run at explicitly specified intervals, like every day at 2:00 am using CRON expressions, like “0 */5 * * * *“ (every 5 minutes) Can send information to other systems, but typically don’t “return” information, only write to logs Great for redundant cleanup and data management Great for checking state of services Can be combined with other functions
Data Processing Function Apps Run when triggered by a data event, such as an item being added to a queue or container Typically have in and out parameters Great for responding to CRUD events Great for performing CRUD events Great for moving content Access data across services
Webhook & API Function Apps Triggered by events in other services, like GitHub, Team Foundation Services, Office 365, OneDrive, Microsoft PowerApps Takes in a request and sends back a response Often mimic Web API and legacy web services flows Typically need CORS settings managed Best for exposing functionality to other apps and services Great for building Logic Apps
code Anatomy of a Function A “Run” file that containing the function code A “Function” file containing all service and trigger bindings and parameters A “Project” file containing project assembly and NuGet package references App Service settings, such as connection strings and API keys .NET Core and Project references Function configuration Executable code
Function Bindings Type Service Trigger Input Output Schedule Azure Functions ✔ HTTP (REST or webhook ) Azure Functions ✔ ✔* Blob Storage Azure Storage ✔ ✔ ✔ Events Azure Event Hubs ✔ ✔ Queues Azure Storage ✔ ✔ Tables Azure Storage ✔ ✔ Tables Azure Mobile Apps ✔ ✔ No-SQL DB Azure DocumentDB ✔ ✔ Push Notifications Azure Notification Hubs ✔ Bindings serve as the basis for all connections to and from a function. Many bindings can be “bi-directional” as well.
Testing Functions Command-line tools 3 rd party products such as Postman and Swagger Direct web calls via cURL Nested functions Microsoft Azure Storage Explorer Visual Studio Cloud Explorer
Hands-on lab
Service Fabric
Topics Introducing Microservices & Azure Service Fabric Service Fabric Concepts Developing Service Fabric Applications Deployments & Upgrades
Introducing Microservices & Azure Service Fabric
Microservices Architecture An evolution of Service Oriented Architecture Create a system as a suite of small, independently deployable services Services communicate across lightweight protocols Considerations Services can be scaled to meet their individual needs Supports use of different technology stacks for different system parts Process automation is important (DevOps) UI/UX Storage Storage Business Logic Business Logic 1...n Monolithic Architecture UI/UX Storage Storage Shopping Cart AuthN Microservice Architecture Storage Product Catalog
Azure Service Fabric Can be thought of as an orchestrator of services across a managed cluster of machines Good for microservices, but not only Can be run in Azure, on-premises, or in other clouds Proven platform used by several Microsoft Cloud services, including: Azure SQL Database Document DB Cortana Microsoft Power BI Microsoft Intune Azure Event Hubs Azure IoT Hub Skype for Business
Service Fabric Concepts
Service Fabric Concepts Application Service Service Service Node Node Node Node Cluster Partitions
Service Models
Reliable Services
Partitioning – Stateless Services Stateless Services Node 1 Node 3 Node 2 Node 5 Node 4 I I I I I In a stateless environment, scalability and availability generally achieved by adding instances Place an instance of the service in each Node Add Nodes to scale out
Partitioning – Stateful Services Stateful Services Node 1 Node 3 Node 2 Node 5 Node 4 S3 P1 S2 S1 P3 S4 S3 P5 S4 P2 S5 S5 P4 S1 S2 For stateful services Services are Distributed for scalability Service state is Replicated for availability Distribute primary replicas across the nodes in the cluster and also place secondary replicas Add Nodes, then rebalance to scale out
Reliable Actors Implementation of the Virtual Actor pattern Ideal when the application involves many (thousands) of small isolated units of logic & state Built on top of Stateful Reliable Services Actors are instantiated upon reference and collected upon inactivity State Management can be used during reference to “restore” an actor Actor actions are turn-based (single-threaded) per instance. Supports Timers and Reminders Also supports Events
Developing Service Fabric Applications Windows Setup
Installation The Microsoft Azure Service Fabric SDK is included in the “Azure development” Workload in the Visual Studio 2017 installer
Creating a Project Create a new project by selecting the “Service Fabric Application” template from either the Cloud project node. Choose your desired service type template
Solution Structure Application Project The Services node lists the service projects that make up the Application Includes an Application Manifest that describes the services that make up the Application Includes application publishing profiles, and per-profile settings. Service Project(s) Includes a Service Manifest that describes the Service characteristics Includes the Service code and configuration
Service Fabric Local Cluster Installed as part of the Service Fabric SDK Provides a local debug & test environment Can provision a 1-node or 5-node cluster Not an emulator or a simulator Can be managed via the Windows System Tray application or via PowerShell scripts. Visual Studio is configured to work with the Local Cluster
Service Fabric Explorer
Deployments & Upgrades
Deploying in Azure Service Fabric Applications are deployed in Azure into a Virtual Machine Cluster in a Virtual Machine Scale Set (VMSS) Clusters can be created on VMs running Windows Server 2012 R2, Windows Server 2016, or Linux Ubuntu 16.04 (in preview) Clusters networking can be configured via Azure VNets , Subnets, Public IP Addresses, and internal and/or external load balancing Can be managed with Azure ARM templates, Auto-scaling support is provided by Azure VMSS Management is via a combination of Azure tools and Service Fabric tools
Application Deployments Two types of deployments in Service Fabric – Full and Upgrade In a Full Deployment, the entire application is torn down (if already present) and then a new application instance is deployed. Upgrade Deployments Service Fabric supports rolling upgrades to maintain uptime Service Fabric monitors application health during the upgrade. If the system violates the application health policy, the upgrade is rolled back. Several modes govern the automation and health-check behavior during an upgrade.
Lunch
Agenda – Deel 2 Cognitive Services Hands-on lab Visual Studio Team Services Source control Builds Release Management
Computer Vision Tagging images Categorizing images Identify image types Domain- specific content Generating descriptions Perceiving color schemes Flagging adult content Optical Character Recognition Recognize handwritten tekst Generating thumbnails
The 86-category concept
Computer Vision – Example
Generating description – Example
Face API Face detection Face recognition Face verification Finding similar face Face grouping Face identification Face storage
Face API – Example Face detection Face Grouping
Cognitive Services – How to use … They are ‘ just ’ REST APIs Use SDKs
Hands-on lab
Visual Studio Team Services
Source control Team Foundation Version Control ( centralized ) Git ( distributed ) The most commonly used version control system today “ Git is the default version control provider for new projects. You should use Git for version control in your projects unless you have a specific need for centralized version control features in TFVC.” - visualstudio.com documentation
Continuous integration Link builds to test results , work items, code and releases Hosted build agents Multi-platform (Windows, Mac, Linux) Security, pool and queue management Automated builds Diagnostics Continuous deployment
Automated deployments Design and automate release pipelines across your environments to any target platform.
Azure Setup your release with built in tasks for Azure and Azure Stack – deploy to websites, Docker containers, virtual machines, and more.
Quality Configure tasks for all of your release check points – performance, A/B, functional, security, beta testing and more. No more release day nightmares.
Control your deployments Enable sign-off for deployments using pre or post deployment approvals. Automatic notifications ensure collaboration and release visibility among team members.
Traceability Track the status of releases and deployments including commits and work items in each environment.
Resources Azure regions (includes products per region) Cognitive Services SDKs & Samples