barcelona - amazon s3 · evolving architecture patterns in the cloud daniele stroppa, aws solutions...
TRANSCRIPT
![Page 1: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/1.jpg)
BARCELONA
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved
![Page 2: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/2.jpg)
©2015, Amazon Web Services, Inc. or its affiliates. All rights reserved
From Monolithic to MicroservicesEvolving Architecture Patterns in the Cloud
Daniele Stroppa, AWS Solutions Architect
Teo Ruiz, VP Engineering @ Jobandtalent
![Page 3: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/3.jpg)
![Page 4: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/4.jpg)
Common Challenges and
Patterns
![Page 5: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/5.jpg)
Monolithic Microservices
• Simple deployments
• Binary failure modes
• Inter-module refactoring
• Technology monoculture
• Vertical scaling
• Partial deployments
• Graceful degradation
• Strong module boundaries
• Technology diversity
• Horizontal scaling
![Page 6: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/6.jpg)
• Organization
• Discovery
• Data management
• Deployment
• I/O explosion
• Monitoring
Common Challenges and Patterns
![Page 7: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/7.jpg)
Organization
![Page 8: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/8.jpg)
Monolithic Ownership
• Organized on technology capabilities
UI Team
DBA Team
App Logic Team
Web Tier
App Tier
DB
Organizational Structure Application Architecture
![Page 9: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/9.jpg)
Microservices Ownership
• Organized on business responsibilities
Login
Registration
Order
Personalization
Accounts team
Mobile
Personalization team Mobile team
![Page 10: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/10.jpg)
Microservices Ownership
• Requirements
• Technology selection
• Development
• Quality
• Deployment
• Support
![Page 11: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/11.jpg)
How to Be a Good Citizen (Service Consumer)
• Design for failure
• Expect to be throttled
• Retry w/ exponential backoff
• Degrade gracefully
• Cache when appropriate
![Page 12: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/12.jpg)
How to Be a Good Citizen (Service Provider)
• Publish your metrics
• Protect yourself
• Keep your implementation details private
• Maintain backwards compatibility
![Page 13: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/13.jpg)
Amazon API Gateway
• Throttling (global and per-method)
• Caching (with TTLs and invalidation)
• Monitoring (RPS, latency, error rate)
• Versioning
• Authentication
![Page 14: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/14.jpg)
Discovery
![Page 15: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/15.jpg)
Use DNS
• Convention-based naming
<service-name>-<environment>.domain.com
shoppingcart-gamma.example.com
<service-name>.<environment>.domain.com
shoppingcart.gamma.example.com
![Page 16: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/16.jpg)
Use a Dynamic Service Registry
• Avoids the DNS TTL issue
• More than service registry & discovery– Configuration management
– Health checks
• Plenty of options– ZooKeeper (Apache)
– Eureka (Netflix)
– Consul (HashiCorp)
– SmartStack (Airbnb)
![Page 17: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/17.jpg)
Data management
![Page 18: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/18.jpg)
Challenge: Centralized Database
Monolithic applications typically have a monolithic data store:
• Difficult to make schema changes
• Technology lock-in
• Vertical scaling
• Single point of failure
user-svc account-svccart-svc
DB
![Page 19: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/19.jpg)
Centralized Database – Anti-pattern
Monolithic applications typically have a monolithic data store:
• Difficult to make schema changes
• Technology lock-in
• Vertical scaling
• Single point of failure
user-svc account-svccart-svc
DB
![Page 20: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/20.jpg)
Decentralized Data Stores
• Each service chooses its
data store technologies
• Low impact schema
changes
• Independent scalability
• Data is gated through
the service API
account-
svc
cart-
svc
DynamoDB RDS
user-
svc
ElastiCache RDS
![Page 21: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/21.jpg)
Challenge: Transactional Integrity
• Use a pessimistic model• Handle it in the client
• Add a transaction manager / distributed locking service
• Rethink your design
• Use an optimistic model• Accept eventual consistency
• Retry (if idempotent)
• Fix it later
• Write it off
![Page 22: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/22.jpg)
Challenge: Aggregation
• Pull: Make the data available via your service API
• Push: To Amazon S3, Amazon CloudWatch, or
another service you create
• Pub/sub: Via Amazon Kinesis or Amazon SQS
![Page 23: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/23.jpg)
Deployment
![Page 24: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/24.jpg)
Continuous Delivery & Continuous
Deployment
• Create the right build pipeline for each service
• AWS CodeDeploy
• AWS Elastic Beanstalk
• Jenkins, CircleCI, Travis,…
Integration
& perf tests
Build &
unit testsbeta Produser-svc
Integration &
perf tests
Build &
unit testsbeta gamma Prodcart-svc
![Page 25: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/25.jpg)
AWS CodePipeline
![Page 26: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/26.jpg)
Multiple Services per Container/Instance
• Independent monitoring
• Independent scaling
• Clear ownership
• Immutable deployments
user-svc
cart-svc
account-svc
Container or instance
![Page 27: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/27.jpg)
Multiple Services per Container/Instance – Anti-pattern
• Independent monitoring
• Independent scaling
• Clear ownership
• Immutable deployments
user-svc
cart-svc
account-svc
Container or instance
![Page 28: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/28.jpg)
Single Service per Container/Instance
• Independent monitoring
• Independent scaling
• Clear ownership
• Immutable deployments
user-svc
container or instance
account-svc
cart-svc
container or instance
container or instance
![Page 29: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/29.jpg)
…Or Just Use AWS Lambda
LambdaAPI Gateway
RDS
DynamoDB
![Page 31: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/31.jpg)
Challenge: Request Multiplication
checkout-
svc
cart-svc
account-svc
user-svc
Single request
![Page 32: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/32.jpg)
Add Client Caching
checkout-
svc
cart-svc
account-svc
user-svc
Single request
cache
user & account cache
![Page 33: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/33.jpg)
Challenge: Hotspots
cart-svc order-svcshipping-
svc
user-svc
single request
get (user x, col y) get (user x, col y) get (user x, col y)
![Page 34: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/34.jpg)
Use Dependency Injection
cart-svc order-svcshipping-
svc
user-svc
single request
get (user x, col y)
(user x, col y) (user x, col y)
![Page 35: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/35.jpg)
Monitoring
![Page 36: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/36.jpg)
Challenge: monitoring
• Publish externally relevant metrics– Latency
– RPS
– Error rate
• Understand internally relevant metrics– Basic – CloudWatch
– OS
– Application
![Page 37: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/37.jpg)
Challenge: Logging
• Pick a common log aggregation solution
• Agree on log entry formats
• Use naming conventions
• Agree on correlation strategy
![Page 38: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/38.jpg)
Challenge: Correlating Requests
ui-svc catalog-
svc
checkout-
svc
shipping-
svc
payment-
svc
request
![Page 39: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/39.jpg)
Use Correlation IDs
• 09-02-2015 15:03:24 ui-svc INFO [uuid-123] ……
• 09-02-2015 15:03:25 catalog-svc INFO [uuid-123] ……
• 09-02-2015 15:03:26 checkout-svc ERROR [uuid-123] ……
• 09-02-2015 15:03:27 payment-svc INFO [uuid-123] ……
• 09-02-2015 15:03:27 shipping-svc INFO [uuid-123] ……
ui-svc catalog-
svc
checkout-
svc
shipping-
svc
payment-
svc
request correlation id:
“uuid-123”correlation id:
“uuid-123”
![Page 40: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/40.jpg)
What did we cover?
• Ownership
• Discovery
• Data management
• Deployment
• I/O explosion
• Monitoring
![Page 41: BARCELONA - Amazon S3 · Evolving Architecture Patterns in the Cloud Daniele Stroppa, AWS Solutions Architect ... (Netflix) – Consul (HashiCorp) – SmartStack (Airbnb) Data management](https://reader035.vdocuments.net/reader035/viewer/2022063007/5fb93dd0f397fa0e4744e9eb/html5/thumbnails/41.jpg)
BARCELONA