More Related Content Similar to 2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices (20) 2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices1. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Essential Capabilities behind
Microservices
Kim Kao
Solutions Architect
Amazon Web Services
D e v D a y - 2
Domain Driven Design(DDD Taiwan)
2. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
The new normal: companies are increasingly
global and products are increasingly digital
47%
of CEOs said they are
being challenged by
the board of directors
to make progress in
digital business
Source: Gartner
79%
of CIOs believe that
digital business is
making their IT
organizations better
prepared to change
67%
of all business leaders
believe that they must
pick up the pace of
digitalization to
remain competitive
3. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Why are enterprises
adopting microservices?
• Accelerate software development
• Build modern applications
• Automate operations at web scale
© 2019, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Confidential
4. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
To maintain competitive advantage, digital
businesses must innovate as rapidly as possible
FeedbackIdeas
Experiment
Innovation
Flywheel
5. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Manager -
“We are going to run workload(s) on AWS.
We have new sub-systems/module to develop with legacy services.
Container is good, Lambda is awesome. It’s great to have whole cloud native
advantage
if you guys migrate all service into microservice, serverless...”
Developer(s) - “Not a problem. I’ll make it …”
A typical day for customer ...
6. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Jump into real world...
https://vaughnvernon.co/tag/event-storming/
(Earn money as usual) (will it run as usual?)
7. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
8. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
When the impact of change is small,
release velocity can increase
Monolith
Does everything
Microservices
Do one thing
9. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
100/200/300/1000?
LOC
Code matters?
10. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
AWS FargateAmazon Elastic
Container Service
Amazon Elastic
Container Service for
Kubernetes
Docker
Containers is Microservices?
11. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Domain Driven Design
Fit in
• Standalone computing & persistence
• Serve for specific business intentions
• Business Capability in bounded Context
• Embrace Rapidly Change
• Automate operations at web scale
• Engineering Decoupling
Microservices stand for ...
12. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Mobile client
Client
IoT
Computing in variety platform
API
Gateway
Account DB
Shipping DB
Inventory DB
Store Front
Web App
Shipment
Query
Inventory
Query
13. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Relational
Referential
integrity, ACID
transactions,
schema-
on-write
Lift and shift, ERP,
CRM, finance
Key-value
High
throughput, low-
latency reads
and writes,
endless scale
Real-time bidding,
shopping cart,
social, product
catalog, customer
preferences
Document
Store
documents and
quickly access
querying on
any attribute
Content
management,
personalization,
mobile
In-memory
Query by key
with
microsecond
latency
Leaderboards,
real-time analytics,
caching
Graph
Quickly and
easily create
and navigate
relationships
between
data
Fraud detection,
social networking,
recommendation
engine
Time-series
Collect, store,
and process
data sequenced
by time
IoT applications,
event tracking
Ledger
Complete,
immutable, and
verifiable history
of all changes to
application data
Systems
of record, supply
chain, health care,
registrations,
financial
Amazon
QLDB
Amazon Aurora
Amazon RDS
Amazon
DynamoDB
Amazon
DocumentDB
Amazon
ElastiCache
Amazon
Neptune
Amazon
Timestream
Choose right one to support Microservices
14. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Challenges
(dealing with transaction, service lookup)
(priority, customer expectation)
(by noun, organization, experience?)
(CRM, ERP, Payment Gateway ...)
(self employee, out sourcing, ISV)
15. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
16. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
(priority, market expectation)
Domain
Expert
Matters
17. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Strategies for Dealing with Legacy Systems
• Bubble Context
• Place your new functionality in a bubble and have repositories as an anti-corruption
layer(ACL) toward the legacy code and data.
• Autonomous Bubble
• Start a new chapter OUTSIDE the legacy code with its own storage. Thus we need to
synchronize ACL and similar information that you shares with the legacy system
• Open Host Services in Published Language
• Expose legacy assets through an open host service. Using an anti-corruption layer to convert
the necessary information to the new system
• Event Streams
• The systems communicate trough events. The anti-corruption layer now publishes the event
and monitor the state of the other system. The solution is similar to event sourcing.
(priority, customer expectation)
18. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
(dealing with transaction, service lookup)
Monolith
Does everything
Per Service
Do only one thing
Business matters
Immutable facts
- Order Created
- Coupon applied
- Account Registered
Intention
Business behavior
- Create an Order
- Apply Coupon
- Register an Account
Responsible for
Capabilities
- Order
- Discount
- Identity Management
Accept
&
process
Presentation Model
Help to make decision
Composite data type
19. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
(dealing with transaction, service lookup)
Monolith
Does everything
Per Service
Do only one thing
20. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
• Microservices candidate – Bounded Context
• Per Bounded Context form up system Boundary
• One Bounded Context may
• Contains multiple co-related Aggregates
• Or only one Aggregate with Specific business capability
(dealing with transaction, service lookup)
21. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
24. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
(dealing with transaction, service lookup)
Observability & traffic control
Easily export logs, metrics, and traces
Client side traffic policies—circuit breaking, retries
Routes for deployments
Works across clusters and container services
Amazon ECS
Amazon EKS
Kubernetes on EC2
AWS Fargate
AWS built and run
No control plane to manage
Ease of operations
High scale
25. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
(dealing with transaction, service lookup)
• Are you ready to deal with M:N transaction compensation ?
• Are you ready to embrace the rapidly change by contract ?
26. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Transaction Dependencies between Microservices
• Upstream-Downstream co-relationship
• One Transaction invoke local API and Remote API
Book Rental
Service
Book Flight
Service
Trip Service
Book Hotel
Service
Exception / Error ?
Exception / Error ?
Exception / Error ?
!"
#
!$
#
!#
#
+
+
Transaction Compensate
27. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Saga : Alternative for 2 Phase -commit
28. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Context
• You have applied the Database per Service pattern. Each
service has its own database.
• Some business transactions, however, span multiple service
so you need a mechanism to ensure data consistency
across services.
29. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Solutions
• Each local transaction updates self and
publishes a message/event to trigger the
next local transaction in the saga.
• If a local transaction fails because it
violates a business rule then the saga
executes a series of compensating
transactions that undo the changes that
were made by the preceding local
transactions.
https://microservices.io/patterns/data/saga.html
30. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Orchestration-based Saga
• Coordinator stand alone
• Each service provide
a pair function for Success or Fail
• Abstract compensate logic
out of Codes
https://microservices.io/patterns/data/saga.html
1
1.1 2 3
4
5
31. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Implementing Saga pattern on AWS
32. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
• Each Service provide cancel operation
• State change trigger cancel operation
• Simplify Complexity rules
• Just a JSON file
33. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Code snippet
https://github.com/humank/lambda-saga-pattern
34. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Demo
35. S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.
36. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
(by noun, organization, experience?)
(CRM, ERP, Payment Gateway ...)
(self employee, out sourcing, ISV)
37. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
• By business Capability
• Form up boundary by Bounded Context
• Clarify Sub Domains
• Core sub domain – (most valuable)
• General sub domain – (facilitate business)
• Support sub domain – (support, infra)
(by noun, organization, experience?)
38. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
(by noun, organization, experience?)
A Team
39. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
• Resources allocation by value chain
• Talents devote to build up core sub domain
• Responsible for general sub domain
• Out sourcing or ISV for support domain
(self employee, out sourcing, ISV)
40. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
ISV/Package
Support sub Domain
Out Sourcing
General Sub Domain
Pay the most efforts on critical business component
Talents developing code
Core Sub Domain
(self employee, out sourcing, ISV)
41. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
• Incrementally breakout dependencies
• Cut-off Database Link
• Do not allow cross schema access permissions
• Define API contract only for data exchange
• Considering to move out store procedure into application
code
• Leave the legacy system as a data container
(CRM, ERP, Payment Gateway ...)
42. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
When you should dive in Microservices
Team
Partners
Business
Operation
Coding
Value
43. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Migration from Monolith to Microservices
via DDD approach readiness
https://github.com/humank/microservices
Update soon !
44. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Implementing DDD on AWS
Community : DDD Taiwan@FB
Telegram : YikaiKao
WeChat : YikaiKao
Twitter : @YikaiKao
GitHub Repos
45. © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.S U M M I T
Take Away
Know Why/What/How
• Do you really need Microservices?
• Leverage Business Events to aggregate context
and form up Service Boundary
• There is no C4 to solve distributed persistence
issue
• State Machine to do Transaction Compensate
(Step Functions way to go)
• DDD is good to collaborate Business and
Technology guys by speaking Ubiquitous
Language
• Crunch Problem, then design solution
46. Thank you!
S U M M I T © 2019, Amazon Web Services, Inc. or its affiliates. All rights reserved.