Building Real World Cloud apps with Windows Azure

  • Published on
    11-Feb-2016

  • View
    38

  • Download
    4

DESCRIPTION

Building Real World Cloud apps with Windows Azure. Scott Guthrie Corporate Vice President Windows Azure Email: scottgu@microsoft.com Twitter: @ scottgu. Cloud Computing Enables You To Reach more users/customers, and in a richer way Deliver solutions not possible or practical before - PowerPoint PPT Presentation

Transcript

<p>Windows Azure Overview</p> <p>Building Real World Cloud apps with Windows AzureScott GuthrieCorporate Vice PresidentWindows Azure</p> <p>Email: scottgu@microsoft.comTwitter: @scottgu1Cloud Computing Enables You To</p> <p>Reach more users/customers, and in a richer wayDeliver solutions not possible or practical beforeBe more cost effective by paying only for what you useLeverage a flexible, rich, development platform</p> <p>Hello World with Windows Azuredemo3Todays GoalGo much deeper than hello world and cover key development patterns and practices that will help you build real world cloud appsCloud Patterns we will CoverPart 1:Automate EverythingSource ControlContinuous Integration &amp; DeliveryWeb Dev Best PracticesEnterprise Identity IntegrationData Storage Options</p> <p>Part 2:Data Partitioning StrategiesUnstructured Blob StorageDesigning to Survive FailuresMonitoring &amp; TelemetryTransient Fault HandlingDistributed CachingQueue Centric Work PatternQuick FixIt Demodemo6Cloud Patterns we will discussPart 1:Automate EverythingSource ControlContinuous Integration &amp; DeliveryWeb Dev Best PracticesEnterprise Identity IntegrationData Storage Options</p> <p>Part 2:Data Partitioning StrategiesUnstructured Blob StorageDesigning to Survive FailuresMonitoring &amp; TelemetryTransient Fault HandlingDistributed CachingQueue Centric Work PatternPattern 1: Automate EverythingDev/Ops WorkflowDevelopDeployOperateLearnRepeatableReliablePredictableLow Cycle TimeAutomated Environment Creation and App Deploymentdemo10Pattern 2: Source ControlSource ControlUse it! </p> <p>Treat automation scripts as source code and version it together with your application code</p> <p>Parameterize automation scripts &gt; never check-in secrets </p> <p>Structure your source branches to enable DevOps workflowExample Source Branch StructureMasterStagingDevelopmentFeature Branch AFeature Branch BFeature Branch CCode that is live in productionCode in final testing before productionWhere features are being integratedNeed to make a quick hotfix?MasterStagingDevelopmentFeature Branch AFeature Branch BFeature Branch CHotfix 145Git with Visual Studiodemo15Pattern 3: Continuous Integration and Continuous DeliveryContinuous Integration &amp; DeliveryEach check-in to Development, Staging and Master branches should kick off automated build + check-in tests</p> <p>Use your automation scripts so that successful check-ins to Development and Staging automatically deploy to environments in the cloud for more in-depth testing</p> <p>Deploying Master to Production can be automated, but more commonly requires an explicit human to sign-off before live production updated</p> <p>http://tfs.visualstudio.comTFS and Git supportElastic Build ServiceContinuous IntegrationContinuous DeliveryLoad Testing SupportTeam Room CollaborationAgile Project ManagementPattern 4: Web Dev Best PracticesWeb Development Best PracticesScale-out your web tier using stateless web servers behind smart load balancers</p> <p>Dynamically scale your web tier based on actual usage load</p> <p>Windows Azure Web Sites Build with ASP.NET, Node.js, PHP or PythonDeploy in seconds with FTP, WebDeploy, Git, TFSEasily scale up as demand grows</p> <p>21Load Balancer(1 of n)Reserved InstanceVirtual Machine withIIS already setup(1 of n)Windows Azure Web Site ServiceLoad Balancer(2 of n)Reserved InstanceVirtual Machine withIIS already setup(2 of n)Deployment Service(FTP, WebDeploy, GIT, TFS, etc)Developer orAutomation ScriptReserved InstanceVirtual Machine withIIS already setup(1 of 2)Reserved InstanceVirtual Machine withIIS already setup(2 of 2)</p> <p>Server Failure.Reserved InstanceVirtual Machine withIIS already setup(2 of 2)22AutoScale Built-into Windows AzureAutoScale based on real usageCPU % thresholdsQueue DepthSupports schedule times</p> <p>Windows Azure Web Sites &amp; AutoScaledemo24Web Development Best PracticesScale-out your web tier using stateless web servers behind smart load balancers</p> <p>Dynamically scale your web tier based on actual usage load</p> <p>Avoid using session state (use cache provider if you must)</p> <p>Use CDN to edge cache static file assets (images, scripts)</p> <p>Use .NET 4.5s async support to avoid blocking calls</p> <p>Take advantage of the new .NET 4.5 async language support to build non-blocking, asynchronous, server applications </p> <p>ASP.NET MVC, ASP.NET Web API and ASP.NET WebForms all have built-in async language keyword support as of .NET 4.5</p> <p>Integrated async language support coming with Entity Framework 6 (currently in preview)</p> <p>Enables you to author all of your SQL database access in a non-blocking way</p> <p>Enables web server to re-use the worker thread while you are waiting on data from SQL</p> <p>New async language support in EF composes cleanly with LINQ expressions as well.</p> <p>This is really cool Web Development with ASP.NET MVC &amp; Windows Azure Web Sitesdemo29Pattern 5: Single Sign-OnWindows Azure ADActive Directory in the CloudIntegrate with on-premises Active DirectoryEnable single sign-on within your appsSupports SAML, WS-Fed, and OAuth 2.0Enterprise Graph REST API</p> <p>31Windows AzureYour app in AzureWindows Azure Active Directory3rd party appsWindows Server Active Directory</p> <p>Windows Azure Active Directorydemo33Config wizard automatically launches</p> <p>Enter Windows Azure AD Credentials</p> <p>Enter Windows Server AD Credentials</p> <p>Enable Hashed Password Sync</p> <p>Almost done</p> <p>Finished Sync will start automatically</p> <p>No need to install on multiple DCs. No reboot required!Enable SSO with Azure AD and ASP.NET</p> <p>Enable SSO with Azure AD and ASP.NET</p> <p>Enable SSO with Azure AD and ASP.NET</p> <p>Pattern 6: Data StorageData StorageRange of options for storing data Different query semantics, durability, scalability and ease-of-use options available in the cloud</p> <p>Compositional approachesNo one size fits all often using multiple storage systems in a single app provides best approach</p> <p>Balancing prioritiesInvestigate and understand the strengths and limitations of different optionsTechReady 16 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/6/201344Data Storage Options on Windows AzureBlob Storage(unstructured files)SQL Database(Relational)Table Storage(NoSQL Key/Value Store)</p> <p>SQL Server, MySQL,Postgress, RavenDB, MongoDB, CouchDB, neo4j, Redis, Riak, etc.</p> <p>Platform as a Service(managed services)Infrastructure as a Service(virtual machines)45Some Data Storage Questions to AskData SemanticWhat is the core data storage and data access semantic?Query SupportHow easy is it to query the data? What types of questions can be efficiently asked?Functional projectionCan questions, aggregations, etc. be executed server-side?What languages or types of expressions can be used?Ease of ScalabilityDoes it natively implement scale-out?How easy is it to add/remove capacity (size, throughput)?Manageability How easy is the platform to instrument, monitor and manage?OperationsHow easy is it to deploy and run on Azure? PaaS? IaaS? Linux?Business continuityAvailability and ease-of-use: backup/restore and disaster recoveryMICROSOFT CONFIDENTIAL INTERNAL ONLYChoosing Relational Database on AzureWindows Azure SQL Database (PaaS)Database as a Service (no VMs required)Database-Level SLA (HA built-in)Updates, patches handled automatically for youPay only for what you use (no license required)Good for handling large numbers of smaller databases ( Table StorageHTTP/FREB Logs -&gt; File-System or Blob StorageWindows Events -&gt; File-System</p> <p>Cloud ServicesSystem.Diagnostics -&gt; Table StorageHTTP/FREB Logs -&gt; Blob StoragePerformance Counters -&gt; Table StorageWindows Events -&gt; Table StorageCustom Directory Monitoring -&gt; Copy files to Blob StorageStorage AnalyticsLogs -&gt; Blob StorageMetrics -&gt; Table Storage</p> <p>Implementing Logging within our FixIt Web Sitedemo78Pattern 11: Transient Fault HandlingTransient FailuresTemporary service interruptions, typically self-healingConnection failures to an external service (or suddenly aborted connections)Busy signals from an external service (sometimes due to noisy neighbors)External service throttling your app due to overly aggressive calls</p> <p>Can often mitigate with smart retry/back-off logicTransient Fault Handling Block from P&amp;P can make this easy to expressStorage Library already has built-in support for retry/back-offsEntity Framework V6 will include built-in support for it with SQL DatabasesPatterns &amp; PracticesTransient Fault Handling Application Block</p> <p>http://nuget.org/packages/EnterpriseLibrary.WindowsAzure.TransientFaultHandlingEntity FrameworkBuilt-in support fault-retry logic coming with EF6Above code will do connection retries up to 3 times within 5 seconds (with an exponential back-off delay)</p> <p>Transient Fault Handling with EF6demo83Be mindful of max delay thresholds</p> <p>At some point, your request could be blocking the line and cause back pressure. Often better to fail gracefully at some point, and get out of the queue!Pattern 12: Distributed CachingDistributed CachingNot always practical to hit data source on every requestThroughput and latency impact as traffic grows</p> <p>Data doesnt always need to be immediately consistent even when things are working well</p> <p>Cached copy of data can help you provide better customer experience when things arent working wellWindows Azure Cache ServiceHigh throughput, low-latency distributed cacheIn-memory (not written to disk)Scale-out architecture that distributes across many servers</p> <p>Key/Value Programming ModelGet(key) =&gt; avg. 1ms latency end-to-endPut(key) =&gt; avg. 1.2ms latency end-to-end</p> <p>128MB to 150GB of content can be stored in each Cache Service</p> <p>Web.Config Update</p> <p>Coding against the cache</p> <p>Monitoring Usage</p> <p>Scaling the Cache</p> <p>24GB Distributed CacheWeb Site VMs</p> <p>12GB VM</p> <p>12GB VM29924GB Distributed CacheWeb Site VMs</p> <p>12GB VM</p> <p>12GB VM4</p> <p>12GB VM</p> <p>12GB VM48GB Distributed CachePopular Cache Population StrategiesOn Demand / Cache AsideWeb/App Tier pulls data from source and caches on cache hit miss </p> <p>Background Data PushBackground services (VMs or worker roles) push data into cache on a regular schedule, and then the web tier always pull from the cache</p> <p>Circuit BreakerSwitch from live dependency to cached data if dependency goes downUse distributed caching in any application whose users share a lot of common data/content or where the content doesnt change frequentlyPattern 13: Queue Centric Work PatternQueue Centric Work PatternEnable loose coupling between a web-tier and backend service by asynchronously sending messages via a queue</p> <p>Scenarios it is useful for: Doing work that is time consuming (high latency)Doing work that is resource intensive (high CPU)Doing work that requires an external service that might not always be availableProtecting against sudden load bursts (rate leveling)</p> <p>Cons:Trade off can be higher end-to-end times for short latency scenarios104Tightly Coupled</p> <p>FixIt Web ServerFixIt DB</p> <p>Sql Database</p> <p>105Tightly Coupled</p> <p>FixIt Web ServerFixIt DBSql Database</p> <p>Sql Database</p> <p>106</p> <p>FixIt Web ServerTask QueueLoosely Coupled</p> <p>Sql Database</p> <p>Backend ServiceQueue Listener</p> <p>107Backend ServiceQueue Listener</p> <p>FixIt Web ServerTask Queue</p> <p>Loosely CoupledSql Database</p> <p>108</p> <p>FixIt Web ServerTask QueueBackend ServiceTracking</p> <p>Loosely CoupledBackend ServiceQueue Listener</p> <p>Sql Database</p> <p>Sql Database</p> <p>Queue Listener</p> <p>109</p> <p>FixIt Web ServersTask QueueQueueListenerQueueListenerBackend Services</p> <p>Scale Tiers Independently</p> <p>110Modifying our Existing Create a FixIt Task Scenario to Use Queues</p> <p>Create Action in our Web App (before)Before our Controller used the FixItRepository to update the database with the submitted FixIt.</p> <p>Then we show the success pageCreate Action in our Web App (after)</p> <p>Now we post the FixItTask to a Queue</p> <p>Then we show the success page</p> <p>Simple SendMessage Implementation</p> <p>Uses JSON.NET to serialize the FixItTask object to JSON</p> <p>Then adds a message with the JSON payload to the fixits queue</p> <p>Web App shows Success page as soon as the message is persisted into the queue</p> <p>Simple Receiver Implementation</p> <p>Loops forever processing messages in the queue</p> <p>De-serializes messages from JSON to .NET</p> <p>Saves FixIt objects in FixItRepository (same class we previously used in the web app)</p> <p>More complete implementation would add logic to pause if database was unavailable and handle recovery cleaner</p> <p>Because the FixIt is persisted in the queue, we wont loose it even if the database is down</p> <p>Why does this bring us?Resiliency if our database is ever unavailableOur customers can still make FixIt requests even if this happens</p> <p>Ability to add more backend logic on each FixIt requestNo longer gated by what can be done in lifetime of HTTP requestExamples: workflow routing on who it is assigned to, email/SMS, etcQueues can give us resiliency to these additional external services too</p> <p>Storage99.9% SLACompute99.95% SLASQL Database99.9% SLAComposite99.75%SLAWhat is our composite SLA now for the Create FixIt Request scenario?PreviouslyComposite99.85%SLA99.9% SLA99.95% SLANowMICROSOFT CONFIDENTIAL INTERNAL ONLY119How could we make it even better?Have two queues in two different regionsChances of both being down at same time very, very smallWeb App and Queue Listeners could be smart and fail-over if primary is having a problem</p> <p>Have the web-app deployed in two different regionsUse a traffic manager to automatically redirect users if one is having a problemCloud ServicesBuild infinitely scalable apps and servicesSupport rich multi-tier architecturesAutomated application management</p> <p>121Cloud Patterns we CoveredPart 1:Automate EverythingSource ControlContinuous Integration &amp; DeliveryWeb Dev Best PracticesEnterprise Identity IntegrationData Storage OptionsPart 2:Data Partitioning StrategiesUnstructured Blob StorageDesigning to Survive FailuresMonitoring &amp; TelemetryTransient Fault HandlingDistributed CachingQueue Centric Work PatternCloud computing offers tremendous opportunitiesReach more users and customers, and in a deeper wayBe more cost effective by elastically scaling up and downDeliver solutions that werent possible or practical beforeLeverage a flexible, rich, development platform</p> <p>Follow these cloud patterns and youll be even more successful with the solutions you buildSummaryTo Learn MoreFailSafe: Building Scalable, Resilient Cloud Services http://aka.ms/FailsafeCloud</p> <p>Cloud Service Fu...</p>

Recommended

View more >