Architecting to be Cloud Native - PowerPoint PPT Presentation

architecting to be cloud native n.
Skip this Video
Loading SlideShow in 5 Seconds..
Architecting to be Cloud Native PowerPoint Presentation
Download Presentation
Architecting to be Cloud Native

play fullscreen
1 / 66
Architecting to be Cloud Native
Download Presentation
Download Presentation

Architecting to be Cloud Native

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. HELLO my name is Architecting to be Cloud Native Bill Wilder Aligning your application’s architecture with the architecture of the cloud… FTW! But the cloud is a friendly place for non-native apps too! Guest lecture at Dino Konstantopoulos’ BU MET CS755 Cloud Computing class 17-April-2014 (7:00 – 9:00 PM EDT)

  2. My name is Bill Wilder HELLO my name is Bill Wilder @codingoutloud

  3. Who is Bill Wilder?

  4. I will ass-u-me… • You know what “the cloud” is • You have an inkling about Amazon Web Services and Windows Azure cloud platforms • You understand that such cloud platforms include compute services [like hosted virtual machines (VMs), in both IaaS and PaaS modes], SQL and NoSQL database services, file storage services, messaging, DNS, management, etc. • You are interested in understanding cloud-native applications and why that’s better than deploying my old-school app to the cloud “as is”

  5. Roadmap for rest of talk… … • Lightning-fast overview of Windows Azure • Cover three specific patterns for building cloud-native applications • Mention some other patterns along the way • Q&A during talk is okay (time permitting) • Q&A at end with any remaining time • Okay to reach out through email or twitter ?

  6. Windows Azure Portal General information Management Portal

  7. “Bring Your Own” ____as aService  SaaS less Responsibility & Flexibility PaaS Most productive platforms for Cloud-Native Apps more  IaaS NIST:

  8. NIST Terminology Power? Rigidity • SaaS = Software as a Service (BYO users) • PaaS = Plaform as a Service (BYO apps) • IaaS = Infrastructure as a Service (BYO VMs) Simplicity Complexity Flexibility Power?

  9. But Why? So Architecting for the (Windows Azure, AWS, GAE, …) Cloud is Different… WHY DID THEY (Microsoft, Amazon, Google, …) DO THIS TO US?

  10. Know the rules • Faster horses would not haveaddressed the horse manure problem • …late 1800s.. 150k horses in NYC x 20 lbs manure/day/horse • = 3 million lbs of manure per day “If I had asked people what they wanted, they would have said faster horses.” - Henry Ford

  11. Know the rules “If I had asked IT departments what they wanted, they would have said IaaS.” - Henry Cloud

  12. Cloud Platform Characteristics • Scaling – or “resource allocation” – is horizontal • and ∞ (“illusion of infinite resources”) • Resources are easily added or released • self-service portal or API; cloud scaling is automatable • Pay only for currently allocated resources • costs are operational, granular, controllable, and transparent • Optimized for cost-efficiency • cloud services are MT, hardware is commodity • MTTR over MTTF • Rich, robust functionality is simply accessible • like an iceberg

  13. 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

  14. The definition of “Cloud” is nebulous… The term “cloud” is nebulous…

  15. What's different about the cloud? What is different about the cloud? public ^

  16. 1/9th above water SOA = TTM & Sleeping well

  17. MTBF MTTR Architectural Assumptions failure is routine (so you better be good at handling it) commodity hardware + multitenant services = cost-efficient cloud

  18. Loosely Coupled & Eventually Consistent Data & Workflow Architecture

  19. This bar is always open*and* has an API Pay by the Drink $

  20. • Resource allocation (scaling) is: • Horizontal • Bi-directional • Automatable The “illusion of infinite resources” Resource Allocation

  21. Integrated Surface Area

  22. • 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 are simply not good fit for cloud. ?

  23. • Simple idea, simple app • Two-tiers: web tier (one server) + database • What can go wrong • We’ll reexamine • Scaling the web tier • Scaling the service tier • Scaling the data tier • Handling failure • Operational efficiency (scale the app, not the team!)

  24. Horizontal Scaling Compute Pattern pattern 1 of 3

  25. ? What’s the difference between performance and scale?

  26. Scale Up (and Scale Down??)vs. Horizontal Resourcing Common Terminology: Scaling Up/Down  Vertical Scaling Scaling Out/In  Horizontal “Scaling”  But really is Horizontal Resource Allocation • Architectural Decision • Big decision… hard to change

  27. 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)

  28. Scaling Horizontally: Adding Boxes Autonomous 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 the CLOUD works *and* This is how YOUR CLOUD-NATIVE APP WORKS

  29. Example: Web Tier Managed VMs(Cloud Service) Load Balancer (Cloud Service)

  30. Horizontal Scaling Considerations • Auto-Scale • Bidirectional • Nodes can fail • Auto-Scale is only one cause • Handle shutdown signals • Stateless (“like a taxi”)vs. Sticky Sessions • Stateless nodesvs. Stateless apps • N+1 rule vs. occasional downtime (UX)

  31. ? How many users does your cloud-native application need before it needs to be able to horizontally scale?

  32. Queue-Centric Workflow Pattern pattern 2 of 3 (QCW for short)

  33. Extend www.pageofphotos.comexample 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)

  34. QCW Example: User Uploads Photo Web Server Compute Service Reliable Queue Reliable Storage

  35. QCW WE NEED: • Compute (VM) resources to run our code • Reliable Queue to communicate • Durable/Persistent Storage

  36. Where does Windows Azure fit?

  37. 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

  38. QCW on Azure: User Uploads a Photo push pull Web Role (IIS) Worker Role Azure Queue Azure Blob UX implications: user does not wait for thumbnail (architecture!)

  39. 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

  40. 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 Unitsright • Key to optimizing operational CO$T$

  41. General Case: Many Roles, Many Queues Worker Role Web Role (Admin) Worker Role Worker Role Worker Role Type 1 Queue Type 1 Queue Type 1 Web Role (Public) Queue Type 2 Web Role (IIS) Queue Type 2 Worker Role Web Role (IIS) Worker Role Worker Role Worker Role Type 2 Queue Type 3 Worker Role Type 2 Worker Role Type 2 Worker Role Type 2 • Scaling best when Investment αBenefit • Optimize for CO$T EFFICIENCY • Logical vs. Physical Architecture depends on current scale

  42. Reliable Queue & 2-step Delete varurl = “<guid>.png”;queue.AddMessage( new CloudQueueMessage( url ) ); (IIS) Web Role Worker Role Queue varinvisibilityWindow = TimeSpan.FromSeconds( 10 );CloudQueueMessagemsg =queue.GetMessage( invisibilityWindow ); (… do some processing then …) queue.DeleteMessage( msg );

  43. 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

  44. QCW expects Poison Messages • A Poison Message cannot be processed • Error condition for non-transient reason • Use dequeue count property • Be proactive • Falling off the queue may kill your system • Determine a Max Retry policy per queue • Delete, put on “bad” queue, alert human, …

  45. 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 support needed important • Event Sourcing (commonly seen with CQRS) may help • Not an exception case! Expect it! • Consider N+1 Rule

  46. What’s Up? Reliability as EMERGENT PROPERTY

  47. 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

  48. Database Sharding Pattern pattern 3 of 3

  49. Database Sharding PatternMost Cloud Applications don’t care (much) about (very high) scaleBut they do care about developer productivity and operational efficiency pattern 3 of 3