joan wortman architecting for the cloud bill wilder an app in the cloud is not a cloud-native app...
TRANSCRIPT
![Page 1: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/1.jpg)
HELLO
my name is
Joan
Wortman
Architecting for the Cloud
HELLOmy name isBill Wilder
An App in the Cloud is not
a Cloud-Native App
Boston Code Camp #1908-Mar-2013 (2:50 – 4:00 PM EDT)
![Page 2: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/2.jpg)
Who is Bill Wilder?
www.devpartners.com
www.bostonazure.org
www.cloudarchitecturepatterns.com
![Page 3: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/3.jpg)
Roadmap for this talk… …
1. Define relevant “cloud” types from software development point of view
2. App in the Cloud != Cloud App (or at least not a Cloud-Native App)
3. What could go wrong?4. Consider UX factors
?
![Page 4: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/4.jpg)
The term “cloud” is nebulous…
The term “cloud” is nebulous…
![Page 5: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/5.jpg)
___________________ as a Service
Apps, $/user,
Expertise, SLAApp Services as OpEx,
OS, DBMS, etc. with patching & upgrades,Environment Monitoring,
Expertise, SLA
Virtualized Hardware as OpEx, Networking, Automation, Elasticity,
Price Transparency, Global Data Centers, Expertise, SLA
IaaS
PaaS
SaaSSoftwareInfrastructurePlatform
BYOUsers
BYO Apps
BYO VMs
Publ
ic Clo
ud R
enta
l Mod
els
AppHarbor
http://csrc.nist.gov/publications/nistpubs/800-145/SP800-145.pdf
![Page 6: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/6.jpg)
“Bring Your Own” ____ as a Service
BYO UsersBYO
Applications
BYO Virtual Machines
PaaS
IaaS
SaaS
more
less
Responsibility &
Flexibility
![Page 7: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/7.jpg)
What is different about the cloud?
What is different about the cloud?
![Page 8: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/8.jpg)
1/9th above w
ater
TTM & Sleeping well=
![Page 9: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/9.jpg)
MTBF MTTR
multitenant services+ commodity hardware
= cost-efficient cloud
![Page 10: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/10.jpg)
This bar is always open
*and*
has an APIPay by the Drink
![Page 11: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/11.jpg)
∞
• Resource allocation (scaling) is:– Horizontal– Bi-directional– Automatable
• The “illusion of infinite resources”
![Page 12: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/12.jpg)
Cloud-Native Application Characteristics
• Application architecture is aligned with the cloud platform architecture–uses the platform in the most natural way– lets the platform do the heavy lifting
![Page 13: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/13.jpg)
• 3- or N-tier, SOA• Multi-data center• Horizontal scaling• Expects failure• PaaS
Traditional Cloud-Native
• 2-tier• Single data center• Vertical scaling• Ignores failure• Hardware or IaaS
• Less flexible• More manual/attention• Less reliable (SPoF)• Maintenance window• Less scalable
• Agile/faster TTM• Auto-scaling• Self-healing• HA• Geo-LB/FO
TELL
S/CL
UES
CON
SEQ
UEN
CES
Tells: Traditional vs Cloud-Native
Which is “best” architecture?
There is no “best” architecture – it is situational, depending on technical and business context.Not every application should be cloud-native.
Traditional architectures are fine for many apps.
Cloud-native popularity growing in proportion to the shrinking cost
and competitive benefits.
![Page 14: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/14.jpg)
Putting Cloud Services to work
Putting the cloud to work
![Page 15: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/15.jpg)
www.pageofphotos.com• Simple idea, simple app• Two-tiers: web tier (one server) + database• What’s the problem?
• But… what’s WRONG with this architecture?
• Different ≠ WRONG. Use the right tool for the job. Some apps simply not good fit for cloud.
?
![Page 16: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/16.jpg)
www.pageofphotos.com• Simple idea, simple app• Two-tiers: web tier (one server) + database• What can go wrong
• We’ll reexamine1. Scaling the web tier2. Scaling the service tier3. Scaling the data tier4. Handling failure5. Operational efficiency (scale the app, not the team!)
![Page 17: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/17.jpg)
Horizontal Scaling Compute Pattern
pattern 1 of 5
![Page 18: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/18.jpg)
![Page 19: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/19.jpg)
Common Terminology:Scaling Up/Down Vertical ScalingScaling Out/In Horizontal “Scaling” But really is Horizontal Resource Allocation
• Architectural Decision– Big decision… hard to change
Scale Up (and Scale Down??)vs. Horizontal Resourcing
![Page 20: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/20.jpg)
Vertical Scaling (“Scaling Up”)
.
Resources that can be “Scaled Up”• Memory: speed, amount • CPU: speed, number of CPUs• Disk: speed, size, multiple controllers• Bandwidth: higher capacity pipe• … and it sure is EASY
Downsides of Scaling Up• Hard Upper Limit• HIGH END HARDWARE HIGH END CO$T• Lower value than “commodity hardware”• May have no other choice (architectural)
![Page 21: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/21.jpg)
Scaling Horizontally: Adding BoxesAutonomous nodes
for scalability(stateless web servers, shared
nothing DBs, your custom code in
QCW)
Autonomous nodes*and*
Homogeneous nodes for operational simplicity
*and*Anonymous nodes
don‘t get emotionally involved!
This is how a [public] CLOUD PLATFORM works *and*
This is how YOUR CLOUD-NATIVE app works
![Page 22: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/22.jpg)
Load Balancer(Cloud Service)
Managed VMs(Cloud Service)
“Web Role”
Example: Web Tier www.pageofphotos.com
![Page 23: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/23.jpg)
1. Auto-Scale • Bidirectional
2. Nodes can fail• Auto-Scale is only one cause• Handle shutdown signals• Stateless (“like a taxi”)
vs. Sticky Sessions• Stateless nodes
vs. Stateless apps• N+1 rule
vs. occasional downtime (UX)
Horizontal Scaling Considerations
![Page 24: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/24.jpg)
What’s the difference between performance
and scale??
![Page 25: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/25.jpg)
Do Performance and Scale Matter?
System Responsiveness*
Users perception
0.1 Seconds feeling of instantaneous response
1 Second user's flow of thought seamless
10 Seconds start thinking about other things
* NNG 1993 - http://www.nngroup.com/articles/website-response-times/** Kissmetrics - http://blog.kissmetrics.com/loading-time/
> 3 seconds 40% of visitors abandon**
![Page 26: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/26.jpg)
Bottom line for your business
* Kissmetrics - http://blog.kissmetrics.com/loading-time/
3.8%
LostRevenue
Reduced Clicks
00:00:02Delay
![Page 27: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/27.jpg)
• Elastic Scaling–Peak usage–Data analysis
![Page 28: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/28.jpg)
• During Super Bowl 2013– Anticipated network spike– Scaled to 200 clusters– Millions of tags
• After – Scaled back
![Page 29: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/29.jpg)
• Aug 2012 Obama Ask Me Anything• Spike in traffic crashed the site
• 2,987,307 page views • 30 dedicated servers overwhelmedhttp://blog.reddit.com/2012/08/potus-iama-stats.html
![Page 30: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/30.jpg)
Queue-Centric Workflow Pattern
(QCW for short)
pattern 2 of 5
![Page 31: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/31.jpg)
Extend www.pageofphotos.com example into Service Tier
• QCW enables applications where the UI and back-end services are Loosely Coupled
• (Compare to CQRS at end if there is interest)
![Page 32: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/32.jpg)
QCW Example: User Uploads Photo www.pageofphotos.com
Web Server
Compute ServiceReliable Queue
Reliable Storage
![Page 33: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/33.jpg)
QCW
WE NEED:• Compute (VM) resources to run our code
• Reliable Queue to communicate
• Durable/Persistent Storage
![Page 34: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/34.jpg)
Where does Windows Azure fit?
![Page 35: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/35.jpg)
QCW [on Windows Azure]
WE NEED:• Compute (VM) resources to run our code
Web Roles (IIS) and Worker Roles (w/o IIS)• Reliable Queue to communicate
Azure Storage Queues• Durable/Persistent Storage
Azure Storage Blobs & Tables; WASD
![Page 36: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/36.jpg)
QCW on Azure: User Uploads a Photo
WebRole(IIS)
WorkerRoleAzure Queue
Azure Blob
UX implications: how does user know thumbnail is ready?
ww
w.p
ageo
fpho
tos.
com
push pull
![Page 37: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/37.jpg)
QCW enables Responsive UX
• Response to interactive users is as fast as a work request can be persisted
• Time consuming work done asynchronously• Comparable total resource consumption,
arguably better subjective UX• UX challenge – how to express Async to users?
– Communicate Progress– Display Final results– Long Polling/Web Sockets (e.g., SignalR or Node.io)
![Page 38: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/38.jpg)
QCW enables Scalable App
• Decoupled front/back provides insulation– Blocking is Bane of Scalability– Order processing partner doing maintenance– Twitter down– Email server unreachable– Internet connectivity interruption
• Loosely coupled, concern-independent scaling– (see next slide)– Get Scale Units right
–Key to optimizing operational CO$T$
![Page 39: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/39.jpg)
General Case: Many Roles, Many Queues
WebRole(IIS)
WorkerRole
WebRole(IIS)
WebRole
(Public)
WorkerRoleWorker
RoleWorker
Role Type 1
WorkerRoleWorker
RoleWorkerRoleWorker
Role Type 2
Queue Type 1
Queue Type 2
Queue Type 1
Queue Type 2
Queue Type 3
• Scaling best when Investment α Benefit• Optimize for CO$T EFFICIENCY
• Logical vs. Physical Architecture depends on current scale
WorkerRole
Type 2
WorkerRole
Type 2
WorkerRole
Type 2
WebRole
(Admin)
![Page 40: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/40.jpg)
Reliable Queue & 2-step Delete
(IIS)WebRole
WorkerRole
var url = “http://pageofphotos.blob.core.windows.net/up/<guid>.png”;queue.AddMessage( new CloudQueueMessage( url ) );
var invisibilityWindow = TimeSpan.FromSeconds( 10 );CloudQueueMessage msg = queue.GetMessage( invisibilityWindow );
(… do some processing then …)queue.DeleteMessage( msg );
Queue
![Page 41: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/41.jpg)
QCW requires Idempotent
• Perform idempotent operation more than once, end result same as if we did it once
• Example with Thumbnailing (easy case)• App-specific concerns dictate approaches
– Compensating action, Last write wins, etc.• PARTNERSHIP: division of responsibility
between cloud platform & app– Far cry from database transaction
![Page 42: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/42.jpg)
QCW expects Poison Messages
• A Poison Message cannot be processed– Error condition for non-transient reason– Check CloudQueueMessage.DequeueCount
property• Falling off the queue may kill your system• Determine a Max Retry policy per queue
– Delete, put on “bad” queue, alert human, …
![Page 43: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/43.jpg)
QCW requires “Plan for Failure”
• VM restarts will happen– Hardware failure, O/S patching, crash (bug)
• Bake in handling of restarts into our apps– Restarts are routine: system “just keeps working”– Idempotent mindset is key– Event Sourcing (commonly seen with CQRS) may
help• Not an exception case! Expect it!• Consider N+1 Rule
![Page 44: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/44.jpg)
Typical Site Any 1 Role Inst Overall System
Operating System Upgrade
Application Code Update
Scale Up, Down, or In
Hardware Failure
Software Failure (Bug)
Security Patch
What’s Up? Reliability as EMERGENT PROPERTY
![Page 45: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/45.jpg)
Aside: Is QCW same as CQRS?
• Short answer: “no”• CQRS
– Command Query Responsibility Segregation
• Commands change state• Queries ask for current state• Any operation is one or the other• Sometimes includes Event Sourcing• Sometimes modeled using Domain Driven
Design (DDD)
![Page 46: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/46.jpg)
What about the Data?
• You: Azure Web Roles and Azure Worker Roles– Taking user input, dispatching work, doing work– Follow a decoupled queue-in-the-middle pattern– Stateless compute nodes
• Cloud: “Hard Part”: persistent, scalable data– Azure Queue & Blob Services– Three copies of each byte– Blobs are geo-replicated– Busy Signal Pattern
![Page 47: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/47.jpg)
What about the Users?No direct connection between user’s action and system’s reaction
User Experience Challenge• System Status • Keep user informed about what’s going on• Appropriate feedback in reasonable amount of
time
![Page 48: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/48.jpg)
LIE…in a good way• Uploading video files to FB
– Block users w/status indicator– Upload and conversion
• Stack Overflow – My post is cached– Delay for others
![Page 49: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/49.jpg)
Badges and Notifications
![Page 50: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/50.jpg)
Confirmations
• Amazon tells you your order was taken, but doesn’t mean you own it yet…– They recheck inventory – Send email confirmation
• Credit card/Cell bills– Post next business day
• Airline reservations– Some will even tell you how many seats left
![Page 51: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/51.jpg)
Polling
![Page 52: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/52.jpg)
Database Sharding Pattern
pattern 3 of 5
![Page 53: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/53.jpg)
Extend www.pageofphotos.com example into Data Tier
• What happens when demands on data tier grow?
• The Database Sharding Pattern a little about reliability – a lot about scale and performance
![Page 54: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/54.jpg)
Foursquare is a Social Network
![Page 55: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/55.jpg)
Foursquare #Fail
• October 4, 2010 – trouble begins…• After 17 hours of downtime over two days…
“Oct. 5 10:28 p.m.: Running on pizza and Red Bull. Another long night.”
WHAT WENT WRONG?
![Page 56: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/56.jpg)
What is Sharding?
• Problem: one database can’t handle all the data– Too big, not performant, needs geo distribution, …
• Solution: split data across multiple databases– One Logical Database, multiple Physical Databases
• Each Physical Database Node is a Shard• Most scalable is Shared Nothing design
– May require some denormalization (duplication)
![Page 57: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/57.jpg)
All shard have same schema
SHARDS
![Page 58: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/58.jpg)
Sharding is Difficult
• What defines a shard? (Where to put stuff?)– Example – use country of origin: customer_us,
customer_fr, customer_cn, customer_ie, …– Use same approach to find records (can use lookup)
• What happens if a shard gets too big?– Rebalancing shards can get complex– Foursquare case study is interesting
• How to query / join / transact across shards• Cache coherence, connection pool management
– Roll-your-own challenge
![Page 59: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/59.jpg)
Where does Windows Azure fit?
![Page 60: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/60.jpg)
Windows Azure SQL Database (WASD)is SQL Server Except…
Common
SQL ServerSpecific(for now)
WASDSpecific
“Just change the connection
string…”
• Full Text Search• Transparent Data
Encryption (TDE)• Many more…
Limitations• 150 GB size limit• Busy Signal PatternExtra Capabilities• Managed Service• Highly Available• Rental model• Federations
http://msdn.microsoft.com/en-us/library/ff394115.aspxAdditional information on Differences:
![Page 61: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/61.jpg)
Windows Azure SQL Databse Federations for Sharding
• Single “master” database– “Query Fanout” makes partitions transparent– Instead of customer_us, customer_fr, etc… we are back to customer
database• Handles redistributing shards• Handles cache coherence• Simplifies connection pooling
• No MERGE (yet); SPLIT only• Bonus feature for Multitenant Applications
USE FEDERATION myfed (myfedkey = 911) WITH FILTERING=ON RESET
• http://blogs.msdn.com/b/cbiyikoglu/archive/2011/01/18/sql-azure-federations-robust-connectivity-model-for-federated-data.aspx
![Page 62: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/62.jpg)
Foursquare #Fail
Foursquare was implementing database sharding in the application layer. WASD Federations makes this unnecessary.
WHAT WENT WRONG?
![Page 63: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/63.jpg)
My database instance is limited to 150 GB.
∞ ∞ ∞Does that mean the
cloud doesn’t really offer the illusion of infinite
resources??
![Page 64: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/64.jpg)
Busy Signal Pattern
pattern 4 of 5
![Page 65: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/65.jpg)
Auto-Scaling Pattern
pattern 5 of 5
![Page 66: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/66.jpg)
in conclusion
In Conclusion
![Page 67: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/67.jpg)
Know the rules
“Know the rules well, so you can break them effectively.”
- Dalai Lama XIV
![Page 68: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/68.jpg)
Further Information
Windows Azurehttp://windowsazure.com/
Boston Azure User Grouphttp://bostonazure.org/
Cloud Architecture Patternshttp://cloudarchitecturepatterns.com/
![Page 70: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/70.jpg)
Business Card
![Page 71: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/71.jpg)
My name is Bill Wilder
[email protected] ·· www.devpartners.com
www.cloudarchitecturepatterns.comcommunity
@bostonazure ·· www.bostonazure.org@codingoutloud ·· blog.codingoutloud.com ·· [email protected]
HELLO
my name is
Bill Wilder
![Page 72: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/72.jpg)
Questions?Comments?
More information?
?
![Page 73: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/73.jpg)
![Page 74: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/74.jpg)
DONE
![Page 75: Joan Wortman Architecting for the Cloud Bill Wilder An App in the Cloud is not a Cloud-Native App Boston Code Camp #19 08-Mar-2013 (2:50 – 4:00 PM EDT)](https://reader037.vdocuments.us/reader037/viewer/2022110100/56649dcf5503460f94ac3efc/html5/thumbnails/75.jpg)