SlideShare a Scribd company logo
1 of 36
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Pop-up Loft
Data Design for Microservices
Bill Baldwin
DBS Technical Evangelist
bbaldwin@amazon.com
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Microservices at Amazon
• Service-Oriented Architecture
(SOA)
• Single-purpose
• Connect only through APIs
• Connect over HTTPS
• “Microservices”
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Monolithic vs. SOA vs. Microservices
Microservices:
• Many very small
components
• Business logic lives inside of
single service domain
• Simple wire protocols(HTTP
with XML/JSON)
• API driven with
SDKs/Clients
SOA:
• Fewer more sophisticated
components
• Business logic can live across
domains
• Enterprise Service Bus like
layers between services
• Middleware
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Monolithic vs. SOA vs. Microservices
SOA
Coarse-grained
Microservices
Fine-grained
Monolithic
Single Unit
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Microservice Challenges
• Distributed computing is hard
• Transactions
– Multiple Databases across multiple services
• Eventual Consistency
• Lots of moving parts
• Service discovery
• Increase coordination
• Increase message routing
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Key Elements of Microservices…
• Some core concepts are common to all services
– Service registration, discovery, wiring, administration
– State management
– Service metadata
– Service versioning
– Caching
• Low Friction Deployment
• Automated Management and Monitoring
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Key Elements of Microservices…
• Eliminates any long-term commitment to a technology stack
• Polyglot ecosystem
• Polyglot persistence
– Decompose Databases
– Database per microservice pattern
• Allows easy use of Canary and Blue-Green deployments
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Key Elements of Microservices…
• Each microservice is:
– Elastic: scales up or down independently of other services
– Resilient: services provide fault isolation boundaries
– Composable: uniform APIs for each service
– Minimal: highly cohesive set of entities
– Complete: loosely coupled with other services
Controller A Controller B
Controller A Controller B
Q Q
Tight Coupling
Loose Coupling
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Microservices Benefits
• Fast to develop
• Rapid deployment
• Parallel development & deployment
• Closely integrated with DevOps
– Now ”DevSecOps”
• Improved scalability, availability & fault tolerance
• More closely aligned to business domain
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
• Two-pizza teams
• Full ownership
• Full accountability
• Aligned incentives
• “DevOps”
Principles of the Two Pizza Team
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
How do Two Pizza Teams work?
We call them “Service teams”
• Own the “primitives” they build:
– Product planning (roadmap)
– Development work
– Operational/Client support work
• “You build it, you run it”
• Part of a larger concentrated org
– Amazon.com, AWS, Fresh, …
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Data Architecture Challenges
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Challenge: Centralized Database
user-svc account-svccart-svc
DB
Applications often have a
monolithic data store
• Difficult to make schema
changes
• Technology lock-in
• Vertical scaling
• Single point of failure
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Centralized Database – Anti-pattern
user-svc account-svccart-svc
DB
Applications often have a
monolithic data store
• Difficult to make schema
changes
• Technology lock-in
• Vertical scaling
• Single point of failure
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Decentralized Data Stores
account-svccart-svc
DynamoDB RDS
user-svc
ElastiCache RDS
Polyglot Persistence
• Each service chooses its data
store technology
• Low impact schema changes
• Independent scalability
• Data is gated through the
service API
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Challenge: Transactional Integrity
• Polyglot persistence generally translates into eventual
consistency
• Asynchronous calls allow non-blocking, but returns
need to be handled properly
• How about transactional integrity?
• Event-sourcing – Capture changes as
sequence of events
• Staged commit
• Rollback on failure
ERROR
STATE?
ROLLBACK?
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Best Practice: 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”
correlation id:
“uuid-123”
correlation id:“uuid-123”
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Best Practice: Microservice owns Rollback
• Every microservice should expose
its own “rollback” method
• This method could just rollback
changes, or trigger subsequent
actions
• Could send a notification
• If you implement staged commit, also
expose a commit function
Microservice
Function 1
Rollback
Commit
(optional)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Event-Driven: DynamoDB Streams
• If async, consider event-driven approach
with DynamoDB Streams
• Don’t need to manage function
execution failure, DDB Streams
automatically retries until successful
• “Attach” yourself to the data of interest
Microservice
Dynam
oDB
Stream
s
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Challenge: Report Errors / Rollback
• What if functions fail? (business logic failure,
not code failure)
• Create a “Transaction Manager” microservice
that notifies all relevant microservices to
rollback or take action
• DynamoDB is the trigger for the clean-up
function (could be SQS, Kinesis etc.)
• Use Correlation ID to identify relations
mm-svc
Transaction
Manager
Function
DDB Streams
API Call
Error Table
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Challenge: Report Errors / Rollback
ERROR
DynamoDB
Error Table
Transaction
Manager
Function
Kinesis
Error Stream
SQS
Error Queue
Rollback
(correlation-id)
Rollback
(correlation-id)
Rollback
(correlation-id)
Rollback
(correlation-id)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Challenge: Code Error
Lambda Execution Error because of
faulty code
Leverage Cloudwatch Logs to process
error message and call Transaction
Manager
Set Cloudwatch Logs Metric Filter to look
for Error/Exception and call Lambda
Handler upon Alarm state
ui-svc
Cloudwatch
Logs
Cloudwatch
Alarm
Transaction
Manager
Function
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Beware: Stream Model with AWS Lambda
• DynamoDB Streams and Kinesis streams directly work with
AWS Lambda, however AWS Lambda needs to acknowledge
processing the message correctly
• If Lambda fails to process the message, the stream horizon will
not be moved forward, creating a “jam”
• Solution: Monitor AWS Lambda Error CloudWatch Metric and
react when error rate of same “Correlation ID” keeps
increasing
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Keep Data Consistent
Databases
AWS Lambda
“Cleanup”
Function
Cloudwatch
Scheduled Event
• Perform Master Data Management
(MDM) to keep data consistent
• Create AWS Lambda function to check
consistencies across microservices and
“cleanup”
• Create CloudWatch Event
to schedule the function
(e.g. hourly basis)
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Choosing a Datastore
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Storage & DB options in AWS
Amazon
RDS
Amazon
DynamoDB
Amazon
Elasticsearch
Service
Amazon
S3
Amazon
Kinesis
Amazon
ElastiCache
In-Memory NoSQL SQL SearchObject Streaming
Amazon
Redshift
Amazon
Glacier
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Challenge: What Service to Use?
• Many problems can be solved with NoSQL, RDBMS or even
in-memory cache technologies
• Non-functional requirements can help identify appropriate
services
• Solution: Classify your organizations non-functional
requirements and map them to service capabilities
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Determine Your Non-Functional Requirements
Requirement
Latency > 1s 200 ms -1s 20 ms – 200 ms < 20 ms
Durability 99.99 99.999 99.9999 > 99.9999
Storage Scale < 256 GB 256 GB – 1 TB 1 TB – 16 TB > 16 TB
Availability 99 99.9 99.95 > 99.95
Data Class Public Important Secret Top Secret
Recoverability 12 – 24 hours 1 – 12 hours 5 mins – 1 hour < 5 mins
Skills None Average Good Expert
This is only an example. Your classifications will be different
There will be other requirements such as regulatory compliance too.
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Map Non-Functional Requirements to Services
Service Latency Durability Storage Availability Recoverability from AZ Failure
(RPO, RTO)
RDS < 100 ms > 99.8 (EBS) 16 TB 99.95 0s and 90s (MAZ)
Aurora < 100 ms > 99.9 64 TB > 99.95 0s and < 30s (MAZ)
Aurora + ElastiCache < 1 ms > 99.9 64 TB > 99.95 0s and < 30s (MAZ)
DynamoDB < 10 ms > 99.9 No Limit > 99.99 0s and 0s
DynamoDB / DAX < 1 ms > 99.9 No Limit > 99.99 0s and 0s
ElastiCache Redis < 1 ms N/A 6.1 TiB 99.95 0s and < 30s (MAZ)
Elasticsearch < 200 ms > 99.9 1.5 PB 99.95 0s and < 30s (Zone Aware)
S3 < 500 ms 99.999999999 No Limit 99.99 0s and 0s
The information below is not exact and does not represent SLAs
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Finalizing Your Data Store Choices
• After mapping your non-functional requirements to services you should
have a short list to choose from
• Functional requirements such as geospatial data and query support will
refine the list further
• You may institute standards to make data store selection simpler and also
make it easier for people to move between teams. These can still be
overridden, but require justification to senior management
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Challenge: Reporting and Analytics
• Data is now spread across a number of isolated polyglot data
stores
• Consolidation and aggregation required
• Solution: Pull data from required microservices, push data to
data aggregation service, use pub/sub, or use a composite
service (anti-pattern).
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Aggregation
usr svc
Pull model Push model
Data Aggregation
Application
usr svc
Data
Aggregation
Application
Pub/Sub Composite
Composite Data Service
usr account cart
account svc cart svc
account svc
cart svc
Pub Sub
usr svc
account svc
cart svc
Data
Aggregation
Application
Push
Pull
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
A Few Thoughts
• Use Non-Functional Requirements to help identify the right
data store(s) for each microservice
• Use polyglot persistence to avoid bottlenecks, schema issues
and allow independent scalability (and cache)
• Embrace eventual consistency and design fault-tolerant
business processes which can recover
• Think ahead and plan your analytics requirements as part of
the overall architecture
© 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Pop-up Loft
aws.amazon.com/activate
Everything and Anything Startups
Need to Get Started on AWS

More Related Content

What's hot

Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...
Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...
Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...Amazon Web Services
 
Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018AWS Germany
 
Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...
Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...
Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...Amazon Web Services
 
Flexiant and 451 Research Discuss the Service Provider Path from VPS to IaaS
Flexiant and 451 Research Discuss the Service Provider Path from VPS to IaaSFlexiant and 451 Research Discuss the Service Provider Path from VPS to IaaS
Flexiant and 451 Research Discuss the Service Provider Path from VPS to IaaSFlexiant
 
Migrating from a monolith to microservices – is it worth it?
Migrating from a monolith to microservices – is it worth it?Migrating from a monolith to microservices – is it worth it?
Migrating from a monolith to microservices – is it worth it?Katherine Golovinova
 
Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018
Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018
Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018Amazon Web Services
 
Come costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWSCome costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWSAmazon Web Services
 
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...Amazon Web Services
 
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 ...AWS Summits
 
VMware Cloud on AWS Cloud Migration Deep Dive
 VMware Cloud on AWS Cloud Migration Deep Dive VMware Cloud on AWS Cloud Migration Deep Dive
VMware Cloud on AWS Cloud Migration Deep DiveAmazon Web Services
 
From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...
From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...
From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...Amazon Web Services
 
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 2018Amazon Web Services
 
Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018AWS Germany
 
Innovating with AWS: How Microservices on AWS Can Transform Your Business
Innovating with AWS: How Microservices on AWS Can Transform Your BusinessInnovating with AWS: How Microservices on AWS Can Transform Your Business
Innovating with AWS: How Microservices on AWS Can Transform Your BusinessAmazon Web Services
 
Serverless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best PracticesServerless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best PracticesAmazon Web Services
 
Track 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptx
Track 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptxTrack 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptx
Track 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptxAmazon Web Services
 

What's hot (19)

Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...
Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...
Deep Dive on Amazon Managed Blockchain: re:Invent 2018 Recap at the AWS Loft ...
 
What is Database Freedom?
What is Database Freedom?What is Database Freedom?
What is Database Freedom?
 
Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018Data Design and Modeling for Microservices I AWS Dev Day 2018
Data Design and Modeling for Microservices I AWS Dev Day 2018
 
Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...
Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...
Streamlining Application Development with AWS Service Catalog (DEV328) - AWS ...
 
Flexiant and 451 Research Discuss the Service Provider Path from VPS to IaaS
Flexiant and 451 Research Discuss the Service Provider Path from VPS to IaaSFlexiant and 451 Research Discuss the Service Provider Path from VPS to IaaS
Flexiant and 451 Research Discuss the Service Provider Path from VPS to IaaS
 
VMWare Cloud on AWS | Floor 28
VMWare Cloud on AWS | Floor 28VMWare Cloud on AWS | Floor 28
VMWare Cloud on AWS | Floor 28
 
Migrating from a monolith to microservices – is it worth it?
Migrating from a monolith to microservices – is it worth it?Migrating from a monolith to microservices – is it worth it?
Migrating from a monolith to microservices – is it worth it?
 
Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018
Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018
Migrating Microsoft Applications to AWS like an Expert - AWS Summit Sydney 2018
 
Come costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWSCome costruire un'architettura Serverless nel Cloud AWS
Come costruire un'architettura Serverless nel Cloud AWS
 
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
Build an AppStream 2.0 Environment to Deliver Desktop Applications to Any Com...
 
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 ...
 
VMware Cloud on AWS Cloud Migration Deep Dive
 VMware Cloud on AWS Cloud Migration Deep Dive VMware Cloud on AWS Cloud Migration Deep Dive
VMware Cloud on AWS Cloud Migration Deep Dive
 
From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...
From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...
From Mainframe to Microservices: Vanguard’s Move to the Cloud - ENT331 - re:I...
 
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
 
Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018Serverless Architectural Patterns I AWS Dev Day 2018
Serverless Architectural Patterns I AWS Dev Day 2018
 
Innovating with AWS: How Microservices on AWS Can Transform Your Business
Innovating with AWS: How Microservices on AWS Can Transform Your BusinessInnovating with AWS: How Microservices on AWS Can Transform Your Business
Innovating with AWS: How Microservices on AWS Can Transform Your Business
 
Database Freedom | AWS Floor28
Database Freedom | AWS Floor28Database Freedom | AWS Floor28
Database Freedom | AWS Floor28
 
Serverless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best PracticesServerless Architectural Patterns and Best Practices
Serverless Architectural Patterns and Best Practices
 
Track 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptx
Track 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptxTrack 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptx
Track 5 Session 6_ BLC01 透過 Amazon Managed Blockchain 與 Amazon QLDB 打造區塊鍊應用.pptx
 

Similar to Microservices & Data Design: Database Week San Francisco

Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2Amazon Web Services
 
A Modern Data Architecture for Microservices
A Modern Data Architecture for MicroservicesA Modern Data Architecture for Microservices
A Modern Data Architecture for MicroservicesAmazon Web Services
 
Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Amazon Web Services
 
Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Boaz Ziniman
 
2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by dddKim Kao
 
Implementing Microservices by DDD
Implementing Microservices by DDDImplementing Microservices by DDD
Implementing Microservices by DDDAmazon Web Services
 
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Amazon Web Services
 
Serverless on AWS: Architectural Patterns and Best Practices
Serverless on AWS: Architectural Patterns and Best PracticesServerless on AWS: Architectural Patterns and Best Practices
Serverless on AWS: Architectural Patterns and Best PracticesVladimir Simek
 
Introduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day JerusalemIntroduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day JerusalemAmazon Web Services
 
Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...
Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...
Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...Amazon Web Services
 
Coordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdfCoordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdfAmazon Web Services
 
SRV315 Building Enterprise-Grade Serverless Apps
 SRV315 Building Enterprise-Grade Serverless Apps SRV315 Building Enterprise-Grade Serverless Apps
SRV315 Building Enterprise-Grade Serverless AppsAmazon Web Services
 
How can your business benefit from going Serverless
How can your business benefit from going ServerlessHow can your business benefit from going Serverless
How can your business benefit from going ServerlessAmazon Web Services
 
How can your business benefit from going serverless?
How can your business benefit from going serverless?How can your business benefit from going serverless?
How can your business benefit from going serverless?Adrian Hornsby
 
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 NodeJSAmazon Web Services
 
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAmazon Web Services
 
How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...
How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...
How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...Amazon Web Services
 

Similar to Microservices & Data Design: Database Week San Francisco (20)

Data Design for Microservices
Data Design for MicroservicesData Design for Microservices
Data Design for Microservices
 
Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2
 
A Modern Data Architecture for Microservices
A Modern Data Architecture for MicroservicesA Modern Data Architecture for Microservices
A Modern Data Architecture for Microservices
 
Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28Introduction to Serverless computing and AWS Lambda | AWS Floor28
Introduction to Serverless computing and AWS Lambda | AWS Floor28
 
Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28Introduction to Serverless computing and AWS Lambda - Floor28
Introduction to Serverless computing and AWS Lambda - Floor28
 
2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd2019 03-13-implementing microservices by ddd
2019 03-13-implementing microservices by ddd
 
Implementing Microservices by DDD
Implementing Microservices by DDDImplementing Microservices by DDD
Implementing Microservices by DDD
 
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
Deep Dive into AWS X-Ray: Monitor Modern Applications (DEV324) - AWS re:Inven...
 
Serverless on AWS: Architectural Patterns and Best Practices
Serverless on AWS: Architectural Patterns and Best PracticesServerless on AWS: Architectural Patterns and Best Practices
Serverless on AWS: Architectural Patterns and Best Practices
 
Introduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day JerusalemIntroduction to Serverless on AWS - Builders Day Jerusalem
Introduction to Serverless on AWS - Builders Day Jerusalem
 
Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...
Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...
Wellington Management: The Journey to All-In, One Data Center at a Time (FSV2...
 
Breaking Down the 'Monowhat'
Breaking Down the 'Monowhat'Breaking Down the 'Monowhat'
Breaking Down the 'Monowhat'
 
Coordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdfCoordinating Microservices with AWS Step Functions.pdf
Coordinating Microservices with AWS Step Functions.pdf
 
SRV315 Building Enterprise-Grade Serverless Apps
 SRV315 Building Enterprise-Grade Serverless Apps SRV315 Building Enterprise-Grade Serverless Apps
SRV315 Building Enterprise-Grade Serverless Apps
 
How can your business benefit from going Serverless
How can your business benefit from going ServerlessHow can your business benefit from going Serverless
How can your business benefit from going Serverless
 
How can your business benefit from going serverless?
How can your business benefit from going serverless?How can your business benefit from going serverless?
How can your business benefit from going serverless?
 
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
 
Migrating database to cloud
Migrating database to cloudMigrating database to cloud
Migrating database to cloud
 
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft BroadridgeAWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
AWS FSI Symposium 2017 NYC - Moving at the Speed of Serverless ft Broadridge
 
How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...
How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...
How HSBC Uses Serverless to Process Millions of Transactions in Real Time (FS...
 

More from Amazon Web Services

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...Amazon Web Services
 
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...Amazon Web Services
 
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 FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
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 Amazon Web Services
 
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...Amazon Web Services
 
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...Amazon Web Services
 
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 WorkloadsAmazon Web Services
 
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 sfatareAmazon Web Services
 
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 webAmazon Web Services
 
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 sfatareAmazon 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 AWSAmazon 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 DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon 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
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 
AWS Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei serverAWS Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei serverAmazon Web Services
 

More from 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
 
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 Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei serverAWS Serverless per startup: come innovare senza preoccuparsi dei server
AWS Serverless per startup: come innovare senza preoccuparsi dei server
 

Microservices & Data Design: Database Week San Francisco

  • 1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Pop-up Loft Data Design for Microservices Bill Baldwin DBS Technical Evangelist bbaldwin@amazon.com
  • 2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Microservices at Amazon • Service-Oriented Architecture (SOA) • Single-purpose • Connect only through APIs • Connect over HTTPS • “Microservices”
  • 3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Monolithic vs. SOA vs. Microservices Microservices: • Many very small components • Business logic lives inside of single service domain • Simple wire protocols(HTTP with XML/JSON) • API driven with SDKs/Clients SOA: • Fewer more sophisticated components • Business logic can live across domains • Enterprise Service Bus like layers between services • Middleware
  • 4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Monolithic vs. SOA vs. Microservices SOA Coarse-grained Microservices Fine-grained Monolithic Single Unit
  • 5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Microservice Challenges • Distributed computing is hard • Transactions – Multiple Databases across multiple services • Eventual Consistency • Lots of moving parts • Service discovery • Increase coordination • Increase message routing
  • 6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Key Elements of Microservices… • Some core concepts are common to all services – Service registration, discovery, wiring, administration – State management – Service metadata – Service versioning – Caching • Low Friction Deployment • Automated Management and Monitoring
  • 7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Key Elements of Microservices… • Eliminates any long-term commitment to a technology stack • Polyglot ecosystem • Polyglot persistence – Decompose Databases – Database per microservice pattern • Allows easy use of Canary and Blue-Green deployments
  • 8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Key Elements of Microservices… • Each microservice is: – Elastic: scales up or down independently of other services – Resilient: services provide fault isolation boundaries – Composable: uniform APIs for each service – Minimal: highly cohesive set of entities – Complete: loosely coupled with other services Controller A Controller B Controller A Controller B Q Q Tight Coupling Loose Coupling
  • 9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Microservices Benefits • Fast to develop • Rapid deployment • Parallel development & deployment • Closely integrated with DevOps – Now ”DevSecOps” • Improved scalability, availability & fault tolerance • More closely aligned to business domain
  • 10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved • Two-pizza teams • Full ownership • Full accountability • Aligned incentives • “DevOps” Principles of the Two Pizza Team
  • 11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved How do Two Pizza Teams work? We call them “Service teams” • Own the “primitives” they build: – Product planning (roadmap) – Development work – Operational/Client support work • “You build it, you run it” • Part of a larger concentrated org – Amazon.com, AWS, Fresh, …
  • 12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Data Architecture Challenges
  • 13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
  • 14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
  • 15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Challenge: Centralized Database user-svc account-svccart-svc DB Applications often have a monolithic data store • Difficult to make schema changes • Technology lock-in • Vertical scaling • Single point of failure
  • 16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Centralized Database – Anti-pattern user-svc account-svccart-svc DB Applications often have a monolithic data store • Difficult to make schema changes • Technology lock-in • Vertical scaling • Single point of failure
  • 17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Decentralized Data Stores account-svccart-svc DynamoDB RDS user-svc ElastiCache RDS Polyglot Persistence • Each service chooses its data store technology • Low impact schema changes • Independent scalability • Data is gated through the service API
  • 18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Challenge: Transactional Integrity • Polyglot persistence generally translates into eventual consistency • Asynchronous calls allow non-blocking, but returns need to be handled properly • How about transactional integrity? • Event-sourcing – Capture changes as sequence of events • Staged commit • Rollback on failure ERROR STATE? ROLLBACK?
  • 19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Best Practice: 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” correlation id: “uuid-123” correlation id:“uuid-123”
  • 20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Best Practice: Microservice owns Rollback • Every microservice should expose its own “rollback” method • This method could just rollback changes, or trigger subsequent actions • Could send a notification • If you implement staged commit, also expose a commit function Microservice Function 1 Rollback Commit (optional)
  • 21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Event-Driven: DynamoDB Streams • If async, consider event-driven approach with DynamoDB Streams • Don’t need to manage function execution failure, DDB Streams automatically retries until successful • “Attach” yourself to the data of interest Microservice Dynam oDB Stream s
  • 22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Challenge: Report Errors / Rollback • What if functions fail? (business logic failure, not code failure) • Create a “Transaction Manager” microservice that notifies all relevant microservices to rollback or take action • DynamoDB is the trigger for the clean-up function (could be SQS, Kinesis etc.) • Use Correlation ID to identify relations mm-svc Transaction Manager Function DDB Streams API Call Error Table
  • 23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Challenge: Report Errors / Rollback ERROR DynamoDB Error Table Transaction Manager Function Kinesis Error Stream SQS Error Queue Rollback (correlation-id) Rollback (correlation-id) Rollback (correlation-id) Rollback (correlation-id)
  • 24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Challenge: Code Error Lambda Execution Error because of faulty code Leverage Cloudwatch Logs to process error message and call Transaction Manager Set Cloudwatch Logs Metric Filter to look for Error/Exception and call Lambda Handler upon Alarm state ui-svc Cloudwatch Logs Cloudwatch Alarm Transaction Manager Function
  • 25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Beware: Stream Model with AWS Lambda • DynamoDB Streams and Kinesis streams directly work with AWS Lambda, however AWS Lambda needs to acknowledge processing the message correctly • If Lambda fails to process the message, the stream horizon will not be moved forward, creating a “jam” • Solution: Monitor AWS Lambda Error CloudWatch Metric and react when error rate of same “Correlation ID” keeps increasing
  • 26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Keep Data Consistent Databases AWS Lambda “Cleanup” Function Cloudwatch Scheduled Event • Perform Master Data Management (MDM) to keep data consistent • Create AWS Lambda function to check consistencies across microservices and “cleanup” • Create CloudWatch Event to schedule the function (e.g. hourly basis)
  • 27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Choosing a Datastore
  • 28. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Storage & DB options in AWS Amazon RDS Amazon DynamoDB Amazon Elasticsearch Service Amazon S3 Amazon Kinesis Amazon ElastiCache In-Memory NoSQL SQL SearchObject Streaming Amazon Redshift Amazon Glacier
  • 29. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Challenge: What Service to Use? • Many problems can be solved with NoSQL, RDBMS or even in-memory cache technologies • Non-functional requirements can help identify appropriate services • Solution: Classify your organizations non-functional requirements and map them to service capabilities
  • 30. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Determine Your Non-Functional Requirements Requirement Latency > 1s 200 ms -1s 20 ms – 200 ms < 20 ms Durability 99.99 99.999 99.9999 > 99.9999 Storage Scale < 256 GB 256 GB – 1 TB 1 TB – 16 TB > 16 TB Availability 99 99.9 99.95 > 99.95 Data Class Public Important Secret Top Secret Recoverability 12 – 24 hours 1 – 12 hours 5 mins – 1 hour < 5 mins Skills None Average Good Expert This is only an example. Your classifications will be different There will be other requirements such as regulatory compliance too.
  • 31. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Map Non-Functional Requirements to Services Service Latency Durability Storage Availability Recoverability from AZ Failure (RPO, RTO) RDS < 100 ms > 99.8 (EBS) 16 TB 99.95 0s and 90s (MAZ) Aurora < 100 ms > 99.9 64 TB > 99.95 0s and < 30s (MAZ) Aurora + ElastiCache < 1 ms > 99.9 64 TB > 99.95 0s and < 30s (MAZ) DynamoDB < 10 ms > 99.9 No Limit > 99.99 0s and 0s DynamoDB / DAX < 1 ms > 99.9 No Limit > 99.99 0s and 0s ElastiCache Redis < 1 ms N/A 6.1 TiB 99.95 0s and < 30s (MAZ) Elasticsearch < 200 ms > 99.9 1.5 PB 99.95 0s and < 30s (Zone Aware) S3 < 500 ms 99.999999999 No Limit 99.99 0s and 0s The information below is not exact and does not represent SLAs
  • 32. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Finalizing Your Data Store Choices • After mapping your non-functional requirements to services you should have a short list to choose from • Functional requirements such as geospatial data and query support will refine the list further • You may institute standards to make data store selection simpler and also make it easier for people to move between teams. These can still be overridden, but require justification to senior management
  • 33. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Challenge: Reporting and Analytics • Data is now spread across a number of isolated polyglot data stores • Consolidation and aggregation required • Solution: Pull data from required microservices, push data to data aggregation service, use pub/sub, or use a composite service (anti-pattern).
  • 34. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Aggregation usr svc Pull model Push model Data Aggregation Application usr svc Data Aggregation Application Pub/Sub Composite Composite Data Service usr account cart account svc cart svc account svc cart svc Pub Sub usr svc account svc cart svc Data Aggregation Application Push Pull
  • 35. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved A Few Thoughts • Use Non-Functional Requirements to help identify the right data store(s) for each microservice • Use polyglot persistence to avoid bottlenecks, schema issues and allow independent scalability (and cache) • Embrace eventual consistency and design fault-tolerant business processes which can recover • Think ahead and plan your analytics requirements as part of the overall architecture
  • 36. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved Pop-up Loft aws.amazon.com/activate Everything and Anything Startups Need to Get Started on AWS