Learn Cloud Design Patterns using Azure
Karthikeyan VK
Karthik_3030@yahoo.com
@karthik3030
https://blogs.karthikeyanvk.in
Enter Text
Why Cloud Design Patterns?
Availability & Resilience are hard in Cloud.
Performance and scalability are taken for granted in cloud.
Data management not a trivial Problem.
https://blogs.karthikeyanvk.in
Enter Text
Why Cloud Design Patterns?
 It provides Off-the-shelf solution.
Automatically handles quality attributes.
https://blogs.karthikeyanvk.in
Enter Text
What is Design Patterns ?
Design patterns are typical solutions to common problems in
software design.
Each pattern is like a blueprint that you can customize to solve a
particular design problem in your code.
https://blogs.karthikeyanvk.in
Enter Text
Name two design patterns you
know
https://blogs.karthikeyanvk.in
Enter Text
Principles based Design
https://blogs.karthikeyanvk.in
Enter Text
Why Principles ?
Not Technology Bound.
Helps decision-making process.
https://blogs.karthikeyanvk.in
Enter Text
Solid Principles
S- Single Responsibility
O – Open Close Principle
L – Liskov Principle
I – Interface segregation
D – Dependency Injection
https://blogs.karthikeyanvk.in
Enter Text
Solid Principles
S- Single Responsibility
https://blogs.karthikeyanvk.in
Enter Text
Solid Principles
O – Open Close Principle
https://blogs.karthikeyanvk.in
Enter Text
Solid Principles
L – Liskov Principle
https://blogs.karthikeyanvk.in
Enter Text
Solid Principles
I – Interface segregation
https://blogs.karthikeyanvk.in
Enter Text
Solid Principles
D – Dependency Injection
https://blogs.karthikeyanvk.in
Enter Text
Dependency injection facilitates ?
https://blogs.karthikeyanvk.in
Enter Text
Dependency injection facilitates
?
https://blogs.karthikeyanvk.in
Unit Testing
Enter Text
Cloud Design Principles
https://blogs.karthikeyanvk.in
Design for self healing.
Make all things redundant
Design to scale out
Partition around limits
Design for operations- Deployment, Monitoring, Incident
response, Auditing
Enter Text
Cloud Design Principles
https://blogs.karthikeyanvk.in
Design for Evolution.
Use the best data store for the Job
Build for the business needs. Think YAGNI
Enter Text
Why cloud applications should
be designed for self healing
https://blogs.karthikeyanvk.in
Enter Text
https://blogs.karthikeyanvk.in
Hardware failure is high in cloud because the hardware is treated
as cattle and not as pet.
Why cloud applications should
be designed for self healing
Enter Text
CQRS Pattern
Command Query Responsibility Segregation.
Command – Create/Update/Delete
Query – Select or Fetch
https://blogs.karthikeyanvk.in
Enter Text
CQRS Pattern
https://blogs.karthikeyanvk.in
Enter Text
Strangler Pattern
Incrementally migrate a legacy system by gradually replacing
specific pieces of functionality with new applications and
services.
https://blogs.karthikeyanvk.in
Enter Text
Strangler Pattern
https://blogs.karthikeyanvk.in
Enter Text
What kind of project we can use
strangler pattern.
https://blogs.karthikeyanvk.in
 Migration
 Green Field Projects
Enter Text
What kind of project we can use
strangler pattern.
https://blogs.karthikeyanvk.in
Migration Projects
 Migration
 Green Field Projects
Enter Text
Pipes and Filters pattern
Decompose a task that performs complex processing into a series
of separate elements that can be reused.
The processing required by an application can easily be broken
down into a set of independent steps.
Keep your classes DUMB
https://blogs.karthikeyanvk.in
Enter Text
Pipes and Filters pattern
https://blogs.karthikeyanvk.in
Enter Text
What kind of architecture the pipes and
filters pattern represent.
https://blogs.karthikeyanvk.in
 Asynchronous
 Synchronous
Enter Text
What kind of architecture the pipes and
filters pattern represent.
https://blogs.karthikeyanvk.in
 Asynchronous
 Synchronous
Asynchronous
Enter Text
Circuit Breaker Pattern
https://blogs.karthikeyanvk.in
Handle faults that might take a variable amount of time to
recover from, when connecting to a remote service or resource.
Three States – Open, Half-Open, Closed State.
Use POLLY – nugget package to implement. Straight forward
solution.
Enter Text
Circuit Breaker Pattern
https://blogs.karthikeyanvk.in
Enter Text
Three states of Circuit Breaker Pattern
https://blogs.karthikeyanvk.in
Enter Text
Three states of Circuit Breaker Pattern
https://blogs.karthikeyanvk.in
Open
Half Open
Closed
Enter Text
Compensating Transaction Pattern
https://blogs.karthikeyanvk.in
Undo the work performed by a series of steps, if one or more of
the steps fail.
A compensating transaction is application specific.
Enter Text
Compensating Transaction Pattern
https://blogs.karthikeyanvk.in
Used in places where there is an eventual consistency
Solves the No-SQL world problem with different data store in
Microservices
Enter Text
Where is Compensating Transaction pattern
used mostly
https://blogs.karthikeyanvk.in
 SQL World with strong transaction
 No-SQL world with poor transaction
Enter Text
Where is Compensating Transaction pattern
used mostly
https://blogs.karthikeyanvk.in
 SQL World with strong transaction
 No-SQL world with poor transaction
No-SQL
Enter Text
Static Content Hosting
https://blogs.karthikeyanvk.in
Deploy static content to a cloud-based storage service that can
deliver them directly to the client.
This can reduce the need for potentially expensive compute
instances.
Enter Text
Static Content Hosting
https://blogs.karthikeyanvk.in
Enter Text
Static Content Hosting
https://blogs.karthikeyanvk.in
May not be suitable in application that needs to perform some
processing on the static content before delivering it to the client.
For example, it might be necessary to add a timestamp to a
document
Enter Text
Gate-Keeper Pattern
https://blogs.karthikeyanvk.in
Protect applications and services by using a dedicated host
instance that acts as a broker between clients and the application
Validates and sanitizes requests, and passes requests and data
between them.
Enter Text
Gate-Keeper Pattern
https://blogs.karthikeyanvk.in
Enter Text
Event Sourcing Pattern
https://blogs.karthikeyanvk.in
Instead of storing just the current state of the data in a domain,
use an append-only store to record the full series of actions
taken on that data.
The events are persisted in an event store that acts as the system
of record (the authoritative data source) about the current state
of the data.
Enter Text
Event Sourcing Pattern
https://blogs.karthikeyanvk.in
Enter Text
Name one Event source ?
https://blogs.karthikeyanvk.in
Enter Text
Name one Event source ?
https://blogs.karthikeyanvk.in
Apache Kafka, Service Bus, Queue/Blob Storage
Enter Text
Sharding Pattern
https://blogs.karthikeyanvk.in
Divide a data store into a set of horizontal partitions or shards.
This can improve scalability when storing and accessing large
volumes of data.
Enter Text
Sharding Pattern
https://blogs.karthikeyanvk.in
Enter Text
Sidecar Pattern
https://blogs.karthikeyanvk.in
Deploy components of an application into a separate process or
container to provide isolation and encapsulation.
Applications and services often require related functionality, such
as monitoring, logging, configuration, and networking services
Enter Text
Sidecar Pattern
https://blogs.karthikeyanvk.in
Enter Text
Sidecar Pattern
https://blogs.karthikeyanvk.in
SSL Termination by application gateway.
Health monitoring is deployed as service in the host to be used
by multiple services.
Enter Text
Anti-Patterns
https://blogs.karthikeyanvk.in
Enter Text
Who is the best tester for our
applications?
https://blogs.karthikeyanvk.in
Enter Text
Who is the best tester for our
applications?
Actual app user
https://blogs.karthikeyanvk.in
Enter Text
Why Anti-Patterns ?
Application behaves well during all types of testing. But behaves
badly in production.
 The development team is then faced with two questions:
• Why didn't this behaviour show up during testing?
• How do we fix it?
https://blogs.karthikeyanvk.in
Enter Text
What is Anti-Patterns ?
Anti-Pattern is a common practice that is likely to cause problems
when an application is under pressure.
It's very difficult in a test environment to simulate real users.
https://blogs.karthikeyanvk.in
Enter Text
How to write business logic in
database itself
https://blogs.karthikeyanvk.in
Enter Text
How to write business logic in
database itself
https://blogs.karthikeyanvk.in
Stored Procedure
Enter Text
Busy Database Anti-Pattern
Offloading processing to a database server can cause it to spend
a significant proportion of time running code.
Remember stored procedures and triggers !
https://blogs.karthikeyanvk.in
Enter Text
No Caching Anti-Pattern
Repeatedly fetching the same information from a resource that is
expensive to access, in terms of I/O overhead.
Also think about stale data
Remember the expiring cache. Absolute or Sliding expiration.
Monitor your application and queries
https://blogs.karthikeyanvk.in
Enter Text
Name two levels of caching in
web application
https://blogs.karthikeyanvk.in
Enter Text
Name two levels of caching in
web application
https://blogs.karthikeyanvk.in
Http Cache.
External cache such as Redis
Enter Text
What is the problem with too
many microservices ?
https://blogs.karthikeyanvk.in
Enter Text
What is the problem with too
many microservices
Every microservices need to talk to each other a lot
https://blogs.karthikeyanvk.in
Enter Text
Chatty I/O Anti-Pattern
The cumulative effect of a large number of I/O requests can have
a significant impact on performance and responsiveness.
Packaging the data into larger, fewer requests
Problem seen in improper domain division in Microservices.
https://blogs.karthikeyanvk.in
Enter Text
Name the pattern where the
instance is created once
https://blogs.karthikeyanvk.in
Enter Text
Name the pattern where the
instance is created once
Singleton
https://blogs.karthikeyanvk.in
Enter Text
Improper Instantiation Anti-Pattern
It can hurt performance to continually create new instances of an
object that is meant to be created once and then shared.
Think about singleton pattern.
Always reuse System.Net.Http.HttpClient or any connection
related broker classes
https://blogs.karthikeyanvk.in
Enter Text
References
@karthik3030
• https://code-maze.com/liskov-substitution-principle/
• https://medium.com/@domagojk/patterns-for-designing-flexible-architecture-in-node-js-cqrs-
es-onion-7eb10bbefe17
• http://cloudgirl.tech/data-partitioning-vertical-horizontal-hybrid-partitioning/
• https://docs.microsoft.com/en-us/azure/architecture/patterns/
https://blogs.karthikeyanvk.in
Enter Text
Networking and more
@karthik3030
• https://www.facebook.com/aspiringDotnetArchitects/
• https://www.meetup.com/Chennai-Microsoft-Azure-User-Group/
• https://www.youtube.com/channel/UCJxa58lDcDj4tYQIHh7ORxA
https://blogs.karthikeyanvk.in
Enter Text
@karthik3030
Thank you
/Q&A
https://blogs.karthikeyanvk.in

Cloud Design Patterns

  • 1.
    Learn Cloud DesignPatterns using Azure Karthikeyan VK Karthik_3030@yahoo.com @karthik3030 https://blogs.karthikeyanvk.in
  • 2.
    Enter Text Why CloudDesign Patterns? Availability & Resilience are hard in Cloud. Performance and scalability are taken for granted in cloud. Data management not a trivial Problem. https://blogs.karthikeyanvk.in
  • 3.
    Enter Text Why CloudDesign Patterns?  It provides Off-the-shelf solution. Automatically handles quality attributes. https://blogs.karthikeyanvk.in
  • 4.
    Enter Text What isDesign Patterns ? Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can customize to solve a particular design problem in your code. https://blogs.karthikeyanvk.in
  • 5.
    Enter Text Name twodesign patterns you know https://blogs.karthikeyanvk.in
  • 6.
    Enter Text Principles basedDesign https://blogs.karthikeyanvk.in
  • 7.
    Enter Text Why Principles? Not Technology Bound. Helps decision-making process. https://blogs.karthikeyanvk.in
  • 8.
    Enter Text Solid Principles S-Single Responsibility O – Open Close Principle L – Liskov Principle I – Interface segregation D – Dependency Injection https://blogs.karthikeyanvk.in
  • 9.
    Enter Text Solid Principles S-Single Responsibility https://blogs.karthikeyanvk.in
  • 10.
    Enter Text Solid Principles O– Open Close Principle https://blogs.karthikeyanvk.in
  • 11.
    Enter Text Solid Principles L– Liskov Principle https://blogs.karthikeyanvk.in
  • 12.
    Enter Text Solid Principles I– Interface segregation https://blogs.karthikeyanvk.in
  • 13.
    Enter Text Solid Principles D– Dependency Injection https://blogs.karthikeyanvk.in
  • 14.
    Enter Text Dependency injectionfacilitates ? https://blogs.karthikeyanvk.in
  • 15.
    Enter Text Dependency injectionfacilitates ? https://blogs.karthikeyanvk.in Unit Testing
  • 16.
    Enter Text Cloud DesignPrinciples https://blogs.karthikeyanvk.in Design for self healing. Make all things redundant Design to scale out Partition around limits Design for operations- Deployment, Monitoring, Incident response, Auditing
  • 17.
    Enter Text Cloud DesignPrinciples https://blogs.karthikeyanvk.in Design for Evolution. Use the best data store for the Job Build for the business needs. Think YAGNI
  • 18.
    Enter Text Why cloudapplications should be designed for self healing https://blogs.karthikeyanvk.in
  • 19.
    Enter Text https://blogs.karthikeyanvk.in Hardware failureis high in cloud because the hardware is treated as cattle and not as pet. Why cloud applications should be designed for self healing
  • 20.
    Enter Text CQRS Pattern CommandQuery Responsibility Segregation. Command – Create/Update/Delete Query – Select or Fetch https://blogs.karthikeyanvk.in
  • 21.
  • 22.
    Enter Text Strangler Pattern Incrementallymigrate a legacy system by gradually replacing specific pieces of functionality with new applications and services. https://blogs.karthikeyanvk.in
  • 23.
  • 24.
    Enter Text What kindof project we can use strangler pattern. https://blogs.karthikeyanvk.in  Migration  Green Field Projects
  • 25.
    Enter Text What kindof project we can use strangler pattern. https://blogs.karthikeyanvk.in Migration Projects  Migration  Green Field Projects
  • 26.
    Enter Text Pipes andFilters pattern Decompose a task that performs complex processing into a series of separate elements that can be reused. The processing required by an application can easily be broken down into a set of independent steps. Keep your classes DUMB https://blogs.karthikeyanvk.in
  • 27.
    Enter Text Pipes andFilters pattern https://blogs.karthikeyanvk.in
  • 28.
    Enter Text What kindof architecture the pipes and filters pattern represent. https://blogs.karthikeyanvk.in  Asynchronous  Synchronous
  • 29.
    Enter Text What kindof architecture the pipes and filters pattern represent. https://blogs.karthikeyanvk.in  Asynchronous  Synchronous Asynchronous
  • 30.
    Enter Text Circuit BreakerPattern https://blogs.karthikeyanvk.in Handle faults that might take a variable amount of time to recover from, when connecting to a remote service or resource. Three States – Open, Half-Open, Closed State. Use POLLY – nugget package to implement. Straight forward solution.
  • 31.
    Enter Text Circuit BreakerPattern https://blogs.karthikeyanvk.in
  • 32.
    Enter Text Three statesof Circuit Breaker Pattern https://blogs.karthikeyanvk.in
  • 33.
    Enter Text Three statesof Circuit Breaker Pattern https://blogs.karthikeyanvk.in Open Half Open Closed
  • 34.
    Enter Text Compensating TransactionPattern https://blogs.karthikeyanvk.in Undo the work performed by a series of steps, if one or more of the steps fail. A compensating transaction is application specific.
  • 35.
    Enter Text Compensating TransactionPattern https://blogs.karthikeyanvk.in Used in places where there is an eventual consistency Solves the No-SQL world problem with different data store in Microservices
  • 36.
    Enter Text Where isCompensating Transaction pattern used mostly https://blogs.karthikeyanvk.in  SQL World with strong transaction  No-SQL world with poor transaction
  • 37.
    Enter Text Where isCompensating Transaction pattern used mostly https://blogs.karthikeyanvk.in  SQL World with strong transaction  No-SQL world with poor transaction No-SQL
  • 38.
    Enter Text Static ContentHosting https://blogs.karthikeyanvk.in Deploy static content to a cloud-based storage service that can deliver them directly to the client. This can reduce the need for potentially expensive compute instances.
  • 39.
    Enter Text Static ContentHosting https://blogs.karthikeyanvk.in
  • 40.
    Enter Text Static ContentHosting https://blogs.karthikeyanvk.in May not be suitable in application that needs to perform some processing on the static content before delivering it to the client. For example, it might be necessary to add a timestamp to a document
  • 41.
    Enter Text Gate-Keeper Pattern https://blogs.karthikeyanvk.in Protectapplications and services by using a dedicated host instance that acts as a broker between clients and the application Validates and sanitizes requests, and passes requests and data between them.
  • 42.
  • 43.
    Enter Text Event SourcingPattern https://blogs.karthikeyanvk.in Instead of storing just the current state of the data in a domain, use an append-only store to record the full series of actions taken on that data. The events are persisted in an event store that acts as the system of record (the authoritative data source) about the current state of the data.
  • 44.
    Enter Text Event SourcingPattern https://blogs.karthikeyanvk.in
  • 45.
    Enter Text Name oneEvent source ? https://blogs.karthikeyanvk.in
  • 46.
    Enter Text Name oneEvent source ? https://blogs.karthikeyanvk.in Apache Kafka, Service Bus, Queue/Blob Storage
  • 47.
    Enter Text Sharding Pattern https://blogs.karthikeyanvk.in Dividea data store into a set of horizontal partitions or shards. This can improve scalability when storing and accessing large volumes of data.
  • 48.
  • 49.
    Enter Text Sidecar Pattern https://blogs.karthikeyanvk.in Deploycomponents of an application into a separate process or container to provide isolation and encapsulation. Applications and services often require related functionality, such as monitoring, logging, configuration, and networking services
  • 50.
  • 51.
    Enter Text Sidecar Pattern https://blogs.karthikeyanvk.in SSLTermination by application gateway. Health monitoring is deployed as service in the host to be used by multiple services.
  • 52.
  • 53.
    Enter Text Who isthe best tester for our applications? https://blogs.karthikeyanvk.in
  • 54.
    Enter Text Who isthe best tester for our applications? Actual app user https://blogs.karthikeyanvk.in
  • 55.
    Enter Text Why Anti-Patterns? Application behaves well during all types of testing. But behaves badly in production.  The development team is then faced with two questions: • Why didn't this behaviour show up during testing? • How do we fix it? https://blogs.karthikeyanvk.in
  • 56.
    Enter Text What isAnti-Patterns ? Anti-Pattern is a common practice that is likely to cause problems when an application is under pressure. It's very difficult in a test environment to simulate real users. https://blogs.karthikeyanvk.in
  • 57.
    Enter Text How towrite business logic in database itself https://blogs.karthikeyanvk.in
  • 58.
    Enter Text How towrite business logic in database itself https://blogs.karthikeyanvk.in Stored Procedure
  • 59.
    Enter Text Busy DatabaseAnti-Pattern Offloading processing to a database server can cause it to spend a significant proportion of time running code. Remember stored procedures and triggers ! https://blogs.karthikeyanvk.in
  • 60.
    Enter Text No CachingAnti-Pattern Repeatedly fetching the same information from a resource that is expensive to access, in terms of I/O overhead. Also think about stale data Remember the expiring cache. Absolute or Sliding expiration. Monitor your application and queries https://blogs.karthikeyanvk.in
  • 61.
    Enter Text Name twolevels of caching in web application https://blogs.karthikeyanvk.in
  • 62.
    Enter Text Name twolevels of caching in web application https://blogs.karthikeyanvk.in Http Cache. External cache such as Redis
  • 63.
    Enter Text What isthe problem with too many microservices ? https://blogs.karthikeyanvk.in
  • 64.
    Enter Text What isthe problem with too many microservices Every microservices need to talk to each other a lot https://blogs.karthikeyanvk.in
  • 65.
    Enter Text Chatty I/OAnti-Pattern The cumulative effect of a large number of I/O requests can have a significant impact on performance and responsiveness. Packaging the data into larger, fewer requests Problem seen in improper domain division in Microservices. https://blogs.karthikeyanvk.in
  • 66.
    Enter Text Name thepattern where the instance is created once https://blogs.karthikeyanvk.in
  • 67.
    Enter Text Name thepattern where the instance is created once Singleton https://blogs.karthikeyanvk.in
  • 68.
    Enter Text Improper InstantiationAnti-Pattern It can hurt performance to continually create new instances of an object that is meant to be created once and then shared. Think about singleton pattern. Always reuse System.Net.Http.HttpClient or any connection related broker classes https://blogs.karthikeyanvk.in
  • 69.
    Enter Text References @karthik3030 • https://code-maze.com/liskov-substitution-principle/ •https://medium.com/@domagojk/patterns-for-designing-flexible-architecture-in-node-js-cqrs- es-onion-7eb10bbefe17 • http://cloudgirl.tech/data-partitioning-vertical-horizontal-hybrid-partitioning/ • https://docs.microsoft.com/en-us/azure/architecture/patterns/ https://blogs.karthikeyanvk.in
  • 70.
    Enter Text Networking andmore @karthik3030 • https://www.facebook.com/aspiringDotnetArchitects/ • https://www.meetup.com/Chennai-Microsoft-Azure-User-Group/ • https://www.youtube.com/channel/UCJxa58lDcDj4tYQIHh7ORxA https://blogs.karthikeyanvk.in
  • 71.

Editor's Notes

  • #4 Performance  Maintainability Interoperability Modifiability Usability Testability Reliability Scalability Availability Reusability Security Supportability
  • #8 a natural law like gravity. It’s different than a value. Values are subjective; principles are objective. Gravity… if you drop something, gravity controls
  • #15 Use partitioning to work around database, network, and compute limits
  • #16 Use partitioning to work around database, network, and compute limits
  • #17 Use partitioning to work around database, network, and compute limits
  • #18 Use partitioning to work around database, network, and compute limits
  • #19 Use partitioning to work around database, network, and compute limits
  • #20 Use partitioning to work around database, network, and compute limits
  • #24 This pattern may not be suitable: When requests to the back-end system cannot be intercepted. For smaller systems where the complexity of wholesale replacement is low. Testing problem.
  • #25 Use partitioning to work around database, network, and compute limits
  • #26 Use partitioning to work around database, network, and compute limits
  • #27 Design your class to be dumb
  • #28 Design your class to be dumb Complexity. Idempotency. Repeated messages. Think of poison queue
  • #29 Use partitioning to work around database, network, and compute limits
  • #30 Use partitioning to work around database, network, and compute limits
  • #32 Exception handling and failing should be properly thought through.. Logging should be made proper and don’t log toomuch This pattern isn't recommended: For handling access to local private resources in an application, such as in-memory data structure. In this environment, using a circuit breaker would add overhead to your system. As a substitute for handling exceptions in the business logic of your applications.
  • #33 Use partitioning to work around database, network, and compute limits
  • #34 Use partitioning to work around database, network, and compute limits
  • #35 Product and order example
  • #36 Product and order example
  • #37 Use partitioning to work around database, network, and compute limits
  • #38 Use partitioning to work around database, network, and compute limits
  • #39 Where is your angular application deployed in azure ?
  • #41 But js and api call will work