SlideShare uma empresa Scribd logo
1 de 48
Baixar para ler offline
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Breaking Down the Monoliths?
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
The Monolith
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
The Monolith
“…a 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
Where did they all come from?
© 2019, 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
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
2001
Development transformation at Amazon: 2001+
2001+
monolithic
application
microservices
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Monolith development lifecycle
developers
releasetestbuild
delivery pipelineapp
© 2019, 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
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Microservice development lifecycle
developers delivery pipelinesservices
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
= Millions of deployments per year
Thousands of teams
× Microservice architecture
× Continuous delivery
× Multiple environments
Amazon transformation
Microservices
© 2019, 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
© 2019, 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
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What microservices are…
“The technical authority for a business capability”
- Udi Dahan
© 2019, 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 Create, Read, Update and Delete (CRUD)
operations are Remote Procedure calls (RPC) to a database, not a
service
• REST / SOAP provide common interfaces for integration but don’t
change the logical responsivity of the implementation
Shipping
Inventory
Customer
Service
Accounts
Returns
Invoicing
How?
Shipping
Inventory
Customer
Service
?
Designing Microservices
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Designing Microservices with the Domain Driven Design
Framework - Bounded Contexts
• Domain Driven Design is a broad
framework to making design decisions
• Bounded Contexts are an essential
modeling tool in DDD and microservices
• DDD deals with large models by dividing
them into different Bounded Contexts
and being explicit about their
interrelationships.
• A model acts as a Ubiquitous Language
to help communication between
software developers and domain experts
• Ubiquitous Language is the practice of
building up a common, rigorous
language between developers and users.
https://www.martinfowler.com/bliki/BoundedContext.html
Customer
Ticket
Product
Product
Version
Customer
Product
Territory
Opportunity
Pipeline
Sales
Person
Defect
Sales Context Support Context
© 2019, 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
7 patterns for integrating bounded
contexts
• Shared Kernel
• Customer / Supplier
• Conformist
• Anti-corruption Layer
• Separate Ways
• Open Host
• Published Language
Sales Context Support Context
Marketing Context
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Coupling Bounded Context - Types of coupling
• Afferent (Ca - Incoming) and Efferent (Ce - Outgoing)
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
Coupling is a measure that defines the level of inter-dependability
between modules or components
AWS Serverless Services for
implementing Microservices
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Serverless tenets
No server management Flexible scaling
No idle capacity
$
High availability
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Managed services as building blocks
AWS Lambda
Amazon API Gateway
Orchestration
API proxy
Compute
AWS Step Functions
Amazon SNS
Amazon SQS
Amazon S3
Messaging
Monitoring and debugging
Storage
AWS X-Ray
Amazon DynamoDB
Amazon Kinesis
Analytics
Database
Edge compute
AWS Greengrass
Lambda@Edge
Amazon Athena
Amazon Aurora Serverless
Application Frameworks
AWS Amplify
• Platform to run code without thinking about servers
• Our definition
• No servers to provision or manage
• Scales with usage
• Never pay for idle
• High availability built in, fault tolerance made easier
• Native integration with other AWS services
• Benefits
• Event-driven framework
• Multiple invocation models
Serverless: AWS Lambda
AWS serverless web architecture
AWS Cloud
Amazon
DynamoDB
AWS
Lambda
Amazon
API Gateway
Messaging & Messaging Patterns
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Simple Queue Service (Amazon SQS)
• Simple enough to get started in minutes
• Highly reliable, always available, and durable
• Continuous scale allows burst loads with no
excess capacity
• Integrated with AWS platform with
monitoring and queue management
• Comprehensive security and compliance
“Worry-free managed queues
- simply and reliably
distribute any volume of
messages between
endpoints"
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SQS Features
High durability
with messages
persisted across
multiple AZs
High availability
in all AWS
regions
Continuous and
unlimited scaling
Simplified
troubleshooting
with a Dead
Letter Queue
Integrated with
other AWS
services as a
destination
Amazon SQS as an Event Source
• 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 policy
3. Lambda invoked
2. Pull messages
from queue
1. Message arrives on
queue
Queue
Lambda function
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Simple Notification Service (Amazon SNS)
• Highly reliable, available, and durable pub-
sub service that delivers messages to
multiple destinations, including system and
mobile endpoints
• Continuous scale allows burst loads with
no excess capacity
• Integrated with AWS platform delivering
messages from services to subscribing
endpoints
• Comprehensive monitoring, security, and
compliance
“Simply and reliably distribute
any volume of messages and
event notifications anywhere”
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SNS Key Features
High durability
with messages
persisted across
multiple AZs
High availability
in all AWS
regions
Continuous and
unlimited scaling
Simplify
development with
filtered message
delivery
Easy monitoring
with CloudWatch,
with alarming
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Publish / Subscribe
• 1 to many (fan out) between publisher and subscribers
• 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
© 2019, 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
© 2019, 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
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon SNS 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"}]}
Subscription filter policy
{"sport": [{"prefix": "bas"}]}
matches message attributes
{"balance": 301.500}
and
{"balance": 3.015e2}
matches negative numbers only, and
{"balance": [{"numeric":
[">", 0, "<=", 150]}]}
matches any positive number up to 150.
Long Running Processes
© 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Coordination by Function Chaining
“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
AWS Step Functions
…makes it easy to coordinate the
components of distributed
applications using visual workflows
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Step Functions
“Serverless” workflow management with zero
administration, uses a JSON based
specification called States Language
• Out of the box on the AWS Console
• 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
© 2019, 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
Final thoughts
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Don’t forget about the user interface!
• Microviews (user interfaces
matching microservices)
• 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
frameworks (like AWS Amplify)
B
A
C D
E
A B C D E
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Summary
Not everyone needs Microservices. If you have a well defined domain then you
don’t have to break the monolith apart entirely.
Don’t use a big bang approach. It’s an evolutionary journey.
Consider the whole solution in it’s entirety first and identify your bounded
contexts to break it down into microservices.
Lead your microservices approach from a strategic perspective. Model your
microservices around business capabilities.
Leverage messaging services and publish-subscribe patterns to provide strict
boundaries around your bounded contexts and use them to manage coupling
inside your application.
Thank you!

Mais conteúdo relacionado

Mais procurados

Becoming A High Frequency Enterprise
Becoming A High Frequency EnterpriseBecoming A High Frequency Enterprise
Becoming A High Frequency Enterprise
Amazon Web Services
 
Migrate and Modernize Your Database
Migrate and Modernize Your DatabaseMigrate and Modernize Your Database
Migrate and Modernize Your Database
Amazon Web Services
 
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
 
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
 
AWS最新區塊鏈服務與應用
AWS最新區塊鏈服務與應用AWS最新區塊鏈服務與應用
AWS最新區塊鏈服務與應用
Amazon Web Services
 
人工智慧雲服務與金融服務應用
人工智慧雲服務與金融服務應用人工智慧雲服務與金融服務應用
人工智慧雲服務與金融服務應用
Amazon Web Services
 

Mais procurados (20)

Becoming A High Frequency Enterprise
Becoming A High Frequency EnterpriseBecoming A High Frequency Enterprise
Becoming A High Frequency Enterprise
 
Inovação Rápida: O caso de negócio para desenvolvimento de aplicações modernas.
Inovação Rápida: O caso de negócio para desenvolvimento de aplicações modernas.Inovação Rápida: O caso de negócio para desenvolvimento de aplicações modernas.
Inovação Rápida: O caso de negócio para desenvolvimento de aplicações modernas.
 
AWS Initiate Day Dublin 2019 – AWS Foundations
AWS Initiate Day Dublin 2019 – AWS FoundationsAWS Initiate Day Dublin 2019 – AWS Foundations
AWS Initiate Day Dublin 2019 – AWS Foundations
 
Initiate Edinburgh 2019 - Moving to DevOps the Amazon Way
Initiate Edinburgh 2019 - Moving to DevOps the Amazon WayInitiate Edinburgh 2019 - Moving to DevOps the Amazon Way
Initiate Edinburgh 2019 - Moving to DevOps the Amazon Way
 
Building Modern Applications on AWS
Building Modern Applications on AWSBuilding Modern Applications on AWS
Building Modern Applications on AWS
 
Migrate and Modernize Your Database
Migrate and Modernize Your DatabaseMigrate and Modernize Your Database
Migrate and Modernize Your Database
 
AWS AI and Machine Learning Journey
AWS AI and Machine Learning JourneyAWS AI and Machine Learning Journey
AWS AI and Machine Learning Journey
 
AWS e SAP - Il futuro delle Enterprise Applications
AWS e SAP - Il futuro delle Enterprise ApplicationsAWS e SAP - Il futuro delle Enterprise Applications
AWS e SAP - Il futuro delle Enterprise Applications
 
Keynote_AWS_BecomingAHighFrequencyEnterprise
Keynote_AWS_BecomingAHighFrequencyEnterpriseKeynote_AWS_BecomingAHighFrequencyEnterprise
Keynote_AWS_BecomingAHighFrequencyEnterprise
 
Elevate your security with the cloud
Elevate your security with the cloudElevate your security with the cloud
Elevate your security with the cloud
 
Operando em Escala Preparando-se para a jornada
Operando em EscalaPreparando-se para a jornadaOperando em EscalaPreparando-se para a jornada
Operando em Escala Preparando-se para a jornada
 
Welcome To Day One
Welcome To Day OneWelcome To Day One
Welcome To Day One
 
De un monolito a microservicios
De un monolito a microserviciosDe un monolito a microservicios
De un monolito a microservicios
 
Initiate Edinburgh 2019 - Migrating Data to the Cloud
Initiate Edinburgh 2019 - Migrating Data to the CloudInitiate Edinburgh 2019 - Migrating Data to the Cloud
Initiate Edinburgh 2019 - Migrating Data to the Cloud
 
AWS最新區塊鏈服務與應用
AWS最新區塊鏈服務與應用AWS最新區塊鏈服務與應用
AWS最新區塊鏈服務與應用
 
Pensi di essere pronto per i microservizi?
Pensi di essere pronto per i microservizi?Pensi di essere pronto per i microservizi?
Pensi di essere pronto per i microservizi?
 
Harnessing diversity to solve a people problem - FND312 - AWS re:Inforce 2019
Harnessing diversity to solve a people problem - FND312 - AWS re:Inforce 2019 Harnessing diversity to solve a people problem - FND312 - AWS re:Inforce 2019
Harnessing diversity to solve a people problem - FND312 - AWS re:Inforce 2019
 
The Next Wave of Retailing, An AWS Perspective - Tom Litchford 월드와이드 리테일 사업 개...
The Next Wave of Retailing, An AWS Perspective - Tom Litchford 월드와이드 리테일 사업 개...The Next Wave of Retailing, An AWS Perspective - Tom Litchford 월드와이드 리테일 사업 개...
The Next Wave of Retailing, An AWS Perspective - Tom Litchford 월드와이드 리테일 사업 개...
 
How_to_build_your_cloud_enablement_engine_with_the_people_you_already_have
How_to_build_your_cloud_enablement_engine_with_the_people_you_already_haveHow_to_build_your_cloud_enablement_engine_with_the_people_you_already_have
How_to_build_your_cloud_enablement_engine_with_the_people_you_already_have
 
人工智慧雲服務與金融服務應用
人工智慧雲服務與金融服務應用人工智慧雲服務與金融服務應用
人工智慧雲服務與金融服務應用
 

Semelhante a AWS Initiate Day Dublin 2019 – Breaking down the Monoliths

Semelhante a AWS Initiate Day Dublin 2019 – Breaking down the Monoliths (20)

AWS Initiate Day Manchester 2019 – AWS Breaking Down the Monoliths
AWS Initiate Day Manchester 2019 – AWS Breaking Down the MonolithsAWS Initiate Day Manchester 2019 – AWS Breaking Down the Monoliths
AWS Initiate Day Manchester 2019 – AWS Breaking Down the Monoliths
 
Modern Applications Development on AWS
Modern Applications Development on AWSModern Applications Development on AWS
Modern Applications Development on AWS
 
Cloud Native Patterns with Bluemix Developer Console
Cloud Native Patterns with Bluemix Developer ConsoleCloud Native Patterns with Bluemix Developer Console
Cloud Native Patterns with Bluemix Developer Console
 
CI/CD for Modern Applications
CI/CD for Modern ApplicationsCI/CD for Modern Applications
CI/CD for Modern Applications
 
Introduction to Serverless Computing - OOP Munich
 Introduction to Serverless Computing - OOP Munich Introduction to Serverless Computing - OOP Munich
Introduction to Serverless Computing - OOP Munich
 
Nordic APIs IBM- Deploying Multi-cloud, Serverless, Cloud Foundry APIs at Scale
Nordic APIs IBM- Deploying Multi-cloud, Serverless, Cloud Foundry APIs at ScaleNordic APIs IBM- Deploying Multi-cloud, Serverless, Cloud Foundry APIs at Scale
Nordic APIs IBM- Deploying Multi-cloud, Serverless, Cloud Foundry APIs at Scale
 
CICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdfCICDforModernApplications-Oslo.pdf
CICDforModernApplications-Oslo.pdf
 
AWS DevDay Cologne - CI/CD for modern applications
AWS DevDay Cologne - CI/CD for modern applicationsAWS DevDay Cologne - CI/CD for modern applications
AWS DevDay Cologne - CI/CD for modern applications
 
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
 
AWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the CloudAWS Accra Meetup - Developing Modern Applications in the Cloud
AWS Accra Meetup - Developing Modern Applications in the Cloud
 
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud[CPT DevOps Meetup] Developing Modern Applications in the Cloud
[CPT DevOps Meetup] Developing Modern Applications in the Cloud
 
AWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the CloudAWS Jozi Meetup Developing Modern Applications in the Cloud
AWS Jozi Meetup Developing Modern Applications in the Cloud
 
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
 
Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...
Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...
Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...
 
Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...
Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...
Microservices on AWS: Architectural Patterns and Best Practices | AWS Summit ...
 
Breaking Down the Monowhat
Breaking Down the MonowhatBreaking Down the Monowhat
Breaking Down the Monowhat
 
Cloud description
Cloud descriptionCloud description
Cloud description
 
Build end-to-end solutions with BlueMix, Avi Vizel & Ziv Dai, IBM
Build end-to-end solutions with BlueMix, Avi Vizel & Ziv Dai, IBMBuild end-to-end solutions with BlueMix, Avi Vizel & Ziv Dai, IBM
Build end-to-end solutions with BlueMix, Avi Vizel & Ziv Dai, IBM
 
Agile and NextOps
Agile and NextOpsAgile and NextOps
Agile and NextOps
 
Building APIs with Amazon API Gateway
Building APIs with Amazon API GatewayBuilding APIs with Amazon API Gateway
Building APIs with Amazon API Gateway
 

Mais 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
 

Mais 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
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
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
 

AWS Initiate Day Dublin 2019 – Breaking down the Monoliths

  • 1.
  • 2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Breaking Down the Monoliths?
  • 3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. The Monolith
  • 4. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. The Monolith “…a 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
  • 5. Where did they all come from?
  • 6. © 2019, 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
  • 7. 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
  • 8. 2001 Development transformation at Amazon: 2001+ 2001+ monolithic application microservices
  • 9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Monolith development lifecycle developers releasetestbuild delivery pipelineapp
  • 10. © 2019, 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
  • 11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Microservice development lifecycle developers delivery pipelinesservices releasetestbuild releasetestbuild releasetestbuild releasetestbuild releasetestbuild releasetestbuild
  • 12. = Millions of deployments per year Thousands of teams × Microservice architecture × Continuous delivery × Multiple environments Amazon transformation
  • 14. © 2019, 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
  • 15. © 2019, 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
  • 16. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. What microservices are… “The technical authority for a business capability” - Udi Dahan
  • 17. © 2019, 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 Create, Read, Update and Delete (CRUD) operations are Remote Procedure calls (RPC) to a database, not a service • REST / SOAP provide common interfaces for integration but don’t change the logical responsivity of the implementation
  • 21. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Designing Microservices with the Domain Driven Design Framework - Bounded Contexts • Domain Driven Design is a broad framework to making design decisions • Bounded Contexts are an essential modeling tool in DDD and microservices • DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their interrelationships. • A model acts as a Ubiquitous Language to help communication between software developers and domain experts • Ubiquitous Language is the practice of building up a common, rigorous language between developers and users. https://www.martinfowler.com/bliki/BoundedContext.html Customer Ticket Product Product Version Customer Product Territory Opportunity Pipeline Sales Person Defect Sales Context Support Context
  • 22. © 2019, 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 7 patterns for integrating bounded contexts • Shared Kernel • Customer / Supplier • Conformist • Anti-corruption Layer • Separate Ways • Open Host • Published Language Sales Context Support Context Marketing Context
  • 23. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Coupling Bounded Context - Types of coupling • Afferent (Ca - Incoming) and Efferent (Ce - Outgoing) 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 Coupling is a measure that defines the level of inter-dependability between modules or components
  • 24. AWS Serverless Services for implementing Microservices
  • 25. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Serverless tenets No server management Flexible scaling No idle capacity $ High availability
  • 26. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Managed services as building blocks AWS Lambda Amazon API Gateway Orchestration API proxy Compute AWS Step Functions Amazon SNS Amazon SQS Amazon S3 Messaging Monitoring and debugging Storage AWS X-Ray Amazon DynamoDB Amazon Kinesis Analytics Database Edge compute AWS Greengrass Lambda@Edge Amazon Athena Amazon Aurora Serverless Application Frameworks AWS Amplify
  • 27. • Platform to run code without thinking about servers • Our definition • No servers to provision or manage • Scales with usage • Never pay for idle • High availability built in, fault tolerance made easier • Native integration with other AWS services • Benefits • Event-driven framework • Multiple invocation models Serverless: AWS Lambda
  • 28. AWS serverless web architecture AWS Cloud Amazon DynamoDB AWS Lambda Amazon API Gateway
  • 30. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Simple Queue Service (Amazon SQS) • Simple enough to get started in minutes • Highly reliable, always available, and durable • Continuous scale allows burst loads with no excess capacity • Integrated with AWS platform with monitoring and queue management • Comprehensive security and compliance “Worry-free managed queues - simply and reliably distribute any volume of messages between endpoints"
  • 31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon SQS Features High durability with messages persisted across multiple AZs High availability in all AWS regions Continuous and unlimited scaling Simplified troubleshooting with a Dead Letter Queue Integrated with other AWS services as a destination
  • 32. Amazon SQS as an Event Source • 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 policy 3. Lambda invoked 2. Pull messages from queue 1. Message arrives on queue Queue Lambda function
  • 33. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Simple Notification Service (Amazon SNS) • Highly reliable, available, and durable pub- sub service that delivers messages to multiple destinations, including system and mobile endpoints • Continuous scale allows burst loads with no excess capacity • Integrated with AWS platform delivering messages from services to subscribing endpoints • Comprehensive monitoring, security, and compliance “Simply and reliably distribute any volume of messages and event notifications anywhere”
  • 34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon SNS Key Features High durability with messages persisted across multiple AZs High availability in all AWS regions Continuous and unlimited scaling Simplify development with filtered message delivery Easy monitoring with CloudWatch, with alarming
  • 35. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Publish / Subscribe • 1 to many (fan out) between publisher and subscribers • 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
  • 36. © 2019, 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
  • 37. © 2019, 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
  • 38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Amazon SNS 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"}]} Subscription filter policy {"sport": [{"prefix": "bas"}]} matches message attributes {"balance": 301.500} and {"balance": 3.015e2} matches negative numbers only, and {"balance": [{"numeric": [">", 0, "<=", 150]}]} matches any positive number up to 150.
  • 40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved. Coordination by Function Chaining
  • 41. “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
  • 42. AWS Step Functions …makes it easy to coordinate the components of distributed applications using visual workflows
  • 43. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Step Functions “Serverless” workflow management with zero administration, uses a JSON based specification called States Language • Out of the box on the AWS Console • 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
  • 44. © 2019, 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
  • 46. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Don’t forget about the user interface! • Microviews (user interfaces matching microservices) • 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 frameworks (like AWS Amplify) B A C D E A B C D E
  • 47. © 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Summary Not everyone needs Microservices. If you have a well defined domain then you don’t have to break the monolith apart entirely. Don’t use a big bang approach. It’s an evolutionary journey. Consider the whole solution in it’s entirety first and identify your bounded contexts to break it down into microservices. Lead your microservices approach from a strategic perspective. Model your microservices around business capabilities. Leverage messaging services and publish-subscribe patterns to provide strict boundaries around your bounded contexts and use them to manage coupling inside your application.