Cloud Design Pattern part2
-
Upload
masashi-narumoto -
Category
Software
-
view
500 -
download
0
Transcript of Cloud Design Pattern part2
![Page 1: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/1.jpg)
Cloud Design Patterns – part 2Masashi NarumotoAzureCAT patterns & practicesMicrosoft
![Page 2: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/2.jpg)
RetryCircuit BreakerQueue based load levelingThrottlingLeader ElectionValet Key
Agenda
![Page 3: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/3.jpg)
Retry problem – access to resource fails
Web siteUser Remote resource
Error
![Page 4: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/4.jpg)
Retry solution
Web siteUser Remote resource
HTTP 500
HTTP 500
HTTP 200
When to retry?interval/count?
![Page 5: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/5.jpg)
Service Retry capabilities Policy configuration Scope Telemetry features
AzureStorage Native in client Programmatic Client and individual operations TraceSource
SQL Database with Entity Framework
Native in client Programmatic Global per AppDomain None
SQL Database with ADO.NET
Topaz* Declarative and programmatic
Single statements or blocks of code Custom
Service Bus Native in client ProgrammaticNamespace Manager, Messaging Factory, and Client
ETW
Cache Native in client Programmatic Client TextWriterDocumentDB Native in service Non-configurable Global TraceSource
Search Topaz* (with custom detection strategy)
Declarative and programmatic Blocks of code Custom
Active Directory Topaz* (with custom detection strategy)
Declarative and programmatic Blocks of code Custom
Retry solution
![Page 6: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/6.jpg)
Only retry transient errorsRetry strategy per contextAvoid cascading retryUse built-in retry logicTest/Log retry operations
Retry design considerations
https://github.com/mspnp/azure-guidance/blob/master/Retry-Service-Specific.md
![Page 7: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/7.jpg)
Circuit Breaker problem - remote service causes cascading failure
Web siteUser Remote service
error
Retry consume memory, thread, network connection etc.
![Page 8: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/8.jpg)
Circuit Breaker solution
![Page 9: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/9.jpg)
Exception handling in Open stateTransition to Half-Open stateManual overwriteUnderstand the protected resourcesAccelerated Circuit BreakingNG for local resources
Circuit Breaker design considerations
![Page 10: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/10.jpg)
Queue Based Load Leveling problem Surge in requests exhaust resources
UserDatabase
XWeb Site
![Page 11: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/11.jpg)
Queue Based Load Leveling solution
Database
Use queue as a buffer
Rate of requests Rate of processing
Web site
![Page 12: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/12.jpg)
Reduce the rate that resource can handleIdentify # of queue/worker by testsUse reply queue when neededLatency will increase
Queue Based Load Leveling considerations
![Page 13: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/13.jpg)
Throttling problem - surge in workload
Web siteUser
Storage
Multi-tenant
![Page 14: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/14.jpg)
Throttling solution
![Page 15: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/15.jpg)
Design the strategy early onPerform quicklyCan be used together with auto-scalingAggressive auto-scaling if demand grow very quickly
Throttling design considerations
![Page 16: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/16.jpg)
Leader Election problem – control distribution
Storage Split/Shuffle
Mapper/Reducer
![Page 17: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/17.jpg)
Leader Election solution
1. Try to acquire blob lease2. First one that acquires it is the leader3. Leader dispatches task to other instances4. Leader renews the lease
![Page 18: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/18.jpg)
Make the election process resilientReplace leader when it goes downDistributed mutex could be SPOFConsider the leader may be removed by auto-scaling
Leader Election design considerations
![Page 19: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/19.jpg)
Valet Key problem – protect storage
ApplicationUser StorageMalicious user
![Page 20: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/20.jpg)
Valet Key Solution
![Page 21: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/21.jpg)
Manage the key validity and controlBe aware you lose some controlValidate/Sanitize uploaded dataEnsure start time is earlier than currentGood for offloading from compute resource and reducing costs
Valet Key design considerations
![Page 22: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/22.jpg)
✔
✔ ✔
✔
✔
✔
![Page 23: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/23.jpg)
© 2014 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.
![Page 24: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/24.jpg)
Index Table problem Lack of 2ndary index
Query:Customers in Redmond?Customers(name=‘smith’)?
![Page 25: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/25.jpg)
Index Table solution
Create another table with ‘town’ as index
Pros:- Query is fast since the new table has all dataCons:- Table size becomes large- Data consistency issue
![Page 26: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/26.jpg)
Index Table solution
Pros:- Table size is small- Less consistency issuesCons:- 2 step lookup makes query slow
Create index only table
![Page 27: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/27.jpg)
Index Table solution
Partially normalized table
Pros:- Query is fast- Table size is smallCons:- Depends heavily on Data access pattern
![Page 28: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/28.jpg)
Index Table solution
Combined key ‘Town’_’Name’
![Page 29: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/29.jpg)
Maintaining tables brings overhead Total table size will increase Data consistency issuesIndex skew problem
Index Table considerations
![Page 30: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/30.jpg)
Static Content Hosting problem – storing static content
cspkg
HTMLJava Script, CSS, Images
Request
DevOpsUserWeb site
![Page 31: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/31.jpg)
Static Content Hosting solution
cspkgHTML w/ link to content
request
DevOpsUser
cspkgJava Script, CSS, ImagesStatic content
Web site
CDN/Blob
![Page 32: Cloud Design Pattern part2](https://reader035.fdocuments.in/reader035/viewer/2022070600/589a1a3e1a28ab2a678b5795/html5/thumbnails/32.jpg)
Deployment and version controlVersion checkCache control/compressionStatic web siteEnable CORS for script
Static Content Hosting design considerations