SlideShare uma empresa Scribd logo
1 de 66
Baixar para ler offline
© 2019, Domain Driven Design Taiwan Community
Kim Kao ( )
April 25, 2019
Essential Capabilities behind
Microservices
© 2019, Domain Driven Design Taiwan Community
A typical day for a customer new to AWS...
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 - “Not a problem. I’ll make it …”
© 2019, Domain Driven Design Taiwan Community
Business Wants
https://vaughnvernon.co/tag/event-storming/
© 2019, Domain Driven Design Taiwan Community
But You Want
https://vaughnvernon.co/tag/event-storming/
© 2019, Domain Driven Design Taiwan Community
Challenge on migration to Microserivces
• Legacy looks like Big ball of mud(BBOM)
• Heavy dependency with external system
• No idea on splitting BBOM
• No idea to find out system boundary
• Which service(s) worth to do
• Human resources allocation
• Team, out sourcing, ISVs solution
© 2019, Domain Driven Design Taiwan Community
What are Microservices?
© 2019, Domain Driven Design Taiwan Community
= Microservices ?
© 2019, Domain Driven Design Taiwan Community
100/200/300/1000?
LOC
© 2019, Domain Driven Design Taiwan Community
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
What Are Microservices?
“A software architecture style in which complex
applications are composed of small, independent
processes communicating with each other using language-
agnostic APIs. These services are small, highly decoupled
and focus on doing a small task, facilitating a modular
approach to system-building.” - Wikipedia
https://en.wikipedia.org/wiki/Microservices
© 2019, Domain Driven Design Taiwan Community
Way to divide services from Monolith
• By noun(s)
• By Your Experience(s)
• By Team’s decision
• Up to Leader/Manager/CxO ...
• No right or power to influence
© 2019, Domain Driven Design Taiwan Community
Problem behind Microservices
© 2019, Domain Driven Design Taiwan Community
Monolith
Load
Balancer
Account Service
Cart Service
Shipping Service
StoreFront UI
Browser
Database
Data Access
Service
© 2019, Domain Driven Design Taiwan Community
Account
Database
Inventory
Database
Shipping
Database
Migrate to Microservices
Load
Balancer
StoreFront
UI
Browser
Account
Service
Cart Service
Shipping
Service
Load
Balancer
Load
Balancer
Load
Balancer
© 2019, Domain Driven Design Taiwan Community
Challenge is Coming
• Authentication & Authorization
• Session mechanism is broken
• Centralized & Robust alternative one is required
• Service Discovery
• Write the traffic routing code(s) in logic?
• Re-try, Failover, Caching, ...
• Persistence
• Isolated Persistence for each Service
© 2019, Domain Driven Design Taiwan Community
A Classic solution on AWS
Load
Balancer
StoreFront
UI
Browser
Account
Database
Account
Service
Cart Service Inventory
Database
Shipping
Service
API
Gateway
Load
Balancer
Load
Balancer
Load
Balancer
Shipping
Database
© 2019, Domain Driven Design Taiwan Community
Authentication & Authorization
• Token based solution fit in
• Cognito
• 3rd party Authentication Federation
• Amazon, Google, Apple, Facebook...
• Self developed/hosted centralize A&A
services
© 2019, Domain Driven Design Taiwan Community
Service Discovery
• Client Side-Service Discovery
• Application Load Balancer-based Service
Discovery
• DNS-Based Service Discovery
• Service Discovery using ECS Event
Stream
• Configuration Management
• New * App Service Mesh (preview)
• Cloud Map
© 2019, Domain Driven Design Taiwan Community
Microservices
For Persistence ?
Stateful Persistent always be the top issue !!!
© 2019, Domain Driven Design Taiwan Community
• Accept all API calls to one RDS Cluster
• RDS Instance Sizing predict by services scaling ability
• DBA(s) : How to manage Connection Pool ?
• Read replica can’t help on Write intention
• RDS I/O be the bottleneck when highly Scale up
• All Services impacted while any failure occurred
• Option : Upgrade Read Replica to Master
Launching 1 RDS cluster
© 2019, Domain Driven Design Taiwan Community
Launching N * RDS for Independency?
© 2019, Domain Driven Design Taiwan Community
• DynamoDB
• Perfect deal with high transaction (write)
• Serve each table for only one transaction/service intention
• De-Normalize schema is required
• Prevent revision issue
• Hard to do complexity Join Query
• Cost High
• Low Performance
• Coding for iteration & aggregation
• Apply all RDS tables into DynamoDB?
Using NoSQL Solution?
© 2019, Domain Driven Design Taiwan Community
It’s about capability
• Are you ready to deal with M:N transaction compensation ?
• Are you ready to embrace the rapidly change by contract ?
© 2019, Domain Driven Design Taiwan Community
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
© 2019, Domain Driven Design Taiwan Community
Saga : Alternative for 2 Phase -commit
© 2019, Domain Driven Design Taiwan Community
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.
© 2019, Domain Driven Design Taiwan Community
Problem
How to maintain data consistency across services?
© 2019, Domain Driven Design Taiwan Community
Forces
• 2 Phase-Commit(PC) is a well-known solution for years
• The 2PC coordinator also represents a Single Point of
Failure, which is unacceptable for critical systems
© 2019, Domain Driven Design Taiwan Community
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
© 2019, Domain Driven Design Taiwan Community
Two ways of Saga Pattern
• Choreography - each local transaction publishes
domain events that trigger local transactions in other
services
• Orchestration - an orchestrator (object) tells the
participants what local transactions to execute
https://microservices.io/patterns/data/saga.html
© 2019, Domain Driven Design Taiwan Community
Choreography-based Saga
https://microservices.io/patterns/data/saga.html
2
1
3.b
3.a
4.a
4.b
• Logic in code
• Compensate chain
• Multiple states present in transaction
© 2019, Domain Driven Design Taiwan Community
Orchestration -based Saga
https://microservices.io/patterns/data/saga.html
• Coordinator stand alone
• Each service provide
a pair function for Success or Fail
• Abstract compensate logic
out of Codes1
1.1 2 3
45
© 2019, Domain Driven Design Taiwan Community
Resulting Context
• This pattern has the following benefits:
• It enables an application to maintain data consistency across multiple services without
using distributed transactions
• This solution has the following drawbacks:
• The programming model is more complex. For example, a developer must design
compensating transactions that explicitly undo changes made earlier in a saga.
• There are also the following issues to address:
• In order to be reliable, a service must atomically update its database and publish a
message/event. It cannot use the traditional mechanism of a distributed transaction
that spans the database and the message broker. Instead, it must use one of the
patterns listed below.
© 2019, Domain Driven Design Taiwan Community
Implementing Saga
© 2019, Domain Driven Design Taiwan Community
• Each Service provide cancel operation
• State change trigger cancel operation
• Simplify Complexity rules
• Just a JSON file
© 2019, Domain Driven Design Taiwan Community
Code snippet
https://github.com/humank/lambda-saga-pattern
© 2019, Domain Driven Design Taiwan Community
Demo
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
How to adopt Microservices?
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
Business operation without whole picture
The Blind Men and the Elephant
Is It correct to all in microservices or serverless ?
© 2019, Domain Driven Design Taiwan Community
Precondition to do microservices
Rapid Provisioning
Basic monitoring
Rapid application deployment
Martin
Fowler
© 2019, Domain Driven Design Taiwan Community
Better way to decompose Monolith
Domain
Expert
Matters
&
© 2019, Domain Driven Design Taiwan Community
How to break Monolith?
© 2019, Domain Driven Design Taiwan Community
Way to collaborate
• Point out the events
• Who send the command
• Find the Noun(s)
• Have all team voices
Commands
Events
Aggregate
© 2019, Domain Driven Design Taiwan Community
Coffee shop experience
DDD by EventStorming
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
© 2019, Domain Driven Design Taiwan Community
Go through Event Storming approach
Don’t tell tech only
Don’t sell tech partially
Aim for Core value
Figure out trigger
and result
© 2019, Domain Driven Design Taiwan Community
Seat
occupied
Menu offered
Ordered 2 cups
of Americano
Paid
Order
received
Coffee
made up
Customers
Left
Table
Cleaned
*Key Business Events in Coffeeshop
© 2019, Domain Driven Design Taiwan Community
Event Trigger
• Client
• Server
• Counter
• Barista
ACTORS
© 2019, Domain Driven Design Taiwan Community
Most Valuable / Risky Events
© 2019, Domain Driven Design Taiwan Community
© 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved.
Order
Make Up
Payment
Event Bus
(pub/sub)
Put
event
Event
Event
CloudWatch Event
.
.
.
Any other messaging
technology
Coffee shop Domain implementation Core Domain
Sub Domain
(Messaging)
Support Domain
Core Domain
© 2019, Domain Driven Design Taiwan Community
When you should dive in Microservices
Team
Partners
Business
Operation
Coding
Value
© 2019, Domain Driven Design Taiwan Community
How DDD can help you
• Business strategy on resource allocation
• Best resources should be put in most key/core domain
• Buy or out-sourcing common domain and sub domain
• Service re-architecture
• Form up the system context boundary
• Knowing the upstream-downstream relationship between
domains
• Meaningful to do microservice (separate computing/persist,
and API communication )
• Service Migration
• Good to re-architecture
© 2019, Domain Driven Design Taiwan Community
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
© 2019, Domain Driven Design Taiwan Community
Implementing DDD on AWS
Commounty : DDD Taiwan@FB
Telegram : YikaiKao
WeChat : YikaiKao
Twitter : @YikaiKao
GitHub Repos

Mais conteúdo relacionado

Mais procurados

Cloudtechnologyassociatepart 1
Cloudtechnologyassociatepart 1Cloudtechnologyassociatepart 1
Cloudtechnologyassociatepart 1
Anne Starr
 
2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...
2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...
2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...
Club Cloud des Partenaires
 
Cch slides input from cms walk through
Cch slides input from cms walk throughCch slides input from cms walk through
Cch slides input from cms walk through
Leszek Wisłowski
 
IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...
IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...
IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...
Romeo Kienzler
 
IBM Cloud Service Provider Platform
IBM Cloud Service Provider PlatformIBM Cloud Service Provider Platform
IBM Cloud Service Provider Platform
Hal Van Hercke
 

Mais procurados (18)

IBM Cloud Services Portfolio
IBM Cloud Services Portfolio IBM Cloud Services Portfolio
IBM Cloud Services Portfolio
 
Cloud Service Management. A New Beginning.
Cloud Service Management. A New Beginning.Cloud Service Management. A New Beginning.
Cloud Service Management. A New Beginning.
 
The Exinda WAN Optimization Appliance - Jason Whitaker, Transylvania University
The Exinda WAN Optimization Appliance - Jason Whitaker, Transylvania UniversityThe Exinda WAN Optimization Appliance - Jason Whitaker, Transylvania University
The Exinda WAN Optimization Appliance - Jason Whitaker, Transylvania University
 
Cloudtechnologyassociatepart 1
Cloudtechnologyassociatepart 1Cloudtechnologyassociatepart 1
Cloudtechnologyassociatepart 1
 
IBM Cloud Solution - Blue Box
IBM Cloud Solution - Blue BoxIBM Cloud Solution - Blue Box
IBM Cloud Solution - Blue Box
 
IBM cloud open by design
IBM cloud open by designIBM cloud open by design
IBM cloud open by design
 
Javascript Client & Server Architectures
Javascript Client & Server ArchitecturesJavascript Client & Server Architectures
Javascript Client & Server Architectures
 
2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...
2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...
2011.11.22 - Cloud Services Solution Provider - 8ème Forum du Club Cloud des ...
 
Bluemix overview v1.4
Bluemix overview v1.4Bluemix overview v1.4
Bluemix overview v1.4
 
Cch slides input from cms walk through
Cch slides input from cms walk throughCch slides input from cms walk through
Cch slides input from cms walk through
 
IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...
IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...
IBM Codename: Bluemix - Cloudfoundry, PaaS development and deployment trainin...
 
IBM Cloud Service Provider Platform
IBM Cloud Service Provider PlatformIBM Cloud Service Provider Platform
IBM Cloud Service Provider Platform
 
IBM Softlayer Bluemix Marketplace
IBM Softlayer Bluemix MarketplaceIBM Softlayer Bluemix Marketplace
IBM Softlayer Bluemix Marketplace
 
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
20190727 HashiCorp Consul Workshop: 管管你們家 config 啦
 
Perth DevOps Meetup - Introducing the IBM Innovation Lab - 12112015
Perth DevOps Meetup - Introducing the IBM Innovation Lab - 12112015Perth DevOps Meetup - Introducing the IBM Innovation Lab - 12112015
Perth DevOps Meetup - Introducing the IBM Innovation Lab - 12112015
 
Accelerate Digital Transformation with IBM Cloud Private
Accelerate Digital Transformation with IBM Cloud PrivateAccelerate Digital Transformation with IBM Cloud Private
Accelerate Digital Transformation with IBM Cloud Private
 
Cisco Prime Unified Management for Next-Generation Internet
Cisco Prime Unified Management for Next-Generation InternetCisco Prime Unified Management for Next-Generation Internet
Cisco Prime Unified Management for Next-Generation Internet
 
DFW BlueMix Meetup - demo and slides
DFW BlueMix Meetup - demo and slidesDFW BlueMix Meetup - demo and slides
DFW BlueMix Meetup - demo and slides
 

Semelhante a 2019 04-25-agile communitymeetup-essentialcapabilitiesbehindmicroservices

Serverless: costruire applicazioni native per il cloud
Serverless: costruire applicazioni native per il cloudServerless: costruire applicazioni native per il cloud
Serverless: costruire applicazioni native per il cloud
Amazon Web Services
 
以容器技術為基礎的混合雲設計架構
以容器技術為基礎的混合雲設計架構以容器技術為基礎的混合雲設計架構
以容器技術為基礎的混合雲設計架構
Amazon Web Services
 

Semelhante a 2019 04-25-agile communitymeetup-essentialcapabilitiesbehindmicroservices (20)

Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?
 
Navigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Navigating the service mesh landscape with Istio, Consul Connect, and LinkerdNavigating the service mesh landscape with Istio, Consul Connect, and Linkerd
Navigating the service mesh landscape with Istio, Consul Connect, and Linkerd
 
Essential capabilities behind Microservices
Essential capabilities behind MicroservicesEssential capabilities behind Microservices
Essential capabilities behind Microservices
 
Service-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Service-mesh options with Linkerd, Consul, Istio and AWS AppMeshService-mesh options with Linkerd, Consul, Istio and AWS AppMesh
Service-mesh options with Linkerd, Consul, Istio and AWS AppMesh
 
Implementing Microservices by DDD
Implementing Microservices by DDDImplementing Microservices by DDD
Implementing Microservices by DDD
 
Serverless: costruire applicazioni native per il cloud
Serverless: costruire applicazioni native per il cloudServerless: costruire applicazioni native per il cloud
Serverless: costruire applicazioni native per il cloud
 
NoOps in a Serverless World
NoOps in a Serverless WorldNoOps in a Serverless World
NoOps in a Serverless World
 
2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices
2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices
2019 06-12-aws taipei summit-dev day-essential capabilities behind microservices
 
Stages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete MigrationStages of Adoption leading to Complete Migration
Stages of Adoption leading to Complete Migration
 
以容器技術為基礎的混合雲設計架構
以容器技術為基礎的混合雲設計架構以容器技術為基礎的混合雲設計架構
以容器技術為基礎的混合雲設計架構
 
Cloud computing
Cloud computingCloud computing
Cloud computing
 
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network StrategiesCisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
Cisco Live 2019: New Best Practices for Hybrid and Multicloud Network Strategies
 
Cloud Native Patterns with Bluemix Developer Console
Cloud Native Patterns with Bluemix Developer ConsoleCloud Native Patterns with Bluemix Developer Console
Cloud Native Patterns with Bluemix Developer Console
 
Building and Successfully Selling ISV Solutions with AWS Partner-Summit-Singa...
Building and Successfully Selling ISV Solutions with AWS Partner-Summit-Singa...Building and Successfully Selling ISV Solutions with AWS Partner-Summit-Singa...
Building and Successfully Selling ISV Solutions with AWS Partner-Summit-Singa...
 
Implementing Service Oriented Architecture
Implementing Service Oriented ArchitectureImplementing Service Oriented Architecture
Implementing Service Oriented Architecture
 
Implementing Service Oriented Architecture
Implementing Service Oriented ArchitectureImplementing Service Oriented Architecture
Implementing Service Oriented Architecture
 
Implementing Service Oriented Architecture
Implementing Service Oriented Architecture Implementing Service Oriented Architecture
Implementing Service Oriented Architecture
 
Mainframe cloud computing presentation
Mainframe cloud computing presentationMainframe cloud computing presentation
Mainframe cloud computing presentation
 
The As, Bs, and Four Cs of Testing Cloud-Native Applications
The As, Bs, and Four Cs of Testing Cloud-Native ApplicationsThe As, Bs, and Four Cs of Testing Cloud-Native Applications
The As, Bs, and Four Cs of Testing Cloud-Native Applications
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
anilsa9823
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 

Último (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 

2019 04-25-agile communitymeetup-essentialcapabilitiesbehindmicroservices

  • 1. © 2019, Domain Driven Design Taiwan Community Kim Kao ( ) April 25, 2019 Essential Capabilities behind Microservices
  • 2. © 2019, Domain Driven Design Taiwan Community A typical day for a customer new to AWS... 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 - “Not a problem. I’ll make it …”
  • 3. © 2019, Domain Driven Design Taiwan Community Business Wants https://vaughnvernon.co/tag/event-storming/
  • 4. © 2019, Domain Driven Design Taiwan Community But You Want https://vaughnvernon.co/tag/event-storming/
  • 5. © 2019, Domain Driven Design Taiwan Community Challenge on migration to Microserivces • Legacy looks like Big ball of mud(BBOM) • Heavy dependency with external system • No idea on splitting BBOM • No idea to find out system boundary • Which service(s) worth to do • Human resources allocation • Team, out sourcing, ISVs solution
  • 6. © 2019, Domain Driven Design Taiwan Community What are Microservices?
  • 7. © 2019, Domain Driven Design Taiwan Community = Microservices ?
  • 8. © 2019, Domain Driven Design Taiwan Community 100/200/300/1000? LOC
  • 9. © 2019, Domain Driven Design Taiwan Community © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. What Are Microservices? “A software architecture style in which complex applications are composed of small, independent processes communicating with each other using language- agnostic APIs. These services are small, highly decoupled and focus on doing a small task, facilitating a modular approach to system-building.” - Wikipedia https://en.wikipedia.org/wiki/Microservices
  • 10. © 2019, Domain Driven Design Taiwan Community Way to divide services from Monolith • By noun(s) • By Your Experience(s) • By Team’s decision • Up to Leader/Manager/CxO ... • No right or power to influence
  • 11. © 2019, Domain Driven Design Taiwan Community Problem behind Microservices
  • 12. © 2019, Domain Driven Design Taiwan Community Monolith Load Balancer Account Service Cart Service Shipping Service StoreFront UI Browser Database Data Access Service
  • 13. © 2019, Domain Driven Design Taiwan Community Account Database Inventory Database Shipping Database Migrate to Microservices Load Balancer StoreFront UI Browser Account Service Cart Service Shipping Service Load Balancer Load Balancer Load Balancer
  • 14. © 2019, Domain Driven Design Taiwan Community Challenge is Coming • Authentication & Authorization • Session mechanism is broken • Centralized & Robust alternative one is required • Service Discovery • Write the traffic routing code(s) in logic? • Re-try, Failover, Caching, ... • Persistence • Isolated Persistence for each Service
  • 15. © 2019, Domain Driven Design Taiwan Community A Classic solution on AWS Load Balancer StoreFront UI Browser Account Database Account Service Cart Service Inventory Database Shipping Service API Gateway Load Balancer Load Balancer Load Balancer Shipping Database
  • 16. © 2019, Domain Driven Design Taiwan Community Authentication & Authorization • Token based solution fit in • Cognito • 3rd party Authentication Federation • Amazon, Google, Apple, Facebook... • Self developed/hosted centralize A&A services
  • 17. © 2019, Domain Driven Design Taiwan Community Service Discovery • Client Side-Service Discovery • Application Load Balancer-based Service Discovery • DNS-Based Service Discovery • Service Discovery using ECS Event Stream • Configuration Management • New * App Service Mesh (preview) • Cloud Map
  • 18. © 2019, Domain Driven Design Taiwan Community Microservices For Persistence ? Stateful Persistent always be the top issue !!!
  • 19. © 2019, Domain Driven Design Taiwan Community • Accept all API calls to one RDS Cluster • RDS Instance Sizing predict by services scaling ability • DBA(s) : How to manage Connection Pool ? • Read replica can’t help on Write intention • RDS I/O be the bottleneck when highly Scale up • All Services impacted while any failure occurred • Option : Upgrade Read Replica to Master Launching 1 RDS cluster
  • 20. © 2019, Domain Driven Design Taiwan Community Launching N * RDS for Independency?
  • 21. © 2019, Domain Driven Design Taiwan Community • DynamoDB • Perfect deal with high transaction (write) • Serve each table for only one transaction/service intention • De-Normalize schema is required • Prevent revision issue • Hard to do complexity Join Query • Cost High • Low Performance • Coding for iteration & aggregation • Apply all RDS tables into DynamoDB? Using NoSQL Solution?
  • 22. © 2019, Domain Driven Design Taiwan Community It’s about capability • Are you ready to deal with M:N transaction compensation ? • Are you ready to embrace the rapidly change by contract ?
  • 23. © 2019, Domain Driven Design Taiwan Community 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
  • 24. © 2019, Domain Driven Design Taiwan Community Saga : Alternative for 2 Phase -commit
  • 25. © 2019, Domain Driven Design Taiwan Community 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.
  • 26. © 2019, Domain Driven Design Taiwan Community Problem How to maintain data consistency across services?
  • 27. © 2019, Domain Driven Design Taiwan Community Forces • 2 Phase-Commit(PC) is a well-known solution for years • The 2PC coordinator also represents a Single Point of Failure, which is unacceptable for critical systems
  • 28. © 2019, Domain Driven Design Taiwan Community 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
  • 29. © 2019, Domain Driven Design Taiwan Community Two ways of Saga Pattern • Choreography - each local transaction publishes domain events that trigger local transactions in other services • Orchestration - an orchestrator (object) tells the participants what local transactions to execute https://microservices.io/patterns/data/saga.html
  • 30. © 2019, Domain Driven Design Taiwan Community Choreography-based Saga https://microservices.io/patterns/data/saga.html 2 1 3.b 3.a 4.a 4.b • Logic in code • Compensate chain • Multiple states present in transaction
  • 31. © 2019, Domain Driven Design Taiwan Community Orchestration -based Saga https://microservices.io/patterns/data/saga.html • Coordinator stand alone • Each service provide a pair function for Success or Fail • Abstract compensate logic out of Codes1 1.1 2 3 45
  • 32. © 2019, Domain Driven Design Taiwan Community Resulting Context • This pattern has the following benefits: • It enables an application to maintain data consistency across multiple services without using distributed transactions • This solution has the following drawbacks: • The programming model is more complex. For example, a developer must design compensating transactions that explicitly undo changes made earlier in a saga. • There are also the following issues to address: • In order to be reliable, a service must atomically update its database and publish a message/event. It cannot use the traditional mechanism of a distributed transaction that spans the database and the message broker. Instead, it must use one of the patterns listed below.
  • 33. © 2019, Domain Driven Design Taiwan Community Implementing Saga
  • 34. © 2019, Domain Driven Design Taiwan Community • Each Service provide cancel operation • State change trigger cancel operation • Simplify Complexity rules • Just a JSON file
  • 35. © 2019, Domain Driven Design Taiwan Community Code snippet https://github.com/humank/lambda-saga-pattern
  • 36. © 2019, Domain Driven Design Taiwan Community Demo
  • 37. © 2019, Domain Driven Design Taiwan Community
  • 38. © 2019, Domain Driven Design Taiwan Community How to adopt Microservices?
  • 39. © 2019, Domain Driven Design Taiwan Community
  • 40. © 2019, Domain Driven Design Taiwan Community
  • 41. © 2019, Domain Driven Design Taiwan Community
  • 42. © 2019, Domain Driven Design Taiwan Community
  • 43. © 2019, Domain Driven Design Taiwan Community
  • 44. © 2019, Domain Driven Design Taiwan Community Business operation without whole picture The Blind Men and the Elephant Is It correct to all in microservices or serverless ?
  • 45. © 2019, Domain Driven Design Taiwan Community Precondition to do microservices Rapid Provisioning Basic monitoring Rapid application deployment Martin Fowler
  • 46. © 2019, Domain Driven Design Taiwan Community Better way to decompose Monolith Domain Expert Matters
  • 47. &
  • 48. © 2019, Domain Driven Design Taiwan Community How to break Monolith?
  • 49. © 2019, Domain Driven Design Taiwan Community Way to collaborate • Point out the events • Who send the command • Find the Noun(s) • Have all team voices Commands Events Aggregate
  • 50. © 2019, Domain Driven Design Taiwan Community Coffee shop experience DDD by EventStorming
  • 51. © 2019, Domain Driven Design Taiwan Community
  • 52. © 2019, Domain Driven Design Taiwan Community
  • 53. © 2019, Domain Driven Design Taiwan Community
  • 54. © 2019, Domain Driven Design Taiwan Community
  • 55. © 2019, Domain Driven Design Taiwan Community
  • 56. © 2019, Domain Driven Design Taiwan Community
  • 57. © 2019, Domain Driven Design Taiwan Community
  • 58. © 2019, Domain Driven Design Taiwan Community Go through Event Storming approach Don’t tell tech only Don’t sell tech partially Aim for Core value Figure out trigger and result
  • 59. © 2019, Domain Driven Design Taiwan Community Seat occupied Menu offered Ordered 2 cups of Americano Paid Order received Coffee made up Customers Left Table Cleaned *Key Business Events in Coffeeshop
  • 60. © 2019, Domain Driven Design Taiwan Community Event Trigger • Client • Server • Counter • Barista ACTORS
  • 61. © 2019, Domain Driven Design Taiwan Community Most Valuable / Risky Events
  • 62. © 2019, Domain Driven Design Taiwan Community © 2018, Amazon Web Services, Inc. or Its Affiliates. All rights reserved. Order Make Up Payment Event Bus (pub/sub) Put event Event Event CloudWatch Event . . . Any other messaging technology Coffee shop Domain implementation Core Domain Sub Domain (Messaging) Support Domain Core Domain
  • 63. © 2019, Domain Driven Design Taiwan Community When you should dive in Microservices Team Partners Business Operation Coding Value
  • 64. © 2019, Domain Driven Design Taiwan Community How DDD can help you • Business strategy on resource allocation • Best resources should be put in most key/core domain • Buy or out-sourcing common domain and sub domain • Service re-architecture • Form up the system context boundary • Knowing the upstream-downstream relationship between domains • Meaningful to do microservice (separate computing/persist, and API communication ) • Service Migration • Good to re-architecture
  • 65. © 2019, Domain Driven Design Taiwan Community 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
  • 66. © 2019, Domain Driven Design Taiwan Community Implementing DDD on AWS Commounty : DDD Taiwan@FB Telegram : YikaiKao WeChat : YikaiKao Twitter : @YikaiKao GitHub Repos