SlideShare una empresa de Scribd logo
1 de 54
Descargar para leer sin conexión
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Stephen Liedig
Senior Solutions Architect, WWPS (ANZ), Amazon Web Services
Breaking Down the Monowhat?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
About Me
Senior Solutions Architect
WWPS - Australia and New Zealand
@sliedigaws
in/sliedig/
Stephen Liedig
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The Monowhat
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
https://imagescart.blogspot.com.au/2013/03/ayers-rock-in-uluru-national-park.html#.Wwp1DFOFMZo
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
The Monolith
“…a single-tiered software application in which the user
interface and data access code are combined into a single
program from a single platform. A monolithic application
is self-contained, and independent from other computing
applications.”
- Wikipedia
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Where did they all come from?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monolith = “Traditional” Applications
• Applications developed to “best practices” and
standards of the time
• Monolith <> poorly designed
• Applications didn’t need to be or weren’t designed to
be distributed
• Application design constrained by resources
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monolith = “Traditional” Applications
Pros:
• At first…
o Simple
o No over-engineering
• In-process latencies
• Single codebase
• Resource efficient at small
scale
Cons:
• Modularity is hard to
enforce as app grows
• Can only scale up!
• All or nothing deployment
• Database dependencies
• Long release cycles
• Slow to react to customer
demand
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
2001
Development transformation at Amazon: 2001+
2001+
monolithic
application + teams
microservices + 2 pizza teams
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monolith development lifecycle
developers
releasetestbuild
delivery pipelineapp
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Single-purpose
Connect only through APIs
Connect over HTTPS
Largely “black boxes” to
each other
Microservices
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Microservice development lifecycle
developers delivery pipelinesservices
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
> 60 million deployments a year*
Thousands of teams
× Microservice architecture
× Continuous delivery
× Multiple environments
*2016 number
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Conway’s Law
“…organizations which design systems ... are constrained
to produce designs which are copies of the
communication structures of these organizations…”
— M. Conway
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Microservices
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What microservices are…
“…the microservice architectural style is an approach to
developing a single application as a suite of small services,
each running in its own process and communicating with
lightweight mechanisms, often an HTTP resource API…”
- Martin Fowler
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What microservices are…
“Independently deployable services that work together,
modelled around a business domain…”
-Sam Newman
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What microservices are not…
Defined by the number of lines of code
Services that only have subroutines (calculation or a validation) are
functions, not a service
Services that only expose CRUD operations are RPC call to a
database, not a service
REST / SOAP provide common interfaces for integration but don’t
change the logical responsivity of the implementation
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What microservices are…
“The technical authority for a business capability”
- Udi Dahan
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Shipping
Inventory
Customer
Service
Accounts
Returns
Invoicing
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How?
Shipping
Inventory
Customer
Service
?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Domain Driven Design
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Domain Driven Design
“Ubiquitous language” –Modelling the
language of the business
Provides guidance about model domains
with entities, value objects, repositories
and services
Top Tip!
Start reading from Chapter 11: Strategic
Design vs Tactical Design
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Bounded Contexts
• Bounded Contexts are an
essential modeling tool in DDD
and microservices
• Identify explicit boundaries
around our understanding of the
ubiquitous language and the
things people care about
• Multiple models for a business
concept
https://www.martinfowler.com/bliki/BoundedContext.html
Customer
Ticket
Product
Product
Version
Customer
Product
Territory
Opportunity
Pipeline
Sales
Person
Defect
Sales Context Support Context
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Multiple Bounded Contexts
Concept
Contracting with
authors
Managing the
book’s authorship
and editorial
process
Designing the book
layout, including
illustrations
Source: Implementing Domain-Driven Design, Vaughn Vernon
Publishing Example: Book model
Translating the
book into other
languages
Producing the
physical print and/
or electronic
editions
Marketing the book
Selling the book to
resellers and/ or
directly to
consumers
Shipping a physical
book to resellers
and consumer
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Context Maps
Bounded contexts alone don’t provide a global
view of your domain
Context maps deal with mapping different, but
related, Ubiquitous Languages by integrating
their Bounded Contexts
Evans and Vernon describe 7 patterns for
integrating bounded contexts
• Shared Kernel
• Customer / Supplier
• Conformist
• Anticorruption Layer
• Separate Ways
• Open / Host Service
• Published Language
Sales Context Support Context
Marketing Context
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Domain Events
• Objects in a domain that represent that something has happened
• Immutable – cannot change the past
• Should be represented as verbs in the past tense, e.g.
“customer_created”
• Light weight, correlated by properties that are common across
bounded contexts “customer_id”
• Pattern for bounded context integration - Publish / Subscribe
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Coupling
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Managing Dependencies
Loose Coupling / High Cohesion
Encapsulation
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Types of coupling
• Afferent (Ca) and Efferent (Ce)
Measurement units of the degree of coupling
Who depends on you?… Who do you depend on?
• Platform Coupling
May be introduced by things like proprietary protocols or
components that are platform specific
• Temporal Coupling
Dealing with time-based dependencies between
collaborating system components, e.g. waiting
operations or sequential processing
• Spatial Coupling
Not having to know the location of your collaborating
services on the network and providing failover
mechanisms, e.g. Amazon Elastic Load Balancer
A B
A B
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
There is no loose coupling…
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
There is no loose coupling…
• Coupling is a function of
multiple dimensions
• No loose or tight
• Need to make tradeoffs
Platform
Spatial
TemporalAfferent
Efferent
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Messaging & Messaging Patterns
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon SQS Amazon SNS
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon SQS
WHAT IT IS
Simple, flexible, fully
managed message
queuing service for
reliably and
continuously
exchanging any
volume of messages
from anywhere
USE CASE
Build decoupled,
highly scalable
microservices,
distributed systems,
and serverless
applications in the
cloud
COOL CAPABILITIES
Nearly infinite
scalability and ability
to increase message
throughput without
pre-provisioning
capacity
> aws sqs create-queue --queue-name MyQueue
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon SQS as an Event Source (SQSaaES)
• Lambda polls the queue and when it detects new
messages, it invokes your Lambda function by
passing the messages as an event
• Full control over the queue processing settings
such as visibility timeouts, delay queues, redrive
policy, etc. Supports batch processing
• Lambda will gradually increase the queue polling
rate as long as queue polling results in fetching
of new messages
• Supports Identity and Resource based policy3. Lambda invoked
Lambda
function
SQS
Queue
2. Pull messages
from queue
1. Message arrives
on queue
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon SNS
WHAT IT IS
Simple, flexible, fully
managed
publish/subscribe
messaging and
mobile push
notification service
for high throughput,
highly reliable
message delivery
USE CASE
Push messages to a
variety of endpoints
and clients in
distributed systems,
microservices, and
serverless
applications and
enable event-driven
architecture
COOL CAPABILITIES
Highly reliable
delivery of any
volume of messages
to any number of
recipients across
multiple protocols
> aws sns create-topic --name my-topic
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Publish / Subscribe
• One logical publisher for a given domain event
• Fully enforces a consistent boundary
• Addresses multiple types of coupling
SNS
Topic
Service B
Service C
Service D
Service A
• Each subscriber can react to
domain events in their own
bounded context
• SNS supports multiple
subscription channels – Lambda,
SQS, HTTP/S, Email, SMS, Mobile
Push
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Mapping events to topics
Grey
Topic
Attr=
Blue
Grey
Publisher
Blue
Topic
Blue
Grey
Blue
Blue
Grey
Subscribers
Service C
Service D
Service E
Service F
Message type mapped to logical destination
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon SNS Message Filters
• Publishers do not need to route message
• Subscribers do not need to filter for message of interest
• Lowers cost
SNS
Topic
Attr=
Grey
Attr=
Blue
Attr=
Blue
Attr=
Grey
Attr=
Blue
Attr=
Grey
Filter Policy
Attr=Grey
Filter Policy
Attr=Blue
Publisher
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Message Filtering Operators
Subscription filter policy
{"sport": ["rugby"]}
matches message attribute
{"sport": "rugby"}
Exact matching on string
values (Whitelisting)
Anything-but matching on
string values (Blacklisting)
Prefix matching on
string values
Exact matching on
numeric values
Range matching on
numeric values
Subscription filter policy
{"sport": [{"anything-but":
"rugby"}]}
matches message attributes such as
{"sport": "baseball"}
and
{"sport": "basketball"}
and
{"sport": "football"}
but not
{"sport": "rugby"}
Subscription filter policy
{"sport": [{"prefix": "bas"}]}
matches message attributes such as
{"sport": "baseball"}
and
{"sport": "basketball"}
Subscription filter policy
{"balance": [{"numeric":
["=", 301.5]}]}
matches message attributes
{"balance": 301.500}
and
{"balance": 3.015e2}
Subscription filter policy
{"balance": [{"numeric":
["<", 0]}]}
matches negative numbers only, and
{"balance": [{"numeric":
[">", 0, "<=", 150]}]}
matches any positive number up to 150.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Long Running Processes
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Coordination by Function Chaining
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
“I want
try/catch/finally”
“I want to
select tasks based on data”
“I want to
retry failed tasks”
A
B C
A
?
“I want to
sequence tasks”
BA
“I want to
run tasks in parallel”
CBA
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Step Functions
…makes it easy to coordinate the
components of distributed
applications using visual workflows
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Step Functions
“Serverless” workflow management with
zero administration
• Coordinate the components of distributed
applications and microservices using visual
workflows
• Keeps the orchestration out of the code!
• State management
• Automatically triggers and tracks each step,
and retries when there are errors
• Logs the state of each step, so when things do
go wrong, you can diagnose and debug
problems quickly
Task
Choice
Fail
Parallel
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Distributed Transactions & Saga Pattern
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What are Sagas?
• Pattern for dealing with “long-lived transactions” (Garcia-Molina,
Salem 1987)
• Challenges dealing with transactions in a distributed system - no
transaction coordinator!
• Time is not consistent. Time is contextual.
• Semantic consistency by providing compensating transactions for
every transaction where you have more than one collaborating
services or functions
• Failure management pattern
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Applying Saga pattern with AWS Step Functions
https://theburningmonk.com/2017/07/applying-the-saga-pattern-with-aws-lambda-and-step-functions/
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Microservices messaging patterns
One-Way
Lambda
function
SQS Queue
Return Address
SQS QueueLambda
function
Request / Response
Lambda
function
SQS Queue
SNS
Topic
Service B
Service C
Service D
Service A
Publish / Subscribe
request
response
request
response
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Final thoughts
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Microviews
• Don’t forget about the user
interface!
• If a microservice is the technical
authority for a business capability
then it is also the authority on how
interacts with the user
• Leverage composite user interfaces
B
A
C D
E
A B C D E
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
https://imagescart.blogspot.com.au/2013/03/ayers-rock-in-uluru-national-park.html#.Wwp1DFOFMZo
Summary
Chances are YAGNI! Not everyone needs Microservices. If you have a well defined
domain then you don’t have to break the monolith apart entirely.
Lead your microservices strategy from strategic perspective. Model your
microservices around business capabilities.
Consider a monolith-first approach. Identify your bounded contexts first.
Don’t use a big bang approach. It’s an evolutionary journey.
Leverage messaging services and publish subscribe patterns to provide strict
boundaries around your bounded contexts and use them to manage coupling
inside your application.
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Thank you

Más contenido relacionado

La actualidad más candente

AWS AI and Machine Learning Journey
AWS AI and Machine Learning JourneyAWS AI and Machine Learning Journey
AWS AI and Machine Learning Journey
Amazon Web Services
 
The Secret Treasures of Cloud Migration Journey
The Secret Treasures of Cloud Migration JourneyThe Secret Treasures of Cloud Migration Journey
The Secret Treasures of Cloud Migration Journey
Amazon Web Services
 
Elevate your security with the cloud
Elevate your security with the cloudElevate your security with the cloud
Elevate your security with the cloud
Amazon Web Services
 
進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲
進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲
進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲
Amazon Web Services
 
AWS 預測性維護與智慧物聯應用
AWS 預測性維護與智慧物聯應用AWS 預測性維護與智慧物聯應用
AWS 預測性維護與智慧物聯應用
Amazon Web Services
 

La actualidad más candente (20)

AWS AI and Machine Learning Journey
AWS AI and Machine Learning JourneyAWS AI and Machine Learning Journey
AWS AI and Machine Learning Journey
 
Strengthen Your Organizations Security and Privacy.pdf
Strengthen Your Organizations Security and Privacy.pdfStrengthen Your Organizations Security and Privacy.pdf
Strengthen Your Organizations Security and Privacy.pdf
 
AWS 2019 Taipei Summit - Building Serverless Analytics Platform on AWS
AWS 2019 Taipei Summit - Building Serverless Analytics Platform on AWSAWS 2019 Taipei Summit - Building Serverless Analytics Platform on AWS
AWS 2019 Taipei Summit - Building Serverless Analytics Platform on AWS
 
Preparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/MLPreparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/ML
 
The Secret Treasures of Cloud Migration Journey
The Secret Treasures of Cloud Migration JourneyThe Secret Treasures of Cloud Migration Journey
The Secret Treasures of Cloud Migration Journey
 
AWS Webinar - Becoming a Cloud-First Healthcare Provider
AWS Webinar - Becoming a Cloud-First Healthcare Provider AWS Webinar - Becoming a Cloud-First Healthcare Provider
AWS Webinar - Becoming a Cloud-First Healthcare Provider
 
De un monolito a microservicios
De un monolito a microserviciosDe un monolito a microservicios
De un monolito a microservicios
 
Elevate your security with the cloud
Elevate your security with the cloudElevate your security with the cloud
Elevate your security with the cloud
 
Driving Digital Transformation for Citizen Services
Driving Digital Transformation for Citizen Services  Driving Digital Transformation for Citizen Services
Driving Digital Transformation for Citizen Services
 
Migrating_Large_Scale_Data_Sets_to_the_Cloud
Migrating_Large_Scale_Data_Sets_to_the_CloudMigrating_Large_Scale_Data_Sets_to_the_Cloud
Migrating_Large_Scale_Data_Sets_to_the_Cloud
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
AWS Initiate Day Dublin 2019 – Breaking down the Monoliths
AWS Initiate Day Dublin 2019 – Breaking down the MonolithsAWS Initiate Day Dublin 2019 – Breaking down the Monoliths
AWS Initiate Day Dublin 2019 – Breaking down the Monoliths
 
進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲
進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲
進化中的遊戲產業-以微服務架構-全球布局與現代化資料庫策略來打造高成長遊戲
 
Building Data Lakes and Analytics on AWS
Building Data Lakes and Analytics on AWSBuilding Data Lakes and Analytics on AWS
Building Data Lakes and Analytics on AWS
 
Education : Digital transformation & AWS Foundations
Education : Digital transformation & AWS FoundationsEducation : Digital transformation & AWS Foundations
Education : Digital transformation & AWS Foundations
 
Microservices and Serverless for MegaStartups
Microservices and Serverless for MegaStartupsMicroservices and Serverless for MegaStartups
Microservices and Serverless for MegaStartups
 
Stages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete Migration	Stages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete Migration
 
AWS Initiate Day Dublin 2019 – Migrating Data to the Cloud
AWS Initiate Day Dublin 2019 – Migrating Data to the CloudAWS Initiate Day Dublin 2019 – Migrating Data to the Cloud
AWS Initiate Day Dublin 2019 – Migrating Data to the Cloud
 
AWS 預測性維護與智慧物聯應用
AWS 預測性維護與智慧物聯應用AWS 預測性維護與智慧物聯應用
AWS 預測性維護與智慧物聯應用
 
Elevate_your_security_with_the_cloud
Elevate_your_security_with_the_cloudElevate_your_security_with_the_cloud
Elevate_your_security_with_the_cloud
 

Similar a Breaking Down the Monowhat

Similar a Breaking Down the Monowhat (20)

Breaking Down the 'Monowhat'
Breaking Down the 'Monowhat'Breaking Down the 'Monowhat'
Breaking Down the 'Monowhat'
 
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
When, how and if to adopt Microservices, AWS Startup Day Cape Town 2018
 
以容器技術為基礎的混合雲設計架構
以容器技術為基礎的混合雲設計架構以容器技術為基礎的混合雲設計架構
以容器技術為基礎的混合雲設計架構
 
Containers for Startups
Containers for StartupsContainers for Startups
Containers for Startups
 
2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd
 
Implementing Microservices by DDD
Implementing Microservices by DDDImplementing Microservices by DDD
Implementing Microservices by DDD
 
From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018
From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018
From Monolith to Modern Apps: Best Practices (SRV322-R2) - AWS re:Invent 2018
 
Microservices for Startups
Microservices for StartupsMicroservices for Startups
Microservices for Startups
 
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
Building Microservices with Containers (CON308-R1) - AWS re:Invent 2018
 
Making Hybrid Work for You: Getting into the Cloud Fast (GPSTEC308) - AWS re:...
Making Hybrid Work for You: Getting into the Cloud Fast (GPSTEC308) - AWS re:...Making Hybrid Work for You: Getting into the Cloud Fast (GPSTEC308) - AWS re:...
Making Hybrid Work for You: Getting into the Cloud Fast (GPSTEC308) - AWS re:...
 
Ripping off the Bandage: Re-Architecting Traditional Three-Tier Monoliths to ...
Ripping off the Bandage: Re-Architecting Traditional Three-Tier Monoliths to ...Ripping off the Bandage: Re-Architecting Traditional Three-Tier Monoliths to ...
Ripping off the Bandage: Re-Architecting Traditional Three-Tier Monoliths to ...
 
2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices
2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices
2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices
 
Unlocking Software Innovation with AWS - Adrian White - AWS TechShift ANZ 2018
Unlocking Software Innovation with AWS - Adrian White - AWS TechShift ANZ 2018Unlocking Software Innovation with AWS - Adrian White - AWS TechShift ANZ 2018
Unlocking Software Innovation with AWS - Adrian White - AWS TechShift ANZ 2018
 
[NEW LAUNCH!] Introducing AWS App Mesh – service mesh on AWS (CON367) - AWS r...
[NEW LAUNCH!] Introducing AWS App Mesh – service mesh on AWS (CON367) - AWS r...[NEW LAUNCH!] Introducing AWS App Mesh – service mesh on AWS (CON367) - AWS r...
[NEW LAUNCH!] Introducing AWS App Mesh – service mesh on AWS (CON367) - AWS r...
 
Introduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day JerusalemIntroduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day Jerusalem
 
Building Modern Applications on AWS
Building Modern Applications on AWSBuilding Modern Applications on AWS
Building Modern Applications on AWS
 
How can your business benefit from going Serverless
How can your business benefit from going ServerlessHow can your business benefit from going Serverless
How can your business benefit from going Serverless
 
More Containers Less Operations
More Containers Less OperationsMore Containers Less Operations
More Containers Less Operations
 
Transforming Enterprise IT - AWS Transformation Day 2018: Detroit
Transforming Enterprise IT - AWS Transformation Day 2018: DetroitTransforming Enterprise IT - AWS Transformation Day 2018: Detroit
Transforming Enterprise IT - AWS Transformation Day 2018: Detroit
 
Building Serverless IoT solutions - EPAM SEC 2018 Minsk
Building Serverless IoT solutions - EPAM SEC 2018 MinskBuilding Serverless IoT solutions - EPAM SEC 2018 Minsk
Building Serverless IoT solutions - EPAM SEC 2018 Minsk
 

Más de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Más de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 
Come costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWSCome costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWS
 

Breaking Down the Monowhat

  • 1. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Stephen Liedig Senior Solutions Architect, WWPS (ANZ), Amazon Web Services Breaking Down the Monowhat?
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. About Me Senior Solutions Architect WWPS - Australia and New Zealand @sliedigaws in/sliedig/ Stephen Liedig
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. The Monowhat
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. https://imagescart.blogspot.com.au/2013/03/ayers-rock-in-uluru-national-park.html#.Wwp1DFOFMZo
  • 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The Monolith “…a single-tiered software application in which the user interface and data access code are combined into a single program from a single platform. A monolithic application is self-contained, and independent from other computing applications.” - Wikipedia
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Where did they all come from?
  • 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monolith = “Traditional” Applications • Applications developed to “best practices” and standards of the time • Monolith <> poorly designed • Applications didn’t need to be or weren’t designed to be distributed • Application design constrained by resources
  • 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monolith = “Traditional” Applications Pros: • At first… o Simple o No over-engineering • In-process latencies • Single codebase • Resource efficient at small scale Cons: • Modularity is hard to enforce as app grows • Can only scale up! • All or nothing deployment • Database dependencies • Long release cycles • Slow to react to customer demand
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. 2001 Development transformation at Amazon: 2001+ 2001+ monolithic application + teams microservices + 2 pizza teams
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Monolith development lifecycle developers releasetestbuild delivery pipelineapp
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Single-purpose Connect only through APIs Connect over HTTPS Largely “black boxes” to each other Microservices
  • 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Microservice development lifecycle developers delivery pipelinesservices releasetestbuild releasetestbuild releasetestbuild releasetestbuild releasetestbuild releasetestbuild
  • 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. > 60 million deployments a year* Thousands of teams × Microservice architecture × Continuous delivery × Multiple environments *2016 number
  • 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Conway’s Law “…organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations…” — M. Conway
  • 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Microservices
  • 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What microservices are… “…the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API…” - Martin Fowler
  • 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What microservices are… “Independently deployable services that work together, modelled around a business domain…” -Sam Newman
  • 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What microservices are not… Defined by the number of lines of code Services that only have subroutines (calculation or a validation) are functions, not a service Services that only expose CRUD operations are RPC call to a database, not a service REST / SOAP provide common interfaces for integration but don’t change the logical responsivity of the implementation
  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What microservices are… “The technical authority for a business capability” - Udi Dahan
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Shipping Inventory Customer Service Accounts Returns Invoicing
  • 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. How? Shipping Inventory Customer Service ?
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Domain Driven Design
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Domain Driven Design “Ubiquitous language” –Modelling the language of the business Provides guidance about model domains with entities, value objects, repositories and services Top Tip! Start reading from Chapter 11: Strategic Design vs Tactical Design
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Bounded Contexts • Bounded Contexts are an essential modeling tool in DDD and microservices • Identify explicit boundaries around our understanding of the ubiquitous language and the things people care about • Multiple models for a business concept https://www.martinfowler.com/bliki/BoundedContext.html Customer Ticket Product Product Version Customer Product Territory Opportunity Pipeline Sales Person Defect Sales Context Support Context
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Multiple Bounded Contexts Concept Contracting with authors Managing the book’s authorship and editorial process Designing the book layout, including illustrations Source: Implementing Domain-Driven Design, Vaughn Vernon Publishing Example: Book model Translating the book into other languages Producing the physical print and/ or electronic editions Marketing the book Selling the book to resellers and/ or directly to consumers Shipping a physical book to resellers and consumer
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Context Maps Bounded contexts alone don’t provide a global view of your domain Context maps deal with mapping different, but related, Ubiquitous Languages by integrating their Bounded Contexts Evans and Vernon describe 7 patterns for integrating bounded contexts • Shared Kernel • Customer / Supplier • Conformist • Anticorruption Layer • Separate Ways • Open / Host Service • Published Language Sales Context Support Context Marketing Context
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Domain Events • Objects in a domain that represent that something has happened • Immutable – cannot change the past • Should be represented as verbs in the past tense, e.g. “customer_created” • Light weight, correlated by properties that are common across bounded contexts “customer_id” • Pattern for bounded context integration - Publish / Subscribe
  • 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Coupling
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Managing Dependencies Loose Coupling / High Cohesion Encapsulation
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Types of coupling • Afferent (Ca) and Efferent (Ce) Measurement units of the degree of coupling Who depends on you?… Who do you depend on? • Platform Coupling May be introduced by things like proprietary protocols or components that are platform specific • Temporal Coupling Dealing with time-based dependencies between collaborating system components, e.g. waiting operations or sequential processing • Spatial Coupling Not having to know the location of your collaborating services on the network and providing failover mechanisms, e.g. Amazon Elastic Load Balancer A B A B
  • 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. There is no loose coupling…
  • 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. There is no loose coupling… • Coupling is a function of multiple dimensions • No loose or tight • Need to make tradeoffs Platform Spatial TemporalAfferent Efferent
  • 33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Messaging & Messaging Patterns
  • 34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon SQS Amazon SNS
  • 35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon SQS WHAT IT IS Simple, flexible, fully managed message queuing service for reliably and continuously exchanging any volume of messages from anywhere USE CASE Build decoupled, highly scalable microservices, distributed systems, and serverless applications in the cloud COOL CAPABILITIES Nearly infinite scalability and ability to increase message throughput without pre-provisioning capacity > aws sqs create-queue --queue-name MyQueue
  • 36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon SQS as an Event Source (SQSaaES) • Lambda polls the queue and when it detects new messages, it invokes your Lambda function by passing the messages as an event • Full control over the queue processing settings such as visibility timeouts, delay queues, redrive policy, etc. Supports batch processing • Lambda will gradually increase the queue polling rate as long as queue polling results in fetching of new messages • Supports Identity and Resource based policy3. Lambda invoked Lambda function SQS Queue 2. Pull messages from queue 1. Message arrives on queue
  • 37. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon SNS WHAT IT IS Simple, flexible, fully managed publish/subscribe messaging and mobile push notification service for high throughput, highly reliable message delivery USE CASE Push messages to a variety of endpoints and clients in distributed systems, microservices, and serverless applications and enable event-driven architecture COOL CAPABILITIES Highly reliable delivery of any volume of messages to any number of recipients across multiple protocols > aws sns create-topic --name my-topic
  • 38. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Publish / Subscribe • One logical publisher for a given domain event • Fully enforces a consistent boundary • Addresses multiple types of coupling SNS Topic Service B Service C Service D Service A • Each subscriber can react to domain events in their own bounded context • SNS supports multiple subscription channels – Lambda, SQS, HTTP/S, Email, SMS, Mobile Push
  • 39. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Mapping events to topics Grey Topic Attr= Blue Grey Publisher Blue Topic Blue Grey Blue Blue Grey Subscribers Service C Service D Service E Service F Message type mapped to logical destination
  • 40. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon SNS Message Filters • Publishers do not need to route message • Subscribers do not need to filter for message of interest • Lowers cost SNS Topic Attr= Grey Attr= Blue Attr= Blue Attr= Grey Attr= Blue Attr= Grey Filter Policy Attr=Grey Filter Policy Attr=Blue Publisher
  • 41. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Message Filtering Operators Subscription filter policy {"sport": ["rugby"]} matches message attribute {"sport": "rugby"} Exact matching on string values (Whitelisting) Anything-but matching on string values (Blacklisting) Prefix matching on string values Exact matching on numeric values Range matching on numeric values Subscription filter policy {"sport": [{"anything-but": "rugby"}]} matches message attributes such as {"sport": "baseball"} and {"sport": "basketball"} and {"sport": "football"} but not {"sport": "rugby"} Subscription filter policy {"sport": [{"prefix": "bas"}]} matches message attributes such as {"sport": "baseball"} and {"sport": "basketball"} Subscription filter policy {"balance": [{"numeric": ["=", 301.5]}]} matches message attributes {"balance": 301.500} and {"balance": 3.015e2} Subscription filter policy {"balance": [{"numeric": ["<", 0]}]} matches negative numbers only, and {"balance": [{"numeric": [">", 0, "<=", 150]}]} matches any positive number up to 150.
  • 42. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Long Running Processes
  • 43. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Coordination by Function Chaining
  • 44. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. “I want try/catch/finally” “I want to select tasks based on data” “I want to retry failed tasks” A B C A ? “I want to sequence tasks” BA “I want to run tasks in parallel” CBA
  • 45. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functions …makes it easy to coordinate the components of distributed applications using visual workflows
  • 46. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functions “Serverless” workflow management with zero administration • Coordinate the components of distributed applications and microservices using visual workflows • Keeps the orchestration out of the code! • State management • Automatically triggers and tracks each step, and retries when there are errors • Logs the state of each step, so when things do go wrong, you can diagnose and debug problems quickly Task Choice Fail Parallel
  • 47. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Distributed Transactions & Saga Pattern
  • 48. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What are Sagas? • Pattern for dealing with “long-lived transactions” (Garcia-Molina, Salem 1987) • Challenges dealing with transactions in a distributed system - no transaction coordinator! • Time is not consistent. Time is contextual. • Semantic consistency by providing compensating transactions for every transaction where you have more than one collaborating services or functions • Failure management pattern
  • 49. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Applying Saga pattern with AWS Step Functions https://theburningmonk.com/2017/07/applying-the-saga-pattern-with-aws-lambda-and-step-functions/
  • 50. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Microservices messaging patterns One-Way Lambda function SQS Queue Return Address SQS QueueLambda function Request / Response Lambda function SQS Queue SNS Topic Service B Service C Service D Service A Publish / Subscribe request response request response
  • 51. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Final thoughts
  • 52. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Microviews • Don’t forget about the user interface! • If a microservice is the technical authority for a business capability then it is also the authority on how interacts with the user • Leverage composite user interfaces B A C D E A B C D E
  • 53. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved. https://imagescart.blogspot.com.au/2013/03/ayers-rock-in-uluru-national-park.html#.Wwp1DFOFMZo Summary Chances are YAGNI! Not everyone needs Microservices. If you have a well defined domain then you don’t have to break the monolith apart entirely. Lead your microservices strategy from strategic perspective. Model your microservices around business capabilities. Consider a monolith-first approach. Identify your bounded contexts first. Don’t use a big bang approach. It’s an evolutionary journey. Leverage messaging services and publish subscribe patterns to provide strict boundaries around your bounded contexts and use them to manage coupling inside your application.
  • 54. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Thank you