SlideShare una empresa de Scribd logo
1 de 35
1
Tudip Technologies
Continuously Delivering Digital Solutions with
Integrity | Innovation | Serenity
https://tudip.com/
Database Design for
Containerized Microservices
The world where we live in...
Organizations which design
systems … are constrained to
produce designs which are copies
of the communication structures of
these organizations.
-  M. Conway
Corollary by
James and Neil:
Therefore: Make sure the
organization is compatible
with the product architecture.
“
”
© 2019 Tudip Technologies. All Rights Reserved.
OTT System in Microservice Architecture
What is Microservice Architecture?
● As per Martin Fowler, services in a
microservice architecture (MSA) are often
processes that communicate over a network to
fulfill a goal using technology-agnostic
protocols such as HTTP.
● Services are independently deployable.
● Services are organized around fine-grained
business capabilities.
● Services can be implemented using different
programming languages, databases, hardware
and software environment, depending on what
fits best.
● This does not mean that a single microservice
is written in a patchwork of programming
languages.
© 2019 Tudip Technologies. All Rights Reserved.
• Multiple Components
• Built For Business, instead of technology
• Simple Routing
• Decentralized
• Failure Resistant
• Evolutionary
Salient features of Microservices
© 2019 Tudip Technologies. All Rights Reserved.
Loose coupling is the operative word, that means microservices should be able
to be modified without requiring changes in other microservices.
Overall Microservices
© 2019 Tudip Technologies. All Rights Reserved.
Microservices Pros
• Freedom to independently develop and
deploy services
• A microservice can be developed by a
fairly small team
• Code for different services can be written
in different languages (though
practitioners discourage it)
• Easy integration and automatic
deployment
• Easy to understand and modify for
developers, thus can help a new team
member become productive quickly
• The developers can make use of the
latest technologies
• The code is organized around business
capabilities
• When change is required in a certain part
of the application, only the related service
can be modified and redeployed—no
need to modify and redeploy the entire
application
• Better fault isolation: if one microservice
fails, the other will continue to work
• Easy to scale and integrate with third-
party services
• No long-term commitment to technology
stack
© 2019 Tudip Technologies. All Rights Reserved.
Microservices Cons
• Due to distributed deployment, testing
can become complicated and tedious
• Increasing number of services can result
in information barriers
• The architecture brings additional
complexity as the developers have to
mitigate fault tolerance, network latency,
and deal with a variety of message
formats as well as load balancing
• Being a distributed system, it can result in
duplication of effort
• When number of services increases,
integration and managing whole products
can become complicated
• In addition to several complexities of
monolithic architecture, the developers
have to deal with the additional
complexity of a distributed system
• Developers have to put additional effort
into implementing the mechanism of
communication between the services
• Handling use cases that span more than
one service without using distributed
transactions is not only tough but also
requires communication and cooperation
between different teams
© 2019 Tudip Technologies. All Rights Reserved.
How Micro a Microservice should be?
Amazon's policy is that the team implementing a microservice
should be small enough that they can be fed by two-pizzas.
© 2019 Tudip Technologies. All Rights Reserved.
Is it all Rosy?
© 2019 Tudip Technologies. All Rights Reserved.
The Hardest Part About Microservices:
Database Design
© 2019 Tudip Technologies. All Rights Reserved.
Yes, database is the DOG!
© 2019 Tudip Technologies. All Rights Reserved.
Broadly, you have 2 options!
© 2019 Tudip Technologies. All Rights Reserved.
Option # 1, Monolithic Database
© 2019 Tudip Technologies. All Rights Reserved.
Option #1.1, Variation of Monolithic Database
© 2019 Tudip Technologies. All Rights Reserved.
Option #2, Multiple Databases
© 2019 Tudip Technologies. All Rights Reserved.
Problems in Monolithic Database
• You can NOT scale a service without scaling the database
• You can not deploy a service because change in 1 schema, going to affect other
microservices and hence you can not do Continuous Integration/Continuous
Deployments
• You would be stuck with an RDBMS OR NoSQL and can NOT pick what works the
best
• And hence, service preference of the DB would be completely lost
© 2019 Tudip Technologies. All Rights Reserved.
Well, what about 2PC (Phase Commits)
• 2PC, is a mechanism for implementing a transaction across different software
components (multiple databases, message queues etc.)
• Well, if that is how you implement, the ghosts of limitations of Monolithic Database are
going to Haunt You!
© 2019 Tudip Technologies. All Rights Reserved.
Again, monolithic database is a DOG!
© 2019 Tudip Technologies. All Rights Reserved.
The Hardest Part About Microservices:
Your Data
https://blog.christianposta.com/microservices/the-hardest-part-about-microservices-data/
But challenges of the Database per Service..
© 2019 Tudip Technologies. All Rights Reserved.
Multiple Databases has its own challenges!
● Complexity of managing multiple SQL and NoSQL databases
● Implementing business transactions that span multiple services is not straightforward.
Moreover, many modern (NoSQL) databases don’t support them. The best solution is
to use the Saga pattern. Services publish events when they update data. Other
services subscribe to events and update their data in response.
● Implementing queries that join data that is now in multiple databases is challenging.
© 2019 Tudip Technologies. All Rights Reserved.
Saga
• Implement each business transaction that spans multiple services as a saga.
• A saga is a sequence of local transactions.
• Each local transaction updates the database and publishes a message or 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.
© 2019 Tudip Technologies. All Rights Reserved.
Saga Continues
© 2019 Tudip Technologies. All Rights Reserved.
2 ways to coordinating the Saga
• There are two ways of coordination sagas:
• 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
© 2019 Tudip Technologies. All Rights Reserved.
Here is choreography-based Saga
© 2019 Tudip Technologies. All Rights Reserved.
Choreography-based saga
© 2019 Tudip Technologies. All Rights Reserved.
Orchestration-based saga
© 2019 Tudip Technologies. All Rights Reserved.
And here is an Orchestra
© 2019 Tudip Technologies. All Rights Reserved.
And then there is always CQRS
© 2019 Tudip Technologies. All Rights Reserved.
CQRS: Command Query Responsibility Segregation
© 2019 Tudip Technologies. All Rights Reserved.
How did it work in one of our OTT project?
© 2019 Tudip Technologies. All Rights Reserved.
What all we have used in this application?
● Saga
● Along with CQRS
© 2019 Tudip Technologies. All Rights Reserved.
References
• https://en.wikipedia.org/wiki/Microservices
• https://en.wikipedia.org/wiki/Conway%27s_law
• https://microservices.io/patterns/data/event-sourcing.html
• https://auth0.com/blog/introduction-to-microservices-part-4-dependencies/
• https://stackoverflow.com/questions/41640621/data-sharing-between-micro-services
• https://www.baeldung.com/transactions-across-microservices
35
Thank You
Know more about Tudip here!

Más contenido relacionado

La actualidad más candente

La actualidad más candente (7)

Net essentials6e ch11
Net essentials6e ch11Net essentials6e ch11
Net essentials6e ch11
 
Exchange + WIndows Mobile Datasheet
Exchange + WIndows Mobile DatasheetExchange + WIndows Mobile Datasheet
Exchange + WIndows Mobile Datasheet
 
IT Infrastructure and Emerging Technologies
IT Infrastructure and Emerging TechnologiesIT Infrastructure and Emerging Technologies
IT Infrastructure and Emerging Technologies
 
IT Inftractructures - Evolution of IT Inftractructure
IT Inftractructures - Evolution of IT InftractructureIT Inftractructures - Evolution of IT Inftractructure
IT Inftractructures - Evolution of IT Inftractructure
 
Mobile Database and Service Oriented Architecture
Mobile Database and Service Oriented ArchitectureMobile Database and Service Oriented Architecture
Mobile Database and Service Oriented Architecture
 
Thin Client
Thin ClientThin Client
Thin Client
 
Mobile security
Mobile securityMobile security
Mobile security
 

Similar a Nasscom Presentation Microservices Database Architecture By Tudip

#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?Tammy Bednar
 
Deployability
DeployabilityDeployability
DeployabilityLen Bass
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes Abdul Basit Munda
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMohammedShahid562503
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science PlatformDecision Science Community
 
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 StrategiesMen and Mice
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to MicroservicesMahmoudZidan41
 
6 microservice architecture
6 microservice architecture6 microservice architecture
6 microservice architectureLen Bass
 
MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.PLovababu
 
Software Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based ArchitecturesSoftware Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based ArchitecturesAngelos Kapsimanis
 
Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?Wasantha Deshapriya
 
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 AppMeshChristian Posta
 
2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservices2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservicesKim Kao
 
SYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed aboutSYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed aboutCitrix
 
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 LinkerdChristian Posta
 

Similar a Nasscom Presentation Microservices Database Architecture By Tudip (20)

#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?#dbhouseparty - Should I be building Microservices?
#dbhouseparty - Should I be building Microservices?
 
Deployability
DeployabilityDeployability
Deployability
 
QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes QCon 2015 - Microservices Track Notes
QCon 2015 - Microservices Track Notes
 
MICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptxMICROSERVICES ARCHITECTURE unit -2.pptx
MICROSERVICES ARCHITECTURE unit -2.pptx
 
Technology insights: Decision Science Platform
Technology insights: Decision Science PlatformTechnology insights: Decision Science Platform
Technology insights: Decision Science Platform
 
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
 
Introduction to Microservices
Introduction to MicroservicesIntroduction to Microservices
Introduction to Microservices
 
6 microservice architecture
6 microservice architecture6 microservice architecture
6 microservice architecture
 
MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.MicroserviceArchitecture in detail over Monolith.
MicroserviceArchitecture in detail over Monolith.
 
Microservices: an introduction
Microservices: an introductionMicroservices: an introduction
Microservices: an introduction
 
Microservice intro
Microservice introMicroservice intro
Microservice intro
 
Software Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based ArchitecturesSoftware Architectures, Week 3 - Microservice-based Architectures
Software Architectures, Week 3 - Microservice-based Architectures
 
Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?Lanka government cloud: what, why & how?
Lanka government cloud: what, why & how?
 
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
 
Microservices vs monolithics betabeers
Microservices vs monolithics   betabeersMicroservices vs monolithics   betabeers
Microservices vs monolithics betabeers
 
Build A Scalable Mobile App
Build A Scalable Mobile App Build A Scalable Mobile App
Build A Scalable Mobile App
 
Microservices: Detailed Guide
Microservices: Detailed GuideMicroservices: Detailed Guide
Microservices: Detailed Guide
 
2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservices2019 03-23-2nd-meetup-essential capabilities behind microservices
2019 03-23-2nd-meetup-essential capabilities behind microservices
 
SYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed aboutSYN207: Newest and coolest NetScaler features you should be jazzed about
SYN207: Newest and coolest NetScaler features you should be jazzed about
 
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
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 

Nasscom Presentation Microservices Database Architecture By Tudip

  • 1. 1 Tudip Technologies Continuously Delivering Digital Solutions with Integrity | Innovation | Serenity https://tudip.com/
  • 3. The world where we live in... Organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations. -  M. Conway Corollary by James and Neil: Therefore: Make sure the organization is compatible with the product architecture. “ ”
  • 4. © 2019 Tudip Technologies. All Rights Reserved. OTT System in Microservice Architecture
  • 5. What is Microservice Architecture? ● As per Martin Fowler, services in a microservice architecture (MSA) are often processes that communicate over a network to fulfill a goal using technology-agnostic protocols such as HTTP. ● Services are independently deployable. ● Services are organized around fine-grained business capabilities. ● Services can be implemented using different programming languages, databases, hardware and software environment, depending on what fits best. ● This does not mean that a single microservice is written in a patchwork of programming languages.
  • 6. © 2019 Tudip Technologies. All Rights Reserved. • Multiple Components • Built For Business, instead of technology • Simple Routing • Decentralized • Failure Resistant • Evolutionary Salient features of Microservices
  • 7. © 2019 Tudip Technologies. All Rights Reserved. Loose coupling is the operative word, that means microservices should be able to be modified without requiring changes in other microservices. Overall Microservices
  • 8. © 2019 Tudip Technologies. All Rights Reserved. Microservices Pros • Freedom to independently develop and deploy services • A microservice can be developed by a fairly small team • Code for different services can be written in different languages (though practitioners discourage it) • Easy integration and automatic deployment • Easy to understand and modify for developers, thus can help a new team member become productive quickly • The developers can make use of the latest technologies • The code is organized around business capabilities • When change is required in a certain part of the application, only the related service can be modified and redeployed—no need to modify and redeploy the entire application • Better fault isolation: if one microservice fails, the other will continue to work • Easy to scale and integrate with third- party services • No long-term commitment to technology stack
  • 9. © 2019 Tudip Technologies. All Rights Reserved. Microservices Cons • Due to distributed deployment, testing can become complicated and tedious • Increasing number of services can result in information barriers • The architecture brings additional complexity as the developers have to mitigate fault tolerance, network latency, and deal with a variety of message formats as well as load balancing • Being a distributed system, it can result in duplication of effort • When number of services increases, integration and managing whole products can become complicated • In addition to several complexities of monolithic architecture, the developers have to deal with the additional complexity of a distributed system • Developers have to put additional effort into implementing the mechanism of communication between the services • Handling use cases that span more than one service without using distributed transactions is not only tough but also requires communication and cooperation between different teams
  • 10. © 2019 Tudip Technologies. All Rights Reserved. How Micro a Microservice should be? Amazon's policy is that the team implementing a microservice should be small enough that they can be fed by two-pizzas.
  • 11. © 2019 Tudip Technologies. All Rights Reserved. Is it all Rosy?
  • 12. © 2019 Tudip Technologies. All Rights Reserved. The Hardest Part About Microservices: Database Design
  • 13. © 2019 Tudip Technologies. All Rights Reserved. Yes, database is the DOG!
  • 14. © 2019 Tudip Technologies. All Rights Reserved. Broadly, you have 2 options!
  • 15. © 2019 Tudip Technologies. All Rights Reserved. Option # 1, Monolithic Database
  • 16. © 2019 Tudip Technologies. All Rights Reserved. Option #1.1, Variation of Monolithic Database
  • 17. © 2019 Tudip Technologies. All Rights Reserved. Option #2, Multiple Databases
  • 18. © 2019 Tudip Technologies. All Rights Reserved. Problems in Monolithic Database • You can NOT scale a service without scaling the database • You can not deploy a service because change in 1 schema, going to affect other microservices and hence you can not do Continuous Integration/Continuous Deployments • You would be stuck with an RDBMS OR NoSQL and can NOT pick what works the best • And hence, service preference of the DB would be completely lost
  • 19. © 2019 Tudip Technologies. All Rights Reserved. Well, what about 2PC (Phase Commits) • 2PC, is a mechanism for implementing a transaction across different software components (multiple databases, message queues etc.) • Well, if that is how you implement, the ghosts of limitations of Monolithic Database are going to Haunt You!
  • 20. © 2019 Tudip Technologies. All Rights Reserved. Again, monolithic database is a DOG!
  • 21. © 2019 Tudip Technologies. All Rights Reserved. The Hardest Part About Microservices: Your Data https://blog.christianposta.com/microservices/the-hardest-part-about-microservices-data/ But challenges of the Database per Service..
  • 22. © 2019 Tudip Technologies. All Rights Reserved. Multiple Databases has its own challenges! ● Complexity of managing multiple SQL and NoSQL databases ● Implementing business transactions that span multiple services is not straightforward. Moreover, many modern (NoSQL) databases don’t support them. The best solution is to use the Saga pattern. Services publish events when they update data. Other services subscribe to events and update their data in response. ● Implementing queries that join data that is now in multiple databases is challenging.
  • 23. © 2019 Tudip Technologies. All Rights Reserved. Saga • Implement each business transaction that spans multiple services as a saga. • A saga is a sequence of local transactions. • Each local transaction updates the database and publishes a message or 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.
  • 24. © 2019 Tudip Technologies. All Rights Reserved. Saga Continues
  • 25. © 2019 Tudip Technologies. All Rights Reserved. 2 ways to coordinating the Saga • There are two ways of coordination sagas: • 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
  • 26. © 2019 Tudip Technologies. All Rights Reserved. Here is choreography-based Saga
  • 27. © 2019 Tudip Technologies. All Rights Reserved. Choreography-based saga
  • 28. © 2019 Tudip Technologies. All Rights Reserved. Orchestration-based saga
  • 29. © 2019 Tudip Technologies. All Rights Reserved. And here is an Orchestra
  • 30. © 2019 Tudip Technologies. All Rights Reserved. And then there is always CQRS
  • 31. © 2019 Tudip Technologies. All Rights Reserved. CQRS: Command Query Responsibility Segregation
  • 32. © 2019 Tudip Technologies. All Rights Reserved. How did it work in one of our OTT project?
  • 33. © 2019 Tudip Technologies. All Rights Reserved. What all we have used in this application? ● Saga ● Along with CQRS
  • 34. © 2019 Tudip Technologies. All Rights Reserved. References • https://en.wikipedia.org/wiki/Microservices • https://en.wikipedia.org/wiki/Conway%27s_law • https://microservices.io/patterns/data/event-sourcing.html • https://auth0.com/blog/introduction-to-microservices-part-4-dependencies/ • https://stackoverflow.com/questions/41640621/data-sharing-between-micro-services • https://www.baeldung.com/transactions-across-microservices
  • 35. 35 Thank You Know more about Tudip here!