SlideShare a Scribd company logo
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved.
Data management
In Microservices
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !2
Data management
in Microservices
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !3
Monolithic
Application
DB
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !4
Microservices
Service 1 Service 2 Service 3
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !5
Microservices
Service 1 Service 2 Service 3
1. Shared database
DB
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !6
Microservices
Service 1 Service 2 Service 3
2. Database per service
DBDB DB
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !7
Database per service
High complexity
Query data across multiple databases
Challenge “How to join data ?”
Maintain database consistency
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !8
How to maintain data
consistency across services ?
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !9
We need …
Don’t need distributed transaction
Reduce complexity of code
Reliable
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !10
???
Service 1
Service 2
Service 3
Sequence of Tx and emit event or message
that trigger the next process in Tx
Event
produce
consume
Event
produce
consume
Timeline
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !11
???
Service 1
Service 2
Service 3
Sequence of Tx and emit event or message
that trigger the next process in Tx
1. command 2. response
3. command
4. response
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !12
Message vs Event
Message is addressed to someone
Event is something that happen and someone
can react to that
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !13
“Saga”
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !14
Event sourcing
Maintain source of truth of business
Immutable sequence of events
Event Event TimelineEventEvent Event
Sequence of event is keep in Event store
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !15
Event store
Keep events in order
Broadcast new event
Service 1 Service 2 Service 3
Event store
produce consume consume
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !16
With Event sourcing, we can
decouple services (query and
command)
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !17
CQRS
Command Query Responsibility Segregation
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !18
CQRS
Separate command and query services
Command Query
Event store
produce consume
DB
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !19
Event sourcing with database
Working with database
Bin log Event storeDB
bin log event
Binlog or Binary log event is information about data modification made to database
Event Event Event
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !20
Event sourcing
Duplication data (denormalize database)
Complexity (separate query and command)
Difficult to maintain
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !21
Event sourcing can’t solve all
problems
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !22
Start with understand your
purpose
Data management in Microservices
© 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !23
Start with understand your
problem to resolve

More Related Content

PDF
Wordpress for Newbie
PDF
Distributed Tracing
PDF
Part 2 :: Spring Boot testing
PDF
Sck spring-reactive
PDF
Microservices and APIs
PPTX
Intro to service mesh & Istio
PDF
2018 alldaydevops presentation
PPTX
HATech DevOps Services general introduction
Wordpress for Newbie
Distributed Tracing
Part 2 :: Spring Boot testing
Sck spring-reactive
Microservices and APIs
Intro to service mesh & Istio
2018 alldaydevops presentation
HATech DevOps Services general introduction

Similar to Manage data of service (20)

PPTX
Microservice - Data Management
PDF
vTalk#1 Microservices with Spring Boot
PPTX
Data services
PPTX
Managing Data at Scale - Microservices and Events
PPTX
Brown bag eventdrivenmicroservices-cqrs
PDF
Database@Home - Data Driven Reference Architecture
PDF
Study Notes - Event-Driven Data Management for Microservices
PPTX
Patterns of Distributed Application Design
PDF
Database@Home : Data Driven Apps - Data-driven Microservices Architecture wit...
PDF
Two way data sync between legacy and your brand new micro-service architecture
PPTX
Event driven Microservices Webinar
PDF
CDC patterns in Apache Kafka®
PPTX
Event Driven Architectures
PDF
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
PPTX
CQRS and Event Sourcing
PPTX
Azure Data Fundamentals DP 900 Full Course
PPTX
Event Driven Architectures - Phoenix Java Users Group 2013
PPTX
Scaling Your Architecture with Services and Events
PPTX
#dbhouseparty - Should I be building Microservices?
PDF
Presentation application change management and data masking strategies for ...
Microservice - Data Management
vTalk#1 Microservices with Spring Boot
Data services
Managing Data at Scale - Microservices and Events
Brown bag eventdrivenmicroservices-cqrs
Database@Home - Data Driven Reference Architecture
Study Notes - Event-Driven Data Management for Microservices
Patterns of Distributed Application Design
Database@Home : Data Driven Apps - Data-driven Microservices Architecture wit...
Two way data sync between legacy and your brand new micro-service architecture
Event driven Microservices Webinar
CDC patterns in Apache Kafka®
Event Driven Architectures
[Hands-on] CQRS(Command Query Responsibility Segregation) 와 Event Sourcing 패턴 실습
CQRS and Event Sourcing
Azure Data Fundamentals DP 900 Full Course
Event Driven Architectures - Phoenix Java Users Group 2013
Scaling Your Architecture with Services and Events
#dbhouseparty - Should I be building Microservices?
Presentation application change management and data masking strategies for ...
Ad

More from Somkiat Puisungnoen (20)

PDF
Next of Java 2022
PDF
Lesson learned from React native and Flutter
PDF
Angular :: basic tuning performance
PDF
Shared code between projects
PDF
RobotFramework Meetup at Thailand #2
PDF
Visual testing
PDF
Cloud Native App
PDF
Sck Agile in Real World
PDF
Clean you code
PDF
SCK Firestore at CNX
PDF
Unhappiness Developer
PDF
The Beauty of BAD code
PDF
React in the right way
PDF
Rise of Container (RoC)
PDF
SCK :: Scrum is NOT Enough
PDF
Software Development Trends 2017 at IMC
PDF
Design pattern with Java 8
PDF
Meetup :: Update Elastic Stack 5.0
PDF
Git as NoSQL
Next of Java 2022
Lesson learned from React native and Flutter
Angular :: basic tuning performance
Shared code between projects
RobotFramework Meetup at Thailand #2
Visual testing
Cloud Native App
Sck Agile in Real World
Clean you code
SCK Firestore at CNX
Unhappiness Developer
The Beauty of BAD code
React in the right way
Rise of Container (RoC)
SCK :: Scrum is NOT Enough
Software Development Trends 2017 at IMC
Design pattern with Java 8
Meetup :: Update Elastic Stack 5.0
Git as NoSQL
Ad

Recently uploaded (20)

PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPT
Teaching material agriculture food technology
PDF
KodekX | Application Modernization Development
PDF
Empathic Computing: Creating Shared Understanding
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Spectroscopy.pptx food analysis technology
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
Spectral efficient network and resource selection model in 5G networks
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Teaching material agriculture food technology
KodekX | Application Modernization Development
Empathic Computing: Creating Shared Understanding
NewMind AI Weekly Chronicles - August'25 Week I
Per capita expenditure prediction using model stacking based on satellite ima...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Approach and Philosophy of On baking technology
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
“AI and Expert System Decision Support & Business Intelligence Systems”
Spectroscopy.pptx food analysis technology
Mobile App Security Testing_ A Comprehensive Guide.pdf
sap open course for s4hana steps from ECC to s4
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...

Manage data of service

  • 1. © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. Data management In Microservices
  • 2. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !2 Data management in Microservices
  • 3. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !3 Monolithic Application DB
  • 4. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !4 Microservices Service 1 Service 2 Service 3
  • 5. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !5 Microservices Service 1 Service 2 Service 3 1. Shared database DB
  • 6. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !6 Microservices Service 1 Service 2 Service 3 2. Database per service DBDB DB
  • 7. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !7 Database per service High complexity Query data across multiple databases Challenge “How to join data ?” Maintain database consistency
  • 8. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !8 How to maintain data consistency across services ?
  • 9. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !9 We need … Don’t need distributed transaction Reduce complexity of code Reliable
  • 10. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !10 ??? Service 1 Service 2 Service 3 Sequence of Tx and emit event or message that trigger the next process in Tx Event produce consume Event produce consume Timeline
  • 11. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !11 ??? Service 1 Service 2 Service 3 Sequence of Tx and emit event or message that trigger the next process in Tx 1. command 2. response 3. command 4. response
  • 12. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !12 Message vs Event Message is addressed to someone Event is something that happen and someone can react to that
  • 13. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !13 “Saga”
  • 14. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !14 Event sourcing Maintain source of truth of business Immutable sequence of events Event Event TimelineEventEvent Event Sequence of event is keep in Event store
  • 15. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !15 Event store Keep events in order Broadcast new event Service 1 Service 2 Service 3 Event store produce consume consume
  • 16. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !16 With Event sourcing, we can decouple services (query and command)
  • 17. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !17 CQRS Command Query Responsibility Segregation
  • 18. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !18 CQRS Separate command and query services Command Query Event store produce consume DB
  • 19. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !19 Event sourcing with database Working with database Bin log Event storeDB bin log event Binlog or Binary log event is information about data modification made to database Event Event Event
  • 20. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !20 Event sourcing Duplication data (denormalize database) Complexity (separate query and command) Difficult to maintain
  • 21. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !21 Event sourcing can’t solve all problems
  • 22. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !22 Start with understand your purpose
  • 23. Data management in Microservices © 2017 - 2018 Siam Chamnankit Company Limited. All rights reserved. !23 Start with understand your problem to resolve