1.24k likes | 1.47k Views
Patterns For Cloud Computing. David Gristwood Application Architect Microsoft http://blogs.msdn.com/david_gristwood / @ ScroffTheBad. Provide you with 5 patterns for cloud-based applications. Show implementations of these patterns. #1 - Using the Cloud for Scale.
E N D
Patterns For Cloud Computing David Gristwood Application Architect Microsoft http://blogs.msdn.com/david_gristwood/ @ScroffTheBad
Provide you with 5 patterns for cloud-based applications Show implementations of these patterns
#1 - Using the Cloud for Scale Patterns for Cloud Computing
#1 - Using the Cloud for Scale • “Wow! What a great site!” Database • Request Web Tier B/L Tier Browser • Response
#1 - Using the Cloud for Scale Browser Browser Database Web Tier B/L Tier Browser • “Server Busy” Browser Browser
#1 - Using the Cloud for Scale Browser Browser Database Web Tier B/L Tier Browser • “Timeout” Browser Browser
#1 - Using the Cloud for Scale How would you do this today on premises? Browser Web Tier N L B Browser Database Web Tier B/L Tier Browser Browser Web Tier Browser
#1 - Using the Cloud for Scale How would you do this today on premises? Browser B/L Tier N L B Browser Database Web Tier Browser B/L Tier Browser B/L Tier Browser
#1 - Using the Cloud for Scale How would you do this today on premises? Browser Web Tier N L B B/L Tier N L B Browser Database Web Tier Browser B/L Tier Browser Web Tier B/L Tier Browser
#1 - Using the Cloud for Scale How would you do this today on premises? Browser • p1 p2 p3 Web Tier N L B B/L Tier N L B Browser Database Web Tier Browser B/L Tier Browser Web Tier B/L Tier Browser
#1 - Using the Cloud for Scale How would you do this today on premises? Browser • p1 p2 p3 Web Tier N L B B/L Tier N L B Browser Database Web Tier Browser B/L Tier Browser Web Tier B/L Tier Browser • “That took a lot of time, effort and money!”
#1 - Using the Cloud for Scale How would you do this today on premises? • p1 p2 p3 • “Not so great now…” Web Tier N L B B/L Tier N L B Database Web Tier Browser B/L Tier Web Tier B/L Tier • “That took a lot of time, effort and money!” • “Hmmm... Most of this stuff is sitting idle...”
#1 - Using the Cloud for Scale • Datacenter peak load • Idle time • Usage • Jan • Apr • Jul • Oct
#1 - Using the Cloud for Scale • “Wow! What a great site!” Azure Storage • Request Web Role Worker Role Browser • Response
#1 - Using the Cloud for Scale Browser Browser Azure Storage Web Role Worker Role Browser • “Server Busy” Browser Browser
#1 - Using the Cloud for Scale Browser Web Role N L B Browser AzureStorage Web Role Worker Role Browser Browser Web Role Browser • You don’t see this bit
#1 - Using the Cloud for Scale Browser Web Role N L B Worker Role N L B Browser AzureStorage Web Role Browser Worker Role Browser Web Role Worker Role Browser
OK, so changing config is easy... …but what else do I need to know?
#1 - Using the Cloud for Scale Browser Web Role N L B Worker Role N L B Browser AzureStorage Web Role Browser Worker Role Browser Web Role Worker Role Browser
#1 - Using the Cloud for Scale Browser Web Role N L B Worker Role N L B Browser AzureStorage Web Role Browser Worker Role Browser Web Role Worker Role Browser • Tight coupling between web and worker role is an anti-pattern
#1 - Using the Cloud for Scale 4. Process Web Role Worker Role 2. Respond to UI Req 1. Place on queue 3. Pickup from queue Queue
#1 - Using the Cloud for Scale 4. Process Web Role Worker Role 5. Add result to table Req Queue 6. Query table on refresh Table
#1 - Using the Cloud for Scale WMI_Win32_PerfFormattedData_ASPNET_ASPNETApplications /RequestsPerSecond Browser Web Role N L B Browser AzureStorage Web Role Worker Role Browser Browser Web Role Browser Log Management API or Email Worker Role
#1 - Using the Cloud for Scale Web Role Web Role Web Role Worker Role Req Req Req Queue Web Role Web Role • Monitor queue • length against user’s expectations Web Role
#1 - Using the Cloud for Scale Worker Role Web Role Worker Role Web Role Worker Role Web Role Req Req Req Queue Worker Role Web Role Worker Role Web Role • Monitor queue • length against user’s expectations Worker Role Web Role
Patterns for Cloud Computing Takeaways A core tenet of cloud computing is the ability to scale up & down Understand how to communicate between roles and nodes Strategy on when to scale up/down roles in production
Patterns for Moving to the Cloud #2 - Using the Cloud for Multi-Tenancy
#2 - Using the Cloud for Multi Tenancy How would you do this today on premises? Database Web Tier B/L Tier Browser • Customer #1 Database Web Tier B/L Tier Browser • Customer #2 Database Web Tier B/L Tier Browser • Customer #3
#2 - Using the Cloud for Multi Tenancy What you really want is this: Browser • Customer #1 Database Web Tier B/L Tier Browser • Customer #2 Browser • Customer #3
#2 - Using the Cloud for Multi Tenancy Browser • Fixed Schema • Customer #1 Database Web Tier B/L Tier Browser • Customer #2 Browser • Option 1: Everyone Uses the Same Database/Schema • Customer #3 • Pros: Simplest approach, easy to maintain/upgrade. • Cons: No customizations. Restoring of tenant data.
#2 - Using the Cloud for Multi Tenancy Database Browser • Customer #1 • Customer #1 Database Web Tier B/L Tier Browser • Customer #2 • Customer #2 Database Browser • Customer #3 • Customer #3 • Option 2: Give Each Customer Their Own Database/Schema • Pros: Flexible. Tenant restore is easier. High Isolation. • Cons: Can be costly. Difficult to upgrade db schemas.
#2 - Using the Cloud for Multi Tenancy • Fixed Schema • with Customizations Browser • Customer #1 Database Web Tier B/L Tier Browser • Customer #2 Browser • Option 3: Fixed Database/Schema, with customizations • Customer #3 • Pros: Customers can add their own custom fields • Cons: Non standard way of customizing the schema. Tenant restore is difficult.
#2 - Using the Cloud for Multi Tenancy Tenant 1 * int TenantID nvarchar TenantName * * Type Employee int TypeID int EmployeeId nvarchar Name nvarchar FirstName nvarchar nvarchar CLRType LastName 1 1 Customization int CustomizationID * * nvarchar Value
#2 - Using the Cloud for Multi Tenancy Tenant 1 * int TenantID Fixed Schema Applies to All Tenants nvarchar TenantName * * Type Employee int TypeID int EmployeeId Customizable Tenant by Tenant Basis nvarchar Name nvarchar FirstName nvarchar nvarchar CLRType LastName 1 1 Customization int CustomizationID * * nvarchar Value
#2 - Using the Cloud for Multi Tenancy Tenant 1 * 1 TenantID UK Branch TenantName * * Type Employee 1 TypeID 1 EmployeeId PostalCode Name Gordon FirstName string Brown CLRType LastName 1 1 Customization 1 CustomizationID * * SW1A 2AA Value
#2 - Using the Cloud for Multi Tenancy Tenant 1 * 2 TenantID US Branch TenantName * * Type Employee 2 TypeID 2 EmployeeId ZipCode Name Barack FirstName string Obama CLRType LastName 1 1 Customization 2 CustomizationID * * 20500 Value
#2 - Using the Cloud for Multi Tenancy Browser • Customer #1 Database Web Tier B/L Tier Browser • Customer #2 Browser • Customer #3