Upload
bryan-lawrence
View
220
Download
0
Tags:
Embed Size (px)
Citation preview
Building Scalable, Global, and Highly Available Web AppsNameTitleMicrosoft Corporation
Agenda
Design for High Availability
Design for High Scalability
Design for Performance
Assumptions
You know the basicsWindows Azure Web/Worker RolesSQL DatabaseWindows Azure StorageAsynchronous ProgrammingWindows Azure diagnostics
You have deployed a service to Windows Azure
Everything can and will (eventually) break
Availability
Why do services fail?
Increased workload
FailureHardwareNetwork Platform ServiceTransient conditions
HumanUpgrades
What do we mean by available?
Same functionality
Degraded functionality
Failsafe
Basics – what you get for free
ElasticityEasily deploy compute resources and scale up and down
Automated Service ManagementWindows Azure will (automatically) recover bad nodes
Fault DomainsWindows Azure deploys services across fault boundaries
Storage Resilience3 copies of storage maintained
Fault ToleranceWhen Windows Azure breaks, it fixes itself!Can your service?
Codifying OperationsUpgrade DomainsConfigure in ServiceDefinition.csdef<ServiceDefinition name="RedDir"xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" upgradeDomainCount="3">
Transient Datacenter ConditionsDo you have Retry Logic?
What did you mean, retry logic?Transient conditions in the datacenter/network/serviceExample:SQL Azure Error 40501The service is currently busy. Retry the request after 10 seconds.
Transient Fault Handling Frameworkhttp://windowsazurecat.com/2011/02/transient-fault-handling-framework/
Retry against anything that might be external and have transient conditions*:SQL DatabaseWindows Azure StorageService Bus3rd Party Services
Retry
demo
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?
Site Failover
If a site specific dependency is out, fail over to another site
Easy: Use Traffic Manager
Hard: Code your own
Site Failover
demo
Upgrade Strategies: VIP Swap
Upgrade Strategies: Upgrade
WEB WORKER WEB WORKER
Upgrade StrategiesNew Service & Swap DNS
Scalability
It is better to have 50 x 1GB database than 1 x 50GB database
What is wrong with this?
Scale me out too
Everything needs to scale
What about this?
Synchronous Design PatternEach thread dedicated to one outstanding requestBlock on each step of “the work” done for each request, then respond & repeat
This approach scales poorlyEach outstanding request is stored on a thread stackThreads block even when there is work to be doneAdding a thread enables only one additional concurrent request
Client Request #1Web App Front End
Client Response #1
Client Request #2
“The Work” #1
Response #1
Time passes…
Thread Thread
Waiting…blocks
Asynchronous Design PatternEach thread picks up work whenever it is readyA thread handling one request may handle another before the first one completes
Client Request #1Web App Front End
Client Response #1Client Request #2
“The Work” #1
Response #1Thread Thread
Client Response #2
“The Work” #2
Response #2
This approach scales wellClient requests tracked explicitly in app’s data structuresThreads never block while there is work to be doneEach thread can handle possibly many concurrent requests
But bookkeeping & synchronization can be difficult…
Performance
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
Why Windows Azure Cache?
FasterNo external service calls (additional network hops)Co-located in roles
CheaperNo external service calls (additional cost)Use spare memory that you already paid for
More reliableYour service is running = cache is availableNo throttling as in cotenant environment
Cache
demo
Why Performance Matters
More responsive applicationsFaster page load times8 seconds vs. 3 seconds?
Higher interactivity – new type of applicationsBetter user experience – more $$$
Thinking Globally
Network latencyPut compute closer to user.Put data closer to user.
Global availabilityDatacenter outages.Synchronizing data.
Network Latency
Content Delivery Network (CDN)
High-bandwidth global blob content delivery24 locations globally (US, Europe, Asia, Australia and South America), and growingSame 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/
Windows Azure CDN
pic1.jpg
To Enable CDN:Register for CDN via Dev PortalSet container images to public
pic1.jpg
GEThttp://guid01.vo.msecnd.net/images/pic.1jpg
http://sally.blob.core.windows.net/images/pic1.jpg
http://sally.blob.core.windows.net/ http://guid01.vo.msecnd.net/
pic1.jpg
404
TTL Content Delivery Network
Windows Azure Blob Service
EdgeLocation
EdgeLocation
EdgeLocation
Windows Azure Traffic ManagerDirect users to the service in the closest region with the Windows Azure Traffic Manager
Policies Monitoring
foo.cloudapp.net
DNS response
1.2.3.4
Traffic Manager
demo
Summary
Windows Azure gives you high availability capabilities for freeThink about scaling outHandle transient conditions
Design for scalabilityAsynchronous patternScale out
Design for maximum performance & reachCaching, CDN, Traffic Manager, etc.
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista 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.
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista 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.