SlideShare uma empresa Scribd logo
1 de 81
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amit Jha
Solution Architect – Global Financial Services
AWS Startup Day
If when and how to adopt microservices
“The Monolith”
Monoliths can be GOOD when you are starting
out
Always build to keep things as simple as
possible
When your application or company grows,
Monoliths begin slowing you down.
Let’s look at the challenges as you grow..
Challenges with monolithic software
Long Build/Test/Release
Cycles
(who broke the build?)
Operations
is a nightmare
(module X is failing, who’s
the owner?)
Difficult to scale
New releases
take months
Long time to add
new features
Architecture is hard to
maintain and evolve
Lack of innovation
Frustrated customers
Lack of agility
Long Build/Test/Release
Cycles
(who broke the build?)
Operations
is a nightmare
(module X is failing, who’s
the owner?)
Difficult to scale
New releases
take months
Long time to add
new features
Architecture is hard to
maintain and evolve
Lack of innovation
Frustrated customers
Lack of agility
Challenges with monolithic software
Long Build/Test/Release
Cycles
(who broke the build?)
Operations
is a nightmare
(module X is failing, who’s
the owner?)
Difficult to scale
New releases
take months
Long time to add
new features
Architecture is hard to
maintain and evolve
Lack of innovation
Frustrated customers
Lack of agility
Challenges with monolithic software
releasetestbuild
delivery pipeline
app
(aka the“monolith”)
developers
Monolith development lifecycle
Too much software coupling
Shared libraries
Too much software coupling
Shared libraries
Shared data
Too much software coupling
Silo’d functional teams à silo’d application
architectures
Image	from	Martin	Fowler’s	article	on	microservices, at
http://martinfowler.com/articles/microservices.html
No	alterations	other	than	cropping.
Permission to reproduce: http://martinfowler.com/faq.html
Cross functional teams à self-contained
services
Image	from	Martin	Fowler’s	article	on	microservices, at
http://martinfowler.com/articles/microservices.html
No	alterations	other	than	cropping.
Permission to reproduce: http://martinfowler.com/faq.html
Full ownership
Full accountability
Aligned incentives
“DevOps”
Non-pizza	image	from	Martin	Fowler’s	article	on	microservices, at
http://martinfowler.com/articles/microservices.html
No	alterations	other	than	cropping.
Permission to reproduce: http://martinfowler.com/faq.html
Cross functional teams à self-contained
services
(“Two-pizza teams”)
releasetestbuild
Focused agile teams
2-pizza
team
delivery pipeline service
releasetestbuild
releasetestbuild
Focused agile teams
2-pizza
team
delivery pipeline service
releasetestbuild
releasetestbuild
Focused agile teams
2-pizza
team
delivery pipeline service
releasetestbuild
releasetestbuild
releasetestbuild
Focused agile teams
2-pizza
team
delivery pipeline service
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
Focused agile teams
2-pizza
team
delivery pipeline service
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
Focused agile teams
2-pizza
team
delivery pipeline service
releasetestbuild
releasetestbuild
releasetestbuild
releasetestbuild
It’s a journey…
Expect challenges along the way…
• Understanding of business domains
• Eventual Consistency
• Service discovery
• Lots of moving parts requires
increased coordination
• Complexity of testing / deploying /
operating a distributed system
• Cultural transformation
= 50 million deployments a year
Thousands of teams
× Microservice architecture
× Continuous delivery
× Multiple environments
(5708 per hour, or every 0.63 second)
“service-oriented
architecture
composed of
loosely coupled
elements
that have
bounded contexts”
Adrian Cockcroft (VP of Cloud Architecture @
AWS, former Cloud Architect at Netflix)
“service-oriented
architecture
composed of
loosely coupled
elements
that have
bounded contexts”
Services communicate
with each other over the
network
Adrian Cockcroft (VP of Cloud Architecture @
AWS, former Cloud Architect at Netflix)
“service-oriented
architecture
composed of
loosely coupled
elements
that have
bounded contexts”
You can update the
services independently;
updating one service
doesn’t require changing
any other services.
Adrian Cockcroft (VP of Cloud Architecture @
AWS, former Cloud Architect at Netflix)
“service-oriented
architecture
composed of
loosely coupled
elements
that have
bounded contexts” Self-contained; you can
update the code without
knowing anything about
the internals of other
microservices
Adrian Cockcroft (VP of Cloud Architecture @
AWS, former Cloud Architect at Netflix)
Anatomy of a Microservice
Data Store
(eg, RDS, DynamoDB
ElastiCache, ElasticSearch)
Anatomy of a Microservice
Application/Logic
(code, libraries, etc)
Data Store
(eg, RDS, DynamoDB
ElastiCache, ElasticSearch)
Anatomy of a Microservice
Public API
POST /restaurants
GET /restaurants
Application/Logic
(code, libraries, etc)
Data Store
(eg, RDS, DynamoDB
ElastiCache, ElasticSearch)
Anatomy of a Microservice
Avoid Software Coupling
Drivers
micro-services
Payments
micro-service Location
micro-services
Ordering
micro-services
Restaurant
micro-service
Ecosystem of Microservices
AWS Services (Enablers for Microservices)…
Elastic Compute Cloud (EC2)
Virtual Servers in the Cloud
§ Resizable Compute Capacity
§ Complete control of your computing resources
§ Reduces time to obtain and boot new server
instances to minutes
§ Choose from 30+ different instance types
§ Scale as your requirements change
§ Pay only for what you use
Compute
Micro-service Design
EC2
Micro-service Design
EC2
Micro-service Design
EC2EC2 EC2 EC2
Micro-service Design
EC2EC2 EC2 EC2
Elastic Load
Balancer
Micro-service Design
EC2EC2 EC2 EC2
Elastic Load
Balancer
AWS Elastic
Beanstalk
Elastic Beanstalk vs. DIY
Your code
HTTP server
Application server
Language interpreter
Operating system
Host
Elastic Beanstalk configures
each EC2 instance in your
environment with the
components necessary to run
applications for the selected
platform. No more worrying
about logging into instances to
install and configure your
application stack.
Focus on building your
application
Provided by you
Provided and managed by Elastic Beanstalk
On-instance configuration
EC2 Container Service
Run and Manage Docker Containers
§ A high performance container management service
for running Docker containers on EC2 instances
§ Use the built in scheduler, write your own, or use a
third-party scheduler
§ Integrates with other services like ELB and EBS
§ No additional charge
§ EC2 Container Registry
Compute
Micro-service Design
EC2EC2 EC2 EC2
Elastic Load
Balancer
Micro-service Design
EC2EC2 EC2 EC2
Elastic Load
Balancer
Micro-service Design
EC2EC2 EC2 EC2
Elastic Load
Balancer
Amazon
EC2 Container
Service (ECS)
to manage
containers
Lambda
Run Code in Response to Events
§ Runs code in response to triggers such as S3
upload, DynamoDB updates, Kinesis streams,
and API Gateway requests
§ Automatically scales
§ You only need to provide the code; there is no
infrastructure to manage
§ Pay only for what you use
Compute
Lambda
automatically
scales
Upload your code
(Java, JavaScript,
Python)
Pay for only
the compute
time
you use
(sub-second
metering)
Set up your code to
trigger from other
AWS services,
webservice calls, or
app activity
Application Services
API Gateway
Build, Publish and Manage APIs
§ Performance at any scale via worldwide edge locations,
traffic throttling, and API output caching
§ Monitor API activity
§ Integrates with Lambda functions
§ Run multiple versions of the same API
§ Fully Managed
Create a unified
API frontend for
multiple
micro-services
…as well as
monitoring,
logging,
rollbacks,
client SDK
generation…
Authenticate
and authorize
requests
Handles DDoS
protection and
API throttling
DynamoDB
Predictable and Scalable NoSQL Data Store
§ Fast, fully-managed NoSQL Database Service
§ Capable of handling any amount of data
§ Durable and Highly Available
§ All SSD storage
§ Simple and Cost Effective
Database
Gilt
Luxury designer brands at
members-only prices
Gilt
Luxury designer brands at
members-only prices
.. Sale every day at noon
EST
Microservices Architecture
Internet
Mobile
Apps
Websites
Services
AWS Lambda
functions
AWS
API Gateway
Cache
Endpoints on
Amazon EC2
/ECS
Amazon Elastic
Beanstalk
Any other publicly
accessible endpoint
Amazon
CloudWatch
Monitoring
Amazon
API
Gateway
Principle 1
Microservices only
rely on each other’s
public API
“Contracts” by NobMouse. No alterations other than cropping.
https://www.flickr.com/photos/nobmouse/4052848608/
Image used with permissions under Creative Commons license 2.0, Attribution
Generic License (https://creativecommons.org/licenses/by/2.0/)
Micro-service A Micro-service B
public API public API
Principle 1:
Microservices only rely on each other’s public API
public API public API
Micro-service A Micro-service B
Principle 1:
Microservices only rely on each other’s public API
Hide your data!
public API public API
Nope!
Micro-service A Micro-service B
Principle 1:
Microservices only rely on each other’s public API
Hide your data!
public API public API
Micro-service A Micro-service B
Principle 1:
Microservices only rely on each other’s public API
Hide your data!
Principle 1:
Microservices only rely on each other’s public API
storeRestaurant (id, name, cuisine)
Version 1.0.0
public API
Micro-service A
Evolve API in backward-compatible way .. And document!
Principle 1:
Microservices only rely on each other’s public API
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, arbitrary_metadata)
addReview (restaurantId, rating, comments)
Version 1.0.0
Version 1.1.0
public API
Micro-service A
Evolve API in backward-compatible way .. And document!
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, cuisine)
storeRestaurant (id, name, arbitrary_metadata)
addReview (restaurantId, rating, comments)
storeRestaurant (id, name, arbitrary_metadata)
addReview (restaurantId, rating, comments)
Version 1.0.0
Version 1.1.0
Version 2.0.0
public API
Micro-service A
Evolve API in backward-compatible way .. And document!
Principle 1:
Microservices only rely on each other’s public API
Principle 2
Use the right tool for the
job
“Tools #2” by Juan Pablo Olmo. No alterations other than cropping.
https://www.flickr.com/photos/juanpol/1562101472/
Image used with permissions under Creative Commons license 2.0, Attribution
Generic License (https://creativecommons.org/licenses/by/2.0/)
public API public API
DynamoDB
Micro-service A Micro-service B
Embrace polyglot persistence
Principle 2:
Use the right tool for the job
public API public API
DynamoDB
Micro-service A Micro-service B
Amazon
Elasticsearch
Service
Embrace polyglot persistence
Principle 2:
Use the right tool for the job
public API public API
RDS
Aurora
Micro-service A Micro-service B
Amazon
Elasticsearch
Service
Embrace polyglot persistence
Principle 2:
Use the right tool for the job
public API public API
RDS
Aurora
Micro-service A Micro-service B
Amazon
Elasticsearch
Service
Embrace polyglot programming frameworks
Principle 2:
Use the right tool for the job
public API public API
RDS
Aurora
Micro-service A Micro-service B
Amazon
Elasticsearch
Service
Embrace polyglot programming frameworks
Principle 2:
Use the right tool for the job
Principle 3
Secure Your Services
“security” by Dave Bleasdale. No alterations other than cropping.
https://www.flickr.com/photos/sidelong/3878741556/
Image used with permissions under Creative Commons license 2.0,
Attribution Generic License (https://creativecommons.org/licenses/by/2.0/)
• Defense-in-depth
• Network level (e.g. VPC, Security Groups, TLS)
• Server/container-level
• App-level
• IAM policies
• Gateway (“Front door”)
• API Throttling
• Authentication & Authorization
• Client-to-service, as well as service-to-service
• API Gateway: custom Lambda authorizers
• Token-based auth (JWT tokens, OAuth 2.0)
• IAM-based Authentication
• Secrets management
• S3 bucket policies + KMS + IAM
• Open-source tools (e.g. Vault, Keywhiz)
API Gateway
Principle 3:
Secure your services
Principle 4
Be a good citizen
within the ecosystem
“Lamington National Park, rainforest” by Jussarian. No alterations other than cropping.
https://www.flickr.com/photos/kerr_at_large/87771074/
Image used with permissions under Creative Commons license 2.0,
Attribution Generic License (https://creativecommons.org/licenses/by/2.0/)
Hey Sally, we need to call
your micro-service to
fetch restaurants details.
Sure Paul. Which APIs you need to
call? Once I know better your use
cases I’ll give you permission to
register your service as a client on
our service’s directory entry.
Micro-service A Micro-service B
public API public API
Principle 4:
Be a good citizen within the ecosystem
Proper retries with
exponential backoff
Restaurant
Micro-service
15 TPS100 TPS5 TPS20 TPS
Before we let you call our
micro-service we need to
understand your use case,
expected load (TPS) and
accepted latency
Have clear SLAs
Principle 4:
Be a good citizen within the ecosystem
Distributed monitoring and tracing
• “Is the service meeting its SLA?”
• “Which services were involved in a request?”
• “How did downstream dependencies perform?”
Shared metrics
• e.g. request time, time to first byte
Distributed tracing
• e.g. Zipkin, OpenTracing
User-experience metrics
Distributed monitoring, logging, and tracing
Principle 4:
Be a good citizen within the ecosystem
AWS X-Ray
Distributed tracing service that
enables developers to analyze
the behavior of their
applications
AWS X-Ray
traces
requests made
to your
application
X-Ray service
X-Ray
combines the
data gathered
from each
service into
singular units
called traces
View the
service map to
see trace data
such as
latencies,
HTTP
statuses, and
metadata for
Drill into the
service
showing
unusual
behavior to
identify the
root issue
X-Ray collects
data about the
request from each
of the underlying
applications
services it passes
through
Principle 6: Automate everything
AWS CodeCommit AWS
CodePipeline
AWS CodeDeploy
ELB
Auto
ScalingEC2 Lambda
ECS
DynamoDBRDS ElastiCache
SQS SWF SESSNS
API GatewayCloudWatch Cloud Trail
Kinesis
Elastic
Beanstalk
Principles of Microservices
1. Rely only on the public API
Ÿ Hide your data
Ÿ Document your APIs
Ÿ Define a versioning strategy
2. Use the right tool for the job
Ÿ Container journey? (use ECS)
Ÿ Polyglot persistence (data layer)
Ÿ Polyglot frameworks (app layer)
3. Secure your services
Ÿ Defense-in-depth
Ÿ Authentication/authorization
6. Automate everything
Ÿ Adopt DevOps
4. Be a good citizen within the ecosystem
Ÿ Have SLAs
Ÿ Distributed monitoring, logging,
tracing
5. More than just technology transformation
Ÿ Embrace organizational change
Ÿ Favor small focused dev teams
It’s a journey…
Expect challenges along the way…
• Understanding of business domains
• Coordinating txns across multiple
services
• Eventual Consistency
• Service discovery
• Lots of moving parts requires
increased coordination
• Complexity of testing / deploying /
operating a distributed system
• Cultural transformation
AWS resources:
• Microservices without the Servers
https://aws.amazon.com/blogs/compute/
microservices-without-the-servers
• Microservices with ECS:
https://aws.amazon.com/blogs/compute/using-amazon-
api-gateway-with-microservices-deployed-on-amazon-ecs/
• Serverless Service Discovery:
https://aws.amazon.com/blogs/developer/
serverless-service-discovery-part-1-get-started/
• ECS Service Discovery:
https://aws.amazon.com/blogs/compute/
service-discovery-an-amazon-ecs-reference-architecture/
• Serverless Webapp - Reference Architecture:
https://github.com/awslabs/lambda-refarch-webapp
• Zombie Microservices Workshop:
https://github.com/awslabs/aws-lambda-zombie-workshop
Additional Resources
Architecture: When, how, and if to Adopt Microservices

Mais conteúdo relacionado

Mais procurados

A Modern Data Architecture for Microservices
A Modern Data Architecture for MicroservicesA Modern Data Architecture for Microservices
A Modern Data Architecture for Microservices
Amazon Web Services
 
AWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv Singhal
AWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv SinghalAWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv Singhal
AWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv Singhal
Amazon Web Services Korea
 
Best practices to Support Active Directory Aware Workloads on AWS
Best practices to Support Active Directory Aware Workloads on AWSBest practices to Support Active Directory Aware Workloads on AWS
Best practices to Support Active Directory Aware Workloads on AWS
Amazon Web Services
 

Mais procurados (20)

Windows Workloads on AWS - AWS Innovate Toronto
Windows Workloads on AWS - AWS Innovate TorontoWindows Workloads on AWS - AWS Innovate Toronto
Windows Workloads on AWS - AWS Innovate Toronto
 
Common Workloads on the AWS Cloud
Common Workloads on the AWS CloudCommon Workloads on the AWS Cloud
Common Workloads on the AWS Cloud
 
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with ...
 Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with ... Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with ...
Database Migration: Simple, Cross-Engine and Cross-Platform Migrations with ...
 
A Modern Data Architecture for Microservices
A Modern Data Architecture for MicroservicesA Modern Data Architecture for Microservices
A Modern Data Architecture for Microservices
 
AWS Service Catalog
AWS Service CatalogAWS Service Catalog
AWS Service Catalog
 
SRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and DockerSRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and Docker
 
AWS Enterprise Summit - AWS로 엔터프라이즈 솔루션 구축 및 운영하기 - 이종남
AWS Enterprise Summit - AWS로 엔터프라이즈 솔루션 구축 및 운영하기 - 이종남AWS Enterprise Summit - AWS로 엔터프라이즈 솔루션 구축 및 운영하기 - 이종남
AWS Enterprise Summit - AWS로 엔터프라이즈 솔루션 구축 및 운영하기 - 이종남
 
Best Practices for Deploying Microsoft Workloads on AWS
Best Practices for Deploying Microsoft Workloads on AWSBest Practices for Deploying Microsoft Workloads on AWS
Best Practices for Deploying Microsoft Workloads on AWS
 
AWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv Singhal
AWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv SinghalAWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv Singhal
AWS Innovate: Best of Both Worlds: Leveraging Hybrid IT with AWS- Dhruv Singhal
 
Running Microsoft Workloads on AWS | AWS Public Sector Summit 2016
Running Microsoft Workloads on AWS | AWS Public Sector Summit 2016Running Microsoft Workloads on AWS | AWS Public Sector Summit 2016
Running Microsoft Workloads on AWS | AWS Public Sector Summit 2016
 
AWS Workshop Series: Microsoft SQL server and SharePoint on AWS
AWS Workshop Series: Microsoft SQL server and SharePoint on AWSAWS Workshop Series: Microsoft SQL server and SharePoint on AWS
AWS Workshop Series: Microsoft SQL server and SharePoint on AWS
 
Microservizi e container Docker in produzione: strumenti e consigli
Microservizi e container Docker in produzione: strumenti e consigliMicroservizi e container Docker in produzione: strumenti e consigli
Microservizi e container Docker in produzione: strumenti e consigli
 
Best practices to Support Active Directory Aware Workloads on AWS
Best practices to Support Active Directory Aware Workloads on AWSBest practices to Support Active Directory Aware Workloads on AWS
Best practices to Support Active Directory Aware Workloads on AWS
 
Vancouver keynote - AWS Innovate - Sam Elmalak
Vancouver keynote - AWS Innovate - Sam ElmalakVancouver keynote - AWS Innovate - Sam Elmalak
Vancouver keynote - AWS Innovate - Sam Elmalak
 
Running Business-Critical Applications on the AWS Cloud
Running Business-Critical Applications on the AWS CloudRunning Business-Critical Applications on the AWS Cloud
Running Business-Critical Applications on the AWS Cloud
 
Getting Started with Windows Workloads on Amazon EC2
 Getting Started with Windows Workloads on Amazon EC2 Getting Started with Windows Workloads on Amazon EC2
Getting Started with Windows Workloads on Amazon EC2
 
Getting Started with Managed Services | AWS Public Sector Summit 2016
Getting Started with Managed Services | AWS Public Sector Summit 2016Getting Started with Managed Services | AWS Public Sector Summit 2016
Getting Started with Managed Services | AWS Public Sector Summit 2016
 
AWS solution Architect Associate study material
AWS solution Architect Associate study materialAWS solution Architect Associate study material
AWS solution Architect Associate study material
 
Enterprise Workloads on AWS
Enterprise Workloads on AWSEnterprise Workloads on AWS
Enterprise Workloads on AWS
 
Migration of Microsoft Workloads
Migration of Microsoft WorkloadsMigration of Microsoft Workloads
Migration of Microsoft Workloads
 

Semelhante a Architecture: When, how, and if to Adopt Microservices

Semelhante a Architecture: When, how, and if to Adopt Microservices (20)

Architecture: Microservices
Architecture: MicroservicesArchitecture: Microservices
Architecture: Microservices
 
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
AWS re:Invent 2016: Running Microservices on Amazon ECS (CON309)
 
Introducing to serverless computing and AWS lambda - Israel Clouds Meetup
Introducing to serverless computing and AWS lambda - Israel Clouds MeetupIntroducing to serverless computing and AWS lambda - Israel Clouds Meetup
Introducing to serverless computing and AWS lambda - Israel Clouds Meetup
 
Microservices and Serverless for Mega Startups - DevOps IL Meetup
Microservices and Serverless for Mega Startups - DevOps IL MeetupMicroservices and Serverless for Mega Startups - DevOps IL Meetup
Microservices and Serverless for Mega Startups - DevOps IL Meetup
 
Container Days: Architecting Modern Apps on AWS
Container Days: Architecting Modern Apps on AWSContainer Days: Architecting Modern Apps on AWS
Container Days: Architecting Modern Apps on AWS
 
Accelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and KubernetesAccelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and Kubernetes
 
Build intelligent solutions using Azure
Build intelligent solutions using AzureBuild intelligent solutions using Azure
Build intelligent solutions using Azure
 
From Monolith to Microservices
From Monolith to MicroservicesFrom Monolith to Microservices
From Monolith to Microservices
 
Automating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native MeetupAutomating Applications with Habitat - Sydney Cloud Native Meetup
Automating Applications with Habitat - Sydney Cloud Native Meetup
 
Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015Application Centric Microservices from Redhat Summit 2015
Application Centric Microservices from Redhat Summit 2015
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 
Start Up Austin 2017: If How and When to Adopt Microservices
Start Up Austin 2017: If How and When to Adopt MicroservicesStart Up Austin 2017: If How and When to Adopt Microservices
Start Up Austin 2017: If How and When to Adopt Microservices
 
Containers and the Evolution of Computing
Containers and the Evolution of ComputingContainers and the Evolution of Computing
Containers and the Evolution of Computing
 
SRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and DockerSRV409 Deep Dive on Microservices and Docker
SRV409 Deep Dive on Microservices and Docker
 
Microsoft, Linux, Open Source, DevOps
Microsoft, Linux, Open Source, DevOpsMicrosoft, Linux, Open Source, DevOps
Microsoft, Linux, Open Source, DevOps
 
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWSAWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
 
Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?Containerize, PaaS, or Go Serverless!?
Containerize, PaaS, or Go Serverless!?
 
JAX 2014 - The PaaS to a better IT architecture.
JAX 2014 - The PaaS to a better IT architecture.JAX 2014 - The PaaS to a better IT architecture.
JAX 2014 - The PaaS to a better IT architecture.
 
Microsoft, Linux, Open Source, DevOps
Microsoft, Linux, Open Source, DevOpsMicrosoft, Linux, Open Source, DevOps
Microsoft, Linux, Open Source, DevOps
 
Micro services
Micro servicesMicro services
Micro services
 

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
 

Architecture: When, how, and if to Adopt Microservices

  • 1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amit Jha Solution Architect – Global Financial Services AWS Startup Day If when and how to adopt microservices
  • 2. “The Monolith” Monoliths can be GOOD when you are starting out Always build to keep things as simple as possible When your application or company grows, Monoliths begin slowing you down. Let’s look at the challenges as you grow..
  • 3. Challenges with monolithic software Long Build/Test/Release Cycles (who broke the build?) Operations is a nightmare (module X is failing, who’s the owner?) Difficult to scale New releases take months Long time to add new features Architecture is hard to maintain and evolve Lack of innovation Frustrated customers Lack of agility
  • 4. Long Build/Test/Release Cycles (who broke the build?) Operations is a nightmare (module X is failing, who’s the owner?) Difficult to scale New releases take months Long time to add new features Architecture is hard to maintain and evolve Lack of innovation Frustrated customers Lack of agility Challenges with monolithic software
  • 5. Long Build/Test/Release Cycles (who broke the build?) Operations is a nightmare (module X is failing, who’s the owner?) Difficult to scale New releases take months Long time to add new features Architecture is hard to maintain and evolve Lack of innovation Frustrated customers Lack of agility Challenges with monolithic software
  • 7. Too much software coupling
  • 8. Shared libraries Too much software coupling
  • 9. Shared libraries Shared data Too much software coupling
  • 10.
  • 11. Silo’d functional teams à silo’d application architectures Image from Martin Fowler’s article on microservices, at http://martinfowler.com/articles/microservices.html No alterations other than cropping. Permission to reproduce: http://martinfowler.com/faq.html
  • 12. Cross functional teams à self-contained services Image from Martin Fowler’s article on microservices, at http://martinfowler.com/articles/microservices.html No alterations other than cropping. Permission to reproduce: http://martinfowler.com/faq.html
  • 13. Full ownership Full accountability Aligned incentives “DevOps” Non-pizza image from Martin Fowler’s article on microservices, at http://martinfowler.com/articles/microservices.html No alterations other than cropping. Permission to reproduce: http://martinfowler.com/faq.html Cross functional teams à self-contained services (“Two-pizza teams”)
  • 17. releasetestbuild releasetestbuild Focused agile teams 2-pizza team delivery pipeline service releasetestbuild releasetestbuild
  • 18. releasetestbuild releasetestbuild Focused agile teams 2-pizza team delivery pipeline service releasetestbuild releasetestbuild releasetestbuild
  • 19. releasetestbuild releasetestbuild Focused agile teams 2-pizza team delivery pipeline service releasetestbuild releasetestbuild releasetestbuild releasetestbuild
  • 20.
  • 21. It’s a journey… Expect challenges along the way… • Understanding of business domains • Eventual Consistency • Service discovery • Lots of moving parts requires increased coordination • Complexity of testing / deploying / operating a distributed system • Cultural transformation
  • 22. = 50 million deployments a year Thousands of teams × Microservice architecture × Continuous delivery × Multiple environments (5708 per hour, or every 0.63 second)
  • 23.
  • 24. “service-oriented architecture composed of loosely coupled elements that have bounded contexts” Adrian Cockcroft (VP of Cloud Architecture @ AWS, former Cloud Architect at Netflix)
  • 25. “service-oriented architecture composed of loosely coupled elements that have bounded contexts” Services communicate with each other over the network Adrian Cockcroft (VP of Cloud Architecture @ AWS, former Cloud Architect at Netflix)
  • 26. “service-oriented architecture composed of loosely coupled elements that have bounded contexts” You can update the services independently; updating one service doesn’t require changing any other services. Adrian Cockcroft (VP of Cloud Architecture @ AWS, former Cloud Architect at Netflix)
  • 27. “service-oriented architecture composed of loosely coupled elements that have bounded contexts” Self-contained; you can update the code without knowing anything about the internals of other microservices Adrian Cockcroft (VP of Cloud Architecture @ AWS, former Cloud Architect at Netflix)
  • 28. Anatomy of a Microservice
  • 29. Data Store (eg, RDS, DynamoDB ElastiCache, ElasticSearch) Anatomy of a Microservice
  • 30. Application/Logic (code, libraries, etc) Data Store (eg, RDS, DynamoDB ElastiCache, ElasticSearch) Anatomy of a Microservice
  • 31. Public API POST /restaurants GET /restaurants Application/Logic (code, libraries, etc) Data Store (eg, RDS, DynamoDB ElastiCache, ElasticSearch) Anatomy of a Microservice
  • 34. AWS Services (Enablers for Microservices)…
  • 35. Elastic Compute Cloud (EC2) Virtual Servers in the Cloud § Resizable Compute Capacity § Complete control of your computing resources § Reduces time to obtain and boot new server instances to minutes § Choose from 30+ different instance types § Scale as your requirements change § Pay only for what you use Compute
  • 39. Micro-service Design EC2EC2 EC2 EC2 Elastic Load Balancer
  • 40. Micro-service Design EC2EC2 EC2 EC2 Elastic Load Balancer AWS Elastic Beanstalk
  • 41. Elastic Beanstalk vs. DIY Your code HTTP server Application server Language interpreter Operating system Host Elastic Beanstalk configures each EC2 instance in your environment with the components necessary to run applications for the selected platform. No more worrying about logging into instances to install and configure your application stack. Focus on building your application Provided by you Provided and managed by Elastic Beanstalk On-instance configuration
  • 42. EC2 Container Service Run and Manage Docker Containers § A high performance container management service for running Docker containers on EC2 instances § Use the built in scheduler, write your own, or use a third-party scheduler § Integrates with other services like ELB and EBS § No additional charge § EC2 Container Registry Compute
  • 43. Micro-service Design EC2EC2 EC2 EC2 Elastic Load Balancer
  • 44. Micro-service Design EC2EC2 EC2 EC2 Elastic Load Balancer
  • 45. Micro-service Design EC2EC2 EC2 EC2 Elastic Load Balancer Amazon EC2 Container Service (ECS) to manage containers
  • 46. Lambda Run Code in Response to Events § Runs code in response to triggers such as S3 upload, DynamoDB updates, Kinesis streams, and API Gateway requests § Automatically scales § You only need to provide the code; there is no infrastructure to manage § Pay only for what you use Compute
  • 47. Lambda automatically scales Upload your code (Java, JavaScript, Python) Pay for only the compute time you use (sub-second metering) Set up your code to trigger from other AWS services, webservice calls, or app activity
  • 48. Application Services API Gateway Build, Publish and Manage APIs § Performance at any scale via worldwide edge locations, traffic throttling, and API output caching § Monitor API activity § Integrates with Lambda functions § Run multiple versions of the same API § Fully Managed
  • 49. Create a unified API frontend for multiple micro-services …as well as monitoring, logging, rollbacks, client SDK generation… Authenticate and authorize requests Handles DDoS protection and API throttling
  • 50. DynamoDB Predictable and Scalable NoSQL Data Store § Fast, fully-managed NoSQL Database Service § Capable of handling any amount of data § Durable and Highly Available § All SSD storage § Simple and Cost Effective Database
  • 51. Gilt Luxury designer brands at members-only prices
  • 52. Gilt Luxury designer brands at members-only prices .. Sale every day at noon EST
  • 53.
  • 54. Microservices Architecture Internet Mobile Apps Websites Services AWS Lambda functions AWS API Gateway Cache Endpoints on Amazon EC2 /ECS Amazon Elastic Beanstalk Any other publicly accessible endpoint Amazon CloudWatch Monitoring Amazon API Gateway
  • 55. Principle 1 Microservices only rely on each other’s public API “Contracts” by NobMouse. No alterations other than cropping. https://www.flickr.com/photos/nobmouse/4052848608/ Image used with permissions under Creative Commons license 2.0, Attribution Generic License (https://creativecommons.org/licenses/by/2.0/)
  • 56. Micro-service A Micro-service B public API public API Principle 1: Microservices only rely on each other’s public API
  • 57. public API public API Micro-service A Micro-service B Principle 1: Microservices only rely on each other’s public API Hide your data!
  • 58. public API public API Nope! Micro-service A Micro-service B Principle 1: Microservices only rely on each other’s public API Hide your data!
  • 59. public API public API Micro-service A Micro-service B Principle 1: Microservices only rely on each other’s public API Hide your data!
  • 60. Principle 1: Microservices only rely on each other’s public API storeRestaurant (id, name, cuisine) Version 1.0.0 public API Micro-service A Evolve API in backward-compatible way .. And document!
  • 61. Principle 1: Microservices only rely on each other’s public API storeRestaurant (id, name, cuisine) storeRestaurant (id, name, cuisine) storeRestaurant (id, name, arbitrary_metadata) addReview (restaurantId, rating, comments) Version 1.0.0 Version 1.1.0 public API Micro-service A Evolve API in backward-compatible way .. And document!
  • 62. storeRestaurant (id, name, cuisine) storeRestaurant (id, name, cuisine) storeRestaurant (id, name, arbitrary_metadata) addReview (restaurantId, rating, comments) storeRestaurant (id, name, arbitrary_metadata) addReview (restaurantId, rating, comments) Version 1.0.0 Version 1.1.0 Version 2.0.0 public API Micro-service A Evolve API in backward-compatible way .. And document! Principle 1: Microservices only rely on each other’s public API
  • 63. Principle 2 Use the right tool for the job “Tools #2” by Juan Pablo Olmo. No alterations other than cropping. https://www.flickr.com/photos/juanpol/1562101472/ Image used with permissions under Creative Commons license 2.0, Attribution Generic License (https://creativecommons.org/licenses/by/2.0/)
  • 64. public API public API DynamoDB Micro-service A Micro-service B Embrace polyglot persistence Principle 2: Use the right tool for the job
  • 65. public API public API DynamoDB Micro-service A Micro-service B Amazon Elasticsearch Service Embrace polyglot persistence Principle 2: Use the right tool for the job
  • 66. public API public API RDS Aurora Micro-service A Micro-service B Amazon Elasticsearch Service Embrace polyglot persistence Principle 2: Use the right tool for the job
  • 67. public API public API RDS Aurora Micro-service A Micro-service B Amazon Elasticsearch Service Embrace polyglot programming frameworks Principle 2: Use the right tool for the job
  • 68. public API public API RDS Aurora Micro-service A Micro-service B Amazon Elasticsearch Service Embrace polyglot programming frameworks Principle 2: Use the right tool for the job
  • 69. Principle 3 Secure Your Services “security” by Dave Bleasdale. No alterations other than cropping. https://www.flickr.com/photos/sidelong/3878741556/ Image used with permissions under Creative Commons license 2.0, Attribution Generic License (https://creativecommons.org/licenses/by/2.0/)
  • 70. • Defense-in-depth • Network level (e.g. VPC, Security Groups, TLS) • Server/container-level • App-level • IAM policies • Gateway (“Front door”) • API Throttling • Authentication & Authorization • Client-to-service, as well as service-to-service • API Gateway: custom Lambda authorizers • Token-based auth (JWT tokens, OAuth 2.0) • IAM-based Authentication • Secrets management • S3 bucket policies + KMS + IAM • Open-source tools (e.g. Vault, Keywhiz) API Gateway Principle 3: Secure your services
  • 71. Principle 4 Be a good citizen within the ecosystem “Lamington National Park, rainforest” by Jussarian. No alterations other than cropping. https://www.flickr.com/photos/kerr_at_large/87771074/ Image used with permissions under Creative Commons license 2.0, Attribution Generic License (https://creativecommons.org/licenses/by/2.0/)
  • 72. Hey Sally, we need to call your micro-service to fetch restaurants details. Sure Paul. Which APIs you need to call? Once I know better your use cases I’ll give you permission to register your service as a client on our service’s directory entry. Micro-service A Micro-service B public API public API Principle 4: Be a good citizen within the ecosystem Proper retries with exponential backoff
  • 73. Restaurant Micro-service 15 TPS100 TPS5 TPS20 TPS Before we let you call our micro-service we need to understand your use case, expected load (TPS) and accepted latency Have clear SLAs Principle 4: Be a good citizen within the ecosystem
  • 74. Distributed monitoring and tracing • “Is the service meeting its SLA?” • “Which services were involved in a request?” • “How did downstream dependencies perform?” Shared metrics • e.g. request time, time to first byte Distributed tracing • e.g. Zipkin, OpenTracing User-experience metrics Distributed monitoring, logging, and tracing Principle 4: Be a good citizen within the ecosystem
  • 75. AWS X-Ray Distributed tracing service that enables developers to analyze the behavior of their applications
  • 76. AWS X-Ray traces requests made to your application X-Ray service X-Ray combines the data gathered from each service into singular units called traces View the service map to see trace data such as latencies, HTTP statuses, and metadata for Drill into the service showing unusual behavior to identify the root issue X-Ray collects data about the request from each of the underlying applications services it passes through
  • 77. Principle 6: Automate everything AWS CodeCommit AWS CodePipeline AWS CodeDeploy ELB Auto ScalingEC2 Lambda ECS DynamoDBRDS ElastiCache SQS SWF SESSNS API GatewayCloudWatch Cloud Trail Kinesis Elastic Beanstalk
  • 78. Principles of Microservices 1. Rely only on the public API Ÿ Hide your data Ÿ Document your APIs Ÿ Define a versioning strategy 2. Use the right tool for the job Ÿ Container journey? (use ECS) Ÿ Polyglot persistence (data layer) Ÿ Polyglot frameworks (app layer) 3. Secure your services Ÿ Defense-in-depth Ÿ Authentication/authorization 6. Automate everything Ÿ Adopt DevOps 4. Be a good citizen within the ecosystem Ÿ Have SLAs Ÿ Distributed monitoring, logging, tracing 5. More than just technology transformation Ÿ Embrace organizational change Ÿ Favor small focused dev teams
  • 79. It’s a journey… Expect challenges along the way… • Understanding of business domains • Coordinating txns across multiple services • Eventual Consistency • Service discovery • Lots of moving parts requires increased coordination • Complexity of testing / deploying / operating a distributed system • Cultural transformation
  • 80. AWS resources: • Microservices without the Servers https://aws.amazon.com/blogs/compute/ microservices-without-the-servers • Microservices with ECS: https://aws.amazon.com/blogs/compute/using-amazon- api-gateway-with-microservices-deployed-on-amazon-ecs/ • Serverless Service Discovery: https://aws.amazon.com/blogs/developer/ serverless-service-discovery-part-1-get-started/ • ECS Service Discovery: https://aws.amazon.com/blogs/compute/ service-discovery-an-amazon-ecs-reference-architecture/ • Serverless Webapp - Reference Architecture: https://github.com/awslabs/lambda-refarch-webapp • Zombie Microservices Workshop: https://github.com/awslabs/aws-lambda-zombie-workshop Additional Resources