0
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Patterns for Scalability in
Microsoft Azure App...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Huge thanks to our sponsors & partners!
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Alex Mang
• CEO @ KeyTicket Solutions
–Micros...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Common requirements for cloud apps:
–Availabi...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Performance
–‘indication of responsiveness of...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Performance and Scalability Patterns
Cache-asid...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
QUEUE-BASED LOAD LEVELING
PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Queue-Based Load Leveling Pattern (Context)
• C...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Queue-Based Load Leveling Pattern (Solution)
• ...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Queue-Based Load Leveling Pattern (Solution)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Queue-Based Load Leveling Pattern (Consid.)
• M...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
COMPETING CONSUMERS PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Asynchronously process requests
• The number ...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Competing Consumers Pattern (Solution)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Competing Consumers Pattern (Considerations)
• ...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
PRIORITY QUEUE PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Asynchronous processing via queues
–Queues ca...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Queues with different priorities
• Consumers ...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Priority Queue Pattern (Solution)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Priority Queue Pattern (Considerations)
• What ...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Priority Queue Pattern (When To Use)
Push firs...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Priority Queue Pattern (When NOT To Use)
Messa...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
DEMO
PRIORITY QUEUE PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
THROTTLING PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Throttling Pattern (Context)
• Cloud applicatio...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Throttling Pattern (Solution)
• Auto-scaling, f...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Throttling Pattern (Solution)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Throttling Pattern (Solution)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Throttling Pattern (Considerations)
• Architect...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Throttling Pattern (When To Use)
• Meet SLA
• P...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
DEMO
THROTTLING PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Throttling Pattern (Demo)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
MATERIALIZED VIEW PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Most developers think about how data is
store...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
• Generate views in advance, containing data
on...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Materialized View Pattern (Solution)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Materialized View Pattern (When To Use)
Querie...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Materialized View Pattern (When NOT To Use)
Da...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
DEMO
MATERIALIZED VIEW PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Materialized View Pattern (Demo)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
COMMAND AND QUERY
RESPONSIBILITY SEGREGATION
PA...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (Context)
• Traditional CRUD syste...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (Context)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (Context)
• Many concurrent connec...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (Solution)
• Segregate read (queri...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (Solution)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (Considerations)
• Additional comp...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (When To Use)
Multiple concurrent...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CQRS Pattern (When NOT To Use)
Simple business...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
SHARDING PATTERN
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Sharding Pattern (Context)
• Why scale out comp...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Sharding Pattern (Solution)
• Horizontal partit...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Sharding Pattern (Solution)
• Lookup strategy• ...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Strategy Advantages Considerations
Lookup • Mor...
Premium community conference on Microsoft technologies itcampro@ itcamp14#
THANK YOU!
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Q & A
Upcoming SlideShare
Loading in...5
×

Patterns for Scalability in Windows Azure Applications (Alex Mang)

191

Published on



So you've learned what elasticity means and why it is important to consider scalability in your cloud application architecture. But how can you easily manage your code in order to implement all the theories around scalability?

During this session, I will talk and demo the most common patterns used when designing a cloud application: the valet key pattern, the sharding pattern, the materialized view pattern, the event sourcing pattern and the CQRS pattern.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
191
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Patterns for Scalability in Windows Azure Applications (Alex Mang)"

  1. 1. Premium community conference on Microsoft technologies itcampro@ itcamp14# Patterns for Scalability in Microsoft Azure Applications Alex Mang http://alexmang.ro @mangalexandru
  2. 2. Premium community conference on Microsoft technologies itcampro@ itcamp14# Huge thanks to our sponsors & partners!
  3. 3. Premium community conference on Microsoft technologies itcampro@ itcamp14#
  4. 4. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Alex Mang • CEO @ KeyTicket Solutions –Microsoft BizSpark Plus • Azure Advisor • MS, MCP, MCSD Speaker.Bio.ToString()
  5. 5. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Common requirements for cloud apps: –Availability –Data management –Design and implementation –Messaging –Management and monitoring –Performance and scalability –Resiliency –Security What are patterns?
  6. 6. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Performance –‘indication of responsiveness of a system to execute any action within a given time interval’ • Scalability –‘ability of a system to handle increases in load without impact on performance’ Performance and Scalability Patterns = ??? = ???
  7. 7. Premium community conference on Microsoft technologies itcampro@ itcamp14# Performance and Scalability Patterns Cache-aside Competing consumersCQRS Event sourcing Index table Materialized view Priority Queue Queue based load leveling Sharding Static content Throttling
  8. 8. Premium community conference on Microsoft technologies itcampro@ itcamp14# QUEUE-BASED LOAD LEVELING PATTERN
  9. 9. Premium community conference on Microsoft technologies itcampro@ itcamp14# Queue-Based Load Leveling Pattern (Context) • Cloud app require external services • High load on cloud app means high load on services • External services may be less scalable • High load on cloud app could result in failing external services • Possible self-throttling
  10. 10. Premium community conference on Microsoft technologies itcampro@ itcamp14# Queue-Based Load Leveling Pattern (Solution) • Force the processing of request inside a queue • Thus, load-leveled service requests • Additional advantage: queue also works as a buffer
  11. 11. Premium community conference on Microsoft technologies itcampro@ itcamp14# Queue-Based Load Leveling Pattern (Solution)
  12. 12. Premium community conference on Microsoft technologies itcampro@ itcamp14# Queue-Based Load Leveling Pattern (Consid.) • Make sure services are scaled correctly • Task senders may wait service replies
  13. 13. Premium community conference on Microsoft technologies itcampro@ itcamp14# COMPETING CONSUMERS PATTERN
  14. 14. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Asynchronously process requests • The number of concurrent requests over time varies • The time required for processing varies Competing Consumers Pattern (Context)
  15. 15. Premium community conference on Microsoft technologies itcampro@ itcamp14# Competing Consumers Pattern (Solution)
  16. 16. Premium community conference on Microsoft technologies itcampro@ itcamp14# Competing Consumers Pattern (Considerations) • Ordering • Poisoned messages • Result handling • Message queue scaling • Reliability
  17. 17. Premium community conference on Microsoft technologies itcampro@ itcamp14# PRIORITY QUEUE PATTERN
  18. 18. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Asynchronous processing via queues –Queues can’t sort messages (most of the times) • Push notification (15K) vs. e-mail (15K) Priority Queue Pattern (Context)
  19. 19. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Queues with different priorities • Consumers based on queue priority Priority Queue Pattern (Solution)
  20. 20. Premium community conference on Microsoft technologies itcampro@ itcamp14# Priority Queue Pattern (Solution)
  21. 21. Premium community conference on Microsoft technologies itcampro@ itcamp14# Priority Queue Pattern (Considerations) • What is ‘high priority’ vs ‘low priority’ • (Single pool consumers) high first, low after • (Single pool consumers) elevate old messages • Multiple queues work best for less priority definitions
  22. 22. Premium community conference on Microsoft technologies itcampro@ itcamp14# Priority Queue Pattern (When To Use) Push first, send after example Multi-tenant applications Different SLAs / customers
  23. 23. Premium community conference on Microsoft technologies itcampro@ itcamp14# Priority Queue Pattern (When NOT To Use) Messages have similar priority No burst of messages in the queue ever exists Costs must be kept down
  24. 24. Premium community conference on Microsoft technologies itcampro@ itcamp14# DEMO PRIORITY QUEUE PATTERN
  25. 25. Premium community conference on Microsoft technologies itcampro@ itcamp14# THROTTLING PATTERN
  26. 26. Premium community conference on Microsoft technologies itcampro@ itcamp14# Throttling Pattern (Context) • Cloud application load varies –# active users (mostly during work hours) –Type of activities (analysis at end of month) • Sudden unanticipated bursts –Poor performance –Eventual failures • SLA requirements
  27. 27. Premium community conference on Microsoft technologies itcampro@ itcamp14# Throttling Pattern (Solution) • Auto-scaling, for starters… • Define resource soft limits • Monitor resource usage • Throttle users –Based on business impact (tiers / plans) –Based on users’ concurrent requests • Degrade functionality • Load-leveling pattern / priority-queue pattern
  28. 28. Premium community conference on Microsoft technologies itcampro@ itcamp14# Throttling Pattern (Solution)
  29. 29. Premium community conference on Microsoft technologies itcampro@ itcamp14# Throttling Pattern (Solution)
  30. 30. Premium community conference on Microsoft technologies itcampro@ itcamp14# Throttling Pattern (Considerations) • Architectural decision: consider it while designing • Quick monitoring technique • Notify accordingly
  31. 31. Premium community conference on Microsoft technologies itcampro@ itcamp14# Throttling Pattern (When To Use) • Meet SLA • Prevent single user monopolize everything • Gracefully handle activity bursts • Control costs by limiting max. resource usage
  32. 32. Premium community conference on Microsoft technologies itcampro@ itcamp14# DEMO THROTTLING PATTERN
  33. 33. Premium community conference on Microsoft technologies itcampro@ itcamp14# Throttling Pattern (Demo)
  34. 34. Premium community conference on Microsoft technologies itcampro@ itcamp14# MATERIALIZED VIEW PATTERN
  35. 35. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Most developers think about how data is stored • In NoSQL, we usually store everything in a single entity • In SQL, we have size constraints • End-up in: –Performance impact –High prices Materialized View Pattern (Context)
  36. 36. Premium community conference on Microsoft technologies itcampro@ itcamp14# • Generate views in advance, containing data on a per-requirement basis • Only contain data required by query • Include current values of calculated columns or data items • May be optimized for a single query • Updated a.s.a.p. (schedule / triggered) Materialized View Pattern (Solution)
  37. 37. Premium community conference on Microsoft technologies itcampro@ itcamp14# Materialized View Pattern (Solution)
  38. 38. Premium community conference on Microsoft technologies itcampro@ itcamp14# Materialized View Pattern (When To Use) Queries are complex Data difficult to query directly Temporary views dramatically improve perf. Temporary views act as DTOs for UI, reporting etc. Data store not always available Security or privacy reasons
  39. 39. Premium community conference on Microsoft technologies itcampro@ itcamp14# Materialized View Pattern (When NOT To Use) Data source is simple to query Data changes quickly Consistency is most important
  40. 40. Premium community conference on Microsoft technologies itcampro@ itcamp14# DEMO MATERIALIZED VIEW PATTERN
  41. 41. Premium community conference on Microsoft technologies itcampro@ itcamp14# Materialized View Pattern (Demo)
  42. 42. Premium community conference on Microsoft technologies itcampro@ itcamp14# COMMAND AND QUERY RESPONSIBILITY SEGREGATION PATTERN
  43. 43. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (Context) • Traditional CRUD system do everything over the same data store • Typically, same entity for DB <--> UI <--> DB
  44. 44. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (Context)
  45. 45. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (Context) • Many concurrent connections  FAIL • Complex business logic  FAIL • Too much data passed around • Performance impact @ high load, due to complex querying • Security issues may arise
  46. 46. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (Solution) • Segregate read (queries) from write (commands) • Models for querying and for updating are different • Possible to access same store, better not to
  47. 47. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (Solution)
  48. 48. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (Considerations) • Additional complexity • Consistency considerations • CQRS for parts of the application • Use in conjuction with Event Source pattern
  49. 49. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (When To Use) Multiple concurrent operations Already familiar with Domain-Driven- Design techniques Read performance ≠ write performance Different teams (read vs. write) App. lifecycle: model update, business logic update
  50. 50. Premium community conference on Microsoft technologies itcampro@ itcamp14# CQRS Pattern (When NOT To Use) Simple business rules Simple CRUD-style UI are enough Across the whole system
  51. 51. Premium community conference on Microsoft technologies itcampro@ itcamp14# SHARDING PATTERN
  52. 52. Premium community conference on Microsoft technologies itcampro@ itcamp14# Sharding Pattern (Context) • Why scale out compute, and not scale out data? • Must scale out data because: –Storage limitations –Concurrent requests –Network bandwidth –Geography
  53. 53. Premium community conference on Microsoft technologies itcampro@ itcamp14# Sharding Pattern (Solution) • Horizontal partitions of data –(a.k.a. shards) • Same schema, different data • Runs on its own server • Benefits: –Scale out data service –Use commodity hardware –Better performance –Closely located geographically
  54. 54. Premium community conference on Microsoft technologies itcampro@ itcamp14# Sharding Pattern (Solution) • Lookup strategy• Range strategy• Hash strategy
  55. 55. Premium community conference on Microsoft technologies itcampro@ itcamp14# Strategy Advantages Considerations Lookup • More control • Easy shard rebalance • Shard lookup may create additional overhead Range • Easy to implement • Works well on range queries • Easy management • Suboptimal balance • Shard rebalance is difficult Hash • Best balance • Request routing directly via hashing alg. • Calculating hash may create additional overhead • Rebalance is difficult Sharding Pattern (Solution)
  56. 56. Premium community conference on Microsoft technologies itcampro@ itcamp14# THANK YOU!
  57. 57. Premium community conference on Microsoft technologies itcampro@ itcamp14# Q & A
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×