1 / 34

Building Scalable, Global, and Highly Available Web Apps

Building Scalable, Global, and Highly Available Web Apps. Name Title Microsoft Corporation. Agenda. Design for High Availability Design for High Scalability Design for Performance. Assumptions. You know the basics Windows Azure Web/Worker Roles SQL Database Windows Azure Storage

ketan
Download Presentation

Building Scalable, Global, and Highly Available Web Apps

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building Scalable, Global, and Highly Available Web Apps Name Title Microsoft Corporation

  2. Agenda Design for High Availability Design for High Scalability Design for Performance

  3. Assumptions You know the basics Windows Azure Web/Worker Roles SQL Database Windows Azure Storage Asynchronous Programming Windows Azure diagnostics You have deployed a service to Windows Azure Everything can and will (eventually) break

  4. Availability

  5. Why do services fail? Increased workload Failure Hardware Network Platform Service Transient conditions Human Upgrades

  6. What do we mean by available? Same functionality Degraded functionality Failsafe

  7. Basics – what you get for free Elasticity Easily deploy compute resources and scale up and down Automated Service Management Windows Azure will (automatically) recover bad nodes Fault Domains Windows Azure deploys services across fault boundaries Storage Resilience 3 copies of storage maintained

  8. Fault Tolerance When Windows Azure breaks, it fixes itself! Can your service? Codifying Operations Upgrade Domains Configure in ServiceDefinition.csdef <ServiceDefinition name="RedDir"xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" upgradeDomainCount="3"> Transient Datacenter Conditions Do you have Retry Logic?

  9. What did you mean, retry logic? Transient conditions in the datacenter/network/service Example: SQL Azure Error 40501The service is currently busy. Retry the request after 10 seconds. Transient Fault Handling Framework http://windowsazurecat.com/2011/02/transient-fault-handling-framework/ Retry against anything that might be external and have transient conditions*: SQL Database Windows Azure Storage Service Bus 3rd Party Services

  10. Retry demo

  11. Service Specific Implementations Does your service fail without that platform service? Can your service use the same platform services from another data center? Can your service not use that platform service temporarily?

  12. Site Failover If a site specific dependency is out, fail over to another site Easy: Use Traffic Manager Hard: Code your own

  13. Site Failover demo

  14. Upgrade Strategies: VIP Swap V1 DNSfoo.com Load Balancer Foo.cloudapp.net (Production) V2 GUID.cloudapp.net Test (Staging)

  15. Upgrade Strategies: Upgrade DNSfoo.com Load Balancer Foo1.cloudapp.net (Production) Worker Worker Web Web V1 V1 V2 V2 V1 V1 V2 V2 V1 V1 V2 V2

  16. Upgrade StrategiesNew Service & Swap DNS DNSfoo.com Foo1.cloudapp.net (Production) Foo2.cloudapp.net (Production)

  17. Scalability

  18. What is wrong with this? • It is better to have 50 x 1GB database than 1 x 50GB database Web Role Scale me out too SQL Database 1 n

  19. What about this? Everything needs to scale Web Role SQL Database Load Balancer Table Storage Worker Role Q Blob Storage

  20. Synchronous Design Pattern Each thread dedicated to one outstanding request Block on each step of “the work” done for each request, then respond & repeat This approach scales poorly Each outstanding request is stored on a thread stack Threads block even when there is work to be done Adding a thread enables only one additional concurrent request Web App Front End SQL Azure • “The Work” #1 • Client Request #1 Middle Tier • Response #1 • Client Response #1 • Thread • Thread • blocks WA Storage • Waiting… • Client Request #2 • Time passes…

  21. Asynchronous Design Pattern Each thread picks up work whenever it is ready A thread handling one request may handle another before the first one completes Web App Front End SQL Azure • “The Work” #1 • Client Request #1 Context Middle Tier • Response #1 • Client Response #1 • Client Request #2 • Thread • Thread • “The Work” #2 WA Storage • Client Response#2 • Response#2 This approach scales well Client requests tracked explicitly in app’s data structures Threads never block while there is work to be done Each thread can handle possibly many concurrent requests But bookkeeping & synchronization can be difficult…

  22. Performance

  23. What’s Windows Azure Cache? Use spare memory on your VMs as high-performance cache Distributed cache cluster co-located with existing roles, or use dedicated roles Named caches with high availability option and notifications Support Memcached protocol

  24. Why Windows Azure Cache? Faster No external service calls (additional network hops) Co-located in roles Cheaper No external service calls (additional cost) Use spare memory that you already paid for More reliable Your service is running = cache is available No throttling as in cotenant environment

  25. Cache demo

  26. Why Performance Matters More responsive applications Faster page load times 8 seconds vs. 3 seconds? Higher interactivity – new type of applications Better user experience – more $$$

  27. Thinking Globally Network latency Put compute closer to user. Put data closer to user. Global availability Datacenter outages. Synchronizing data.

  28. Network Latency

  29. Content Delivery Network (CDN) High-bandwidth global blob content delivery 24 locations globally (US, Europe, Asia, Australia and South America), and growing Same experience for users no matter how far they are from the geo-location where the storage account is hosted Blob service URL vs CDN URL: Windows Azure Blob URL: http://images.blob.core.windows.net/ Windows Azure CDN URL: http://<id>.vo.msecnd.net/ Custom Domain Name for CDN: http://cdn.contoso.com/

  30. Windows Azure CDN GET http://guid01.vo.msecnd.net/images/pic.1jpg 404 To Enable CDN: Register for CDN via Dev Portal Set container images to public EdgeLocation EdgeLocation EdgeLocation Content Delivery Network TTL http://sally.blob.core.windows.net/  http://guid01.vo.msecnd.net/ Windows Azure Blob Service pic1.jpg pic1.jpg pic1.jpg http://sally.blob.core.windows.net/images/pic1.jpg

  31. Windows Azure Traffic Manager Direct users to the service in the closest region with the Windows Azure Traffic Manager Traffic Manager foo-us.cloudapp.net foo.cloudapp.net foo-europe.cloudapp.net Policies Monitoring DNS response 1.2.3.4 foo-asia.cloudapp.net

  32. Traffic Manager demo

  33. Summary Windows Azure gives you high availability capabilities for free Think about scaling out Handle transient conditions Design for scalability Asynchronous pattern Scale out Design for maximum performance & reach Caching, CDN, Traffic Manager, etc.

More Related