Más contenido relacionado La actualidad más candente (20) Similar a Leverage Azure and SQL Azure to build SaaS applications (20) Leverage Azure and SQL Azure to build SaaS applications 1. Leverage Azure and SQL Azure to
build SaaS applications
(Lander Case).
Juan De Abreu
jdeabreu@getcs.com
© Copyright 2011 Common Sense2011 Common Sense LLC
© Copyright LLC www.GetCS.com #CSWebinar www.GetCS.com
2. Twitter
# csWebinar
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
3. Agenda
• Considerations
• Azure Overview
• Aspects we need to be prepared for
• Lander Application
• Summary and Q&A
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
4. Considerations
• Get out of the infrastructure business
• Subscription Payment Model: Pay as you go
• Obtain elastic IT Capacity: Pay as you grow / peak
• High Availability, (SLA).
• Reduce Upfront Cost, Storage Cost.
• Improve time to market.
• Rapid Innovation. Quick Update Cycles.
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
5. Azure Overview
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
6. Azure Solution Architecture
Network Load Balancer
SQL
Web Worker
Role Role
Your Services SQL
Internet
Queues
Blobs SQL
Tables
Your Storage
SQL Azure
Windows Azure Services Services
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
7. Aspects we need to be prepared for
• Partition the Application
• Queues
• Units of Scale
• Load Balancer (Prepare for Failure)
• No server Affinity
• No sticky session
• Stateless
• Resources are Shared
• Scaling
• Compute
• Storage
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
8. Partition of the application
Prepare to Scale Out
Async, loosely
coupled services
Monolithic Sales
Inventory
Application Orders
Begin Transaction Soft Reservation Msg Sync
Check Inventory If Succeed
Create Order Begin Transaction
Reserve Inventory Create Order
Commit Transaction Create Message
Commit Transaction Begin Transaction
End If DeQueue Msg
Firm Soft Reserve
Commit Transaction
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
9. Queue Management
Web Role Worker Role
Instance 1 Instance 1 Busy
Instance 1 Instance 1 Free
Instance 1 Instance 1 Busy
Put Message
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
10. Queue Management
Web Role Worker Role
Instance 1 Instance 1 Busy
Get Message
Instance 1 Instance 1 Free
Instance 1 Instance 1 Busy
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
11. Working with queues
• Methods
• GetMessage = 1 REST call one message read
• GetMessages(32) = 1 REST call up to 32 messages
read.
• Dynamic Delay based on Traffic
• Operational Cost
1 year, 24h/day, 10 GetMessage call per second
= $315,36
1 year, 24h/day, 1 GetMessage call per minute
= $0,52
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
12. Units of Scale Pattern
• Scaling Should Be done in units
• A unit-of-Scale is a combination of components in
multiple layers
• Application Instances and a database should be
considered as a unit-of-scale
• If you add more compute instances you should add
database/storage
• Not necessary 1 to 1, but you should know how many
instances a database can handle and add if needed.
• Consider all mechanisms that have different scaling
behavior, Queues, storage, blob drive IO,
bandwidth…etc.
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
13. Load Balancer
Network Load Balancer
Web
Role 1
Round
Robin
Web
Role 2
Web
Role 3
Your Services
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
14. Prepare for failure
• Stateless
• No server Affinity
• Do not write data to the local filesystem
• Write Data to Azure Storage
• No sticky session
• Avoid use session variables
• Store State in SQL Azure
• Redirect session state to AppFabric Caching
• Resources are Shared
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
15. Scaling Compute
321654
6
1.00987
98756
3
App 1.5567546 DB
7
0.68976
0
Add or Define Metrics and polling intervals
Reduces
the Scaling Engine
instances
count Changes de configuration
Configuration
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
16. Scaling Storage
• Azure Storage supports huge volume tables
• Table schema is part of your application
• Huge Capacity
• 100TB of storage per storage account
• 5 storage accounts per subscription
• Need of partitioning your tables to have a good
response time
• Azure will move Hot Partitions to separate nodes
to Achieve SLA’s
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
17. Azure tables
Tables are partitioned to
support load balancing
across storage nodes
partition key
Unique
row key
timestamp
table
field1
field2
field3
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
18. Table Partitioning
A 1 foo bar etc
A 2 foo bar etc
B 1 foo bar etc
Partition A Partition B
A 1 foo bar etc B 1 foo bar etc
A 2 foo bar etc
Storage node 1 Storage node 2
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
19. SQL Azure Throttling /retry logic
• Sharing a SQL Server node means Throttling to
protect the other customers.
• A connection to a SQL Azure Could be dropped
unexpectedly.
• Before issuing a command against a connection
check if is still open, reopen it if close.
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
20. Lander
Publish View
Landing Page Landing Page
Presentation
Commands Queries
WRITE
READ
Events
Domain Model Query Model
Landing Page
Published
Relational DB Query Store
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
21. Lander and Windows Azure
Admin Presentation State Consumer Presentation
Azure Web Role Azure Web Role Query Model
Commands App Fabric
Azure Queue Cache Service
Azure Worker Role
Command Handlers
Domain Model Event Handlers
Azure Worker Role Events
Azure Queue
Relational DB Query Store
Azure SQL Azure Blob
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
22. Summary
• Multiple benefits by going to the cloud
High Availability, Elasticity, Low Cost
Scalability and Performance
Upgradability
• Multiple design patters considerations to reach de
benefits
Application partitioning
A sync architecture using queues
Units of scale
Stateless applications, cache management
Data partitioning
Retry logic on SQL Azure.
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar
23. Thanks
Juan De Abreu
jdeabreu@getcs.com
Twitter: juandeabreu
Ph: 210 8073552 x 1702
Cell: 210 3862492
© Copyright 2011 Common Sense LLC www.GetCS.com #CSWebinar